String getType() { return bt == null ? "" : bt.getTypeName(); }
return isUnsigned ? DataType.UBYTE : DataType.BYTE; else throw new IllegalArgumentException("DODSVariable illegal type = " + dtype.getTypeName());
/** * Write the variable's declaration in a C-style syntax. This * function is used to create textual representation of the Data * Descriptor Structure (DDS). See <em>The OPeNDAP User Manual</em> for * information about this structure. * * @param os The <code>PrintWriter</code> on which to print the * declaration. * @param space Each line of the declaration will begin with the * characters in this string. Usually used for leading spaces. * @param print_semi a boolean value indicating whether to print a * semicolon at the end of the declaration. * @param constrained a boolean value indicating whether to print * the declartion dependent on the projection information. <b>This * is only used by Server side code.</b> * @see DDS */ public void printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained) { //System.out.println("BaseType.printDecl()..."); os.print(space + getTypeName() + " " + getName()); if (print_semi) os.println(";"); }
/** * Write the variable's declaration in a C-style syntax. This * function is used to create textual representation of the Data * Descriptor Structure (DDS). See <em>The OPeNDAP User Manual</em> for * information about this structure. * * @param os The <code>PrintWriter</code> on which to print the * declaration. * @param space Each line of the declaration will begin with the * characters in this string. Usually used for leading spaces. * @param print_semi a boolean value indicating whether to print a * semicolon at the end of the declaration. * @param constrained a boolean value indicating whether to print * the declartion dependent on the projection information. <b>This * is only used by Server side code.</b> * @see DDS */ public void printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained) { //LogStream.out.println("BaseType.printDecl()..."); os.print(space + getTypeName() + " " + getEncodedName()); if (print_semi) os.println(";"); }
private static DAPVariable convertToAtomicDAPVariable(BaseType ddsVariable) { final String name = ddsVariable.getEncodedName(); final String typeName = "atomic"; final String dataTypeName = ddsVariable.getTypeName(); final DArrayDimension[] dimensions = new DArrayDimension[0]; return new DAPVariable(name, typeName, dataTypeName, dimensions); }
/** * * @param pw * @param pad * @param constrained * @opendap.ddx.experimental */ public void printXML(PrintWriter pw, String pad, boolean constrained) { pw.print(pad + "<" + getTypeName()); if (_nameClear != null) { pw.print(" name=\"" + DDSXMLParser.normalizeToXML(_nameClear) + "\""); } Enumeration e = getAttributeNames(); if (e.hasMoreElements()) { pw.println(">"); while (e.hasMoreElements()) { String aName = (String) e.nextElement(); Attribute a = getAttribute(aName); if(a!=null) a.printXML(pw, pad + "\t", constrained); } pw.println(pad + "</" + getTypeName() + ">"); } else { pw.println("/>"); } }
/** * * @param pw * @param pad * @param constrained * @opendap.ddx.experimental */ public void printXML(PrintWriter pw, String pad, boolean constrained) { pw.print(pad + "<" + getTypeName()); if (_name != null) { pw.print(" name=\"" + opendap.dap.XMLparser.DDSXMLParser.normalizeToXML(_name) + "\""); } Enumeration e = getAttributeNames(); if (e.hasMoreElements()) { pw.println(">"); while (e.hasMoreElements()) { String aName = (String) e.nextElement(); Attribute a = getAttribute(aName); if(a!=null) a.printXML(pw, pad + "\t", constrained); } pw.println(pad + "</" + getTypeName() + ">"); } else { pw.println("/>"); } }
private static String getDataTypeName(DArray array) { return array.getPrimitiveVector().getTemplate().getTypeName(); }
public void showPrimitive(BaseType data, PrintWriter pw, boolean addName, String rootName, boolean newLine) { if (addName) { pw.print(toASCIIFlatName(data, rootName)); pw.print(", "); } if (data instanceof DString) // covers DURL case showString(pw, ((DString) data).getValue()); else if (data instanceof DFloat32) pw.print((new Float(((DFloat32) data).getValue())).toString()); else if (data instanceof DFloat64) pw.print((new Double(((DFloat64) data).getValue())).toString()); else if (data instanceof DUInt32) pw.print((new Long(((DUInt32) data).getValue() & ((long) 0xFFFFFFFF))).toString()); else if (data instanceof DUInt16) pw.print((new Integer(((DUInt16) data).getValue() & 0xFFFF)).toString()); else if (data instanceof DInt32) pw.print((new Integer(((DInt32) data).getValue())).toString()); else if (data instanceof DInt16) pw.print((new Short(((DInt16) data).getValue())).toString()); else if (data instanceof DByte) pw.print((new Integer(((DByte) data).getValue() & 0xFF)).toString()); else pw.print("Not implemented type = " + data.getTypeName() + " " + data.getEncodedName() + "\n"); if (newLine) pw.print("\n"); }
public void showPrimitive(BaseType data, PrintWriter pw, boolean addName, String rootName, boolean newLine) { if (addName) { pw.print(toASCIIFlatName(data, rootName)); pw.print(", "); } if (data instanceof DString) // covers DURL case showString(pw, ((DString) data).getValue()); else if (data instanceof DFloat32) pw.print((new Float(((DFloat32) data).getValue())).toString()); else if (data instanceof DFloat64) pw.print((new Double(((DFloat64) data).getValue())).toString()); else if (data instanceof DUInt32) pw.print((new Long(((DUInt32) data).getValue() & ((long) 0xFFFFFFFF))).toString()); else if (data instanceof DUInt16) pw.print((new Integer(((DUInt16) data).getValue() & 0xFFFF)).toString()); else if (data instanceof DInt32) pw.print((new Integer(((DInt32) data).getValue())).toString()); else if (data instanceof DInt16) pw.print((new Short(((DInt16) data).getValue())).toString()); else if (data instanceof DByte) pw.print((new Integer(((DByte) data).getValue() & 0xFF)).toString()); else pw.print("Not implemented type = " + data.getTypeName() + " " + data.getName() + "\n"); if (newLine) pw.print("\n"); }
DAPNode.log.debug("Checking "+dc.getTypeName()+" "+dc.getClearName()+" for name conflicts."); throw new BadSemanticsException("The variable '" + dc.getLongName() + "' has an Attribute with the same name ('" + aName + "') as one of it's " + "member variables (" + bt.getTypeName() + " " + bt.getEncodedName() + ")\n" + "This is NOT allowed.");
if (_Debug) System.out.println("Got template: " + bt.getTypeName() + " " + bt.getClearName());
+ ((BaseType) s).getTypeName() + ".serialize() (Name: " + ((BaseType) s).getEncodedName()
System.out.println(subIndent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());
+ ((BaseType) s).getTypeName() + ".serialize() (Name: " + ((BaseType) s).getName()
throw new BadSemanticsException("The variable '" + dc.getLongName() + "' has an Attribute with the same name ('" + aName + "') as one of it's " + "member variables (" + bt.getTypeName() + " " + bt.getName() + ")\n" + "This is NOT allowed.");
if (dodsV.darray == null) { if (debugConstruct) System.out.println(" assigned to scalar " + dodsBT.getTypeName() + ": name = " + dodsShortName); return new DODSVariable(this, parentGroup, parentStructure, dodsShortName, dodsBT, dodsV); } else { logger.warn("DODSNetcdf " + location + " didnt process basetype <" + dodsBT.getTypeName() + "> variable = " + dodsShortName); return null;
System.out.println(subIndent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());
if (_Debug) System.out.println("Got template: " + bt.getTypeName() + " " + bt.getClearName());
private static DAPVariable convertToDAPVariable(BaseType ddsVariable) { final DArray array; if (ddsVariable instanceof DGrid) { final DGrid grid = (DGrid) ddsVariable; array = grid.getArray(); } else if (ddsVariable instanceof DArray) { array = (DArray) ddsVariable; } else { return convertToAtomicDAPVariable(ddsVariable); } final String name = ddsVariable.getEncodedName(); final String typeName = ddsVariable.getTypeName(); final String dataTypeName = getDataTypeName(array); final DArrayDimension[] dimensions = getDimensions(array); return new DAPVariable(name, typeName, dataTypeName, dimensions); }