|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.nc2.Attribute
public class Attribute
An Attribute has a name and a value, used for associating arbitrary metadata with a Variable or a Group. The value can be a one dimensional array of Strings or numeric values. Attributes are considered immutable : do not change them after they have been constructed.
| Field Summary | |
|---|---|
protected DataType |
dataType
|
protected Index |
ima
|
protected java.lang.String |
name
|
protected int |
nelems
|
protected Array |
values
|
| Constructor Summary | |
|---|---|
protected |
Attribute()
|
|
Attribute(Parameter param)
A copy constructor using a ucar.unidata.util.Parameter. |
|
Attribute(java.lang.String name)
Constructor. |
|
Attribute(java.lang.String name,
Array values)
Construct attribute with list of values. |
|
Attribute(java.lang.String name,
Attribute from)
Copy constructor |
|
Attribute(java.lang.String name,
boolean validate)
Constructor. |
|
Attribute(java.lang.String name,
java.lang.Number val)
Create a scalar numeric-valued Attribute. |
|
Attribute(java.lang.String name,
java.lang.String val)
Create a String-valued Attribute. |
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
Instances which have same content are equal. |
DataType |
getDataType()
Get the data type of the Attribute value. |
int |
getLength()
Get the length of the array of values; = 1 if scaler. |
java.lang.String |
getName()
Get the name of this Attribute. |
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 String value; only call if isString() is true. |
Array |
getValues()
Get the value as an Array. |
int |
hashCode()
Override Object.hashCode() to implement equals. |
boolean |
isArray()
True if value is an array (getLength() > 1) |
boolean |
isString()
True if value is a String or String[]. |
void |
setName(java.lang.String name)
Set the name of the Attribute. |
void |
setStringValue(java.lang.String val)
set the value as a String, trimming trailing zeroes |
protected void |
setValueOld(java.lang.Object val)
Deprecated. use setValues( Array val) |
void |
setValues(Array arr)
set the values from an Array |
java.lang.String |
toString()
String representation |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected DataType dataType
protected int nelems
protected Array values
protected Index ima
| Constructor Detail |
|---|
protected Attribute()
public Attribute(java.lang.String name)
public Attribute(java.lang.String name,
boolean validate)
public Attribute(java.lang.String name,
Attribute from)
public Attribute(java.lang.String name,
java.lang.String val)
public Attribute(java.lang.String name,
java.lang.Number val)
public Attribute(java.lang.String name,
Array values)
name - name of attributevalues - array of values.public Attribute(Parameter param)
param - copy info from here.| Method Detail |
|---|
public java.lang.String getName()
public DataType getDataType()
public boolean isString()
public boolean isArray()
public int getLength()
public Array getValues()
public java.lang.String getStringValue()
isString()public java.lang.String getStringValue(int index)
isString()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 boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setName(java.lang.String name)
protected void setValueOld(java.lang.Object val)
public void setStringValue(java.lang.String val)
public void setValues(Array arr)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||