public class Attribute extends CDMNode
annotations, dodsname, group, immutable, parentstruct, shortName, sort| Modifier | Constructor and Description |
|---|---|
|
Attribute(Parameter param)
A copy constructor using a ucar.unidata.util.Parameter.
|
protected |
Attribute(java.lang.String name)
Constructor.
|
|
Attribute(java.lang.String name,
Array values)
Construct attribute with Array of values.
|
|
Attribute(java.lang.String name,
Array values,
boolean isUnsigned)
Construct attribute with Array of values.
|
|
Attribute(java.lang.String name,
Attribute from)
Copy constructor
|
|
Attribute(java.lang.String name,
DataType dataType)
Construct an empty attribute with no values
|
|
Attribute(java.lang.String name,
java.util.List values) |
|
Attribute(java.lang.String name,
java.util.List values,
boolean isUnsigned)
Construct attribute with list of String or Number values.
|
|
Attribute(java.lang.String name,
java.lang.Number val)
Create a scalar numeric-valued Attribute.
|
|
Attribute(java.lang.String name,
java.lang.Number val,
boolean isUnsigned) |
|
Attribute(java.lang.String name,
java.lang.String val)
Create a String-valued Attribute.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
encodeString(java.lang.String s)
Replace special characters '\t', '\n', '\f', '\r'.
|
boolean |
equals(java.lang.Object o)
Instances which have same content are equal.
|
DataType |
getDataType()
Get the data type of the Attribute value.
|
EnumTypedef |
getEnumType() |
int |
getLength()
Get the length of the array of values
|
java.lang.Number |
getNumericValue()
Retrieve numeric value.
|
java.lang.Number |
getNumericValue(int index)
Retrieve a numeric value by index.
|
java.lang.String |
getStringValue()
Retrieve String value; only call if isString() is true.
|
java.lang.String |
getStringValue(int index)
Retrieve ith String value; only call if isString() is true.
|
java.lang.Object |
getValue(int index)
Get the value as an Object.
|
Array |
getValues()
Get the value as an Array.
|
int |
hashCode()
Override Object.hashCode() to implement equals.
|
void |
hashCodeShow(Indent indent) |
boolean |
isArray()
True if value is an array (getLength() > 1)
|
boolean |
isString()
True if value is of type String and not null.
|
boolean |
isUnsigned()
Find whether the underlying data should be interpreted as unsigned.
|
static java.util.Map<java.lang.String,Attribute> |
makeMap(java.util.List<Attribute> atts)
Turn a list into a map
|
void |
setDataType(DataType dt) |
void |
setEnumType(EnumTypedef en) |
void |
setName(java.lang.String name)
Set the name of this Attribute.
|
void |
setValues(Array arr)
set the values from an Array
|
void |
setValues(java.util.List values,
boolean isUnsigned)
set the values from a list
|
static boolean |
suppress(Attribute a,
boolean strict) |
java.lang.String |
toString()
CDL representation, not strict
|
java.lang.String |
toString(boolean strict)
CDL representation, may be strict
|
protected void |
writeCDL(java.util.Formatter f,
boolean strict,
java.lang.String parentname)
Write CDL representation into f
|
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentGroup, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setImmutable, setParentGroup, setParentStructure, setShortName, setSort, unwrappublic Attribute(java.lang.String name,
Attribute from)
name - name of new Attributefrom - copy value from here.public Attribute(java.lang.String name,
java.lang.String val)
name - name of Attributeval - value of Attributepublic Attribute(java.lang.String name,
java.lang.Number val)
name - name of Attributeval - value of Attributepublic Attribute(java.lang.String name,
java.lang.Number val,
boolean isUnsigned)
public Attribute(java.lang.String name,
Array values)
name - name of attributevalues - array of values.public Attribute(java.lang.String name,
DataType dataType)
name - dataType - public Attribute(java.lang.String name,
java.util.List values)
public Attribute(java.lang.String name,
java.util.List values,
boolean isUnsigned)
name - name of attributevalues - list of values. must be String or Number, must all be the same type, and have at least 1 memberisUnsigned - public Attribute(java.lang.String name,
Array values,
boolean isUnsigned)
name - name of attributevalues - Array of values; at least 1 memberisUnsigned - public Attribute(Parameter param)
param - copy info from here.protected Attribute(java.lang.String name)
name - name of Attributepublic static java.util.Map<java.lang.String,Attribute> makeMap(java.util.List<Attribute> atts)
atts - list of attributespublic static boolean suppress(Attribute a, boolean strict)
public DataType getDataType()
public void setDataType(DataType dt)
public EnumTypedef getEnumType()
public void setEnumType(EnumTypedef en)
public boolean isArray()
public int getLength()
public boolean isUnsigned()
public Array getValues()
public java.lang.Object getValue(int index)
index - which indexpublic boolean isString()
public java.lang.String getStringValue()
isString()public java.lang.String getStringValue(int index)
index - which indexisString()public java.lang.Number getNumericValue()
getNumericValue(0)public java.lang.Number getNumericValue(int index)
index - the index into the value array.value[index], or null if its a non-parsable String or
the index is out of range.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean strict)
strict - if true, create strict CDL, escaping namesprotected void writeCDL(java.util.Formatter f,
boolean strict,
java.lang.String parentname)
f - write into thisstrict - if true, create strict CDL, escaping namespublic static java.lang.String encodeString(java.lang.String s)
s - string to quotepublic void setValues(java.util.List values,
boolean isUnsigned)
values - public void setValues(Array arr)
arr - value of Attributepublic void setName(java.lang.String name)
name - name of attributepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void hashCodeShow(Indent indent)
hashCodeShow in class CDMNode