|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdods.dap.Attribute
public class Attribute
An Attribute
holds information about a single attribute in an
AttributeTable
. It has a type, and contains either a
Vector
of String
s containing the attribute's
values, or a reference to an AttributeTable
, if the
Attribute
is a container. An Attribute
may also
be created as an alias pointing to another Attribute
of any
type, including container.
AttributeTable
Field Summary | |
---|---|
static int |
BYTE
Byte attribute type. |
static int |
CONTAINER
Container attribute type. |
static int |
FLOAT32
Float32 attribute type. |
static int |
FLOAT64
Float64 attribute type. |
static int |
INT16
Int16 attribute type. |
static int |
INT32
Int32 attribute type. |
static int |
STRING
String attribute type. |
static int |
UINT16
UInt16 attribute type. |
static int |
UINT32
UInt32 attribute type. |
static int |
UNKNOWN
Unknown attribute type. |
static int |
URL
URL attribute type. |
Constructor Summary | |
---|---|
Attribute(AttributeTable container)
Deprecated. Use the ctor with the name. |
|
Attribute(int type,
java.lang.String name,
java.lang.String value)
Construct an Attribute with the given type and initial
value. |
|
Attribute(int type,
java.lang.String name,
java.lang.String value,
boolean check)
Construct an Attribute with the given type and initial
value. |
|
Attribute(java.lang.String aliasedTo,
Attribute attr)
Construct an attribute aliased to the given name and contents. |
|
Attribute(java.lang.String name,
AttributeTable container)
Construct a container attribute. |
|
Attribute(java.lang.String name,
int type)
Construct an empty attribute with the given type. |
Method Summary | |
---|---|
void |
appendValue(java.lang.String value)
Append a value to this attribute. |
void |
appendValue(java.lang.String value,
boolean check)
Append a value to this attribute. |
java.lang.Object |
clone()
Returns a clone of this Attribute . |
void |
deleteValueAt(int index)
Remove the i 'th String from this attribute. |
java.lang.String |
getAliasedTo()
Returns the name of the attribute aliased to. |
AttributeTable |
getContainer()
Returns the AttributeTable container. |
java.lang.String |
getName()
Returns the attribute's name. |
int |
getType()
Returns the attribute type constant. |
java.lang.String |
getTypeString()
Returns the attribute type as a String . |
java.lang.String |
getValueAt(int index)
Returns the attribute value at index . |
java.util.Enumeration |
getValues()
Returns the values of this attribute as an Enumeration
of String . |
boolean |
isAlias()
Returns true if the attribute is an alias. |
boolean |
isContainer()
Returns true if the attribute is a container. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int CONTAINER
public static final int BYTE
public static final int INT16
public static final int UINT16
public static final int INT32
public static final int UINT32
public static final int FLOAT32
public static final int FLOAT64
public static final int STRING
public static final int URL
Constructor Detail |
---|
public Attribute(AttributeTable container)
container
- the AttributeTable
container.public Attribute(int type, java.lang.String name, java.lang.String value, boolean check) throws AttributeBadValueException
Attribute
with the given type and initial
value.
type
- the type of attribute to create. Use one of the type
constants defined by this class.name
- the name of the attribute.value
- the initial value of this attribute. Use the
appendValue
method to create a vector of values.check
- if true, check the value and throw
AttributeBadValueException if it's not valid; if false do not check its
validity.
AttributeBadValueException
- thrown if the value is not a legal
member of typepublic Attribute(int type, java.lang.String name, java.lang.String value) throws AttributeBadValueException
Attribute
with the given type and initial
value. Checks the value of the attribute and throws an exception if
it's not valid.
type
- the type of attribute to create. Use one of the type
constants defined by this class.name
- the name of the attribute.value
- the initial value of this attribute. Use the
appendValue
method to create a vector of values.
AttributeBadValueException
- thrown if the value is not a legal
member of typepublic Attribute(java.lang.String name, AttributeTable container)
container
- the AttributeTable
container.public Attribute(java.lang.String aliasedTo, Attribute attr)
aliasedTo
- the name of the target Attribute
. This is
necessary because Attribute
doesn't know its own name
(this is handled by the DAS
or
AttributeTable
holding it.attr
- the Attribute
to point to.public Attribute(java.lang.String name, int type) throws java.lang.IllegalArgumentException
type
- the type of attribute to create. Use one of the type
constants defined by this class, other than CONTAINER
.
java.lang.IllegalArgumentException
- thrown if
type
is CONTAINER
. To construct an empty
container attribute, first construct and empty AttributeTable and then
use that to construct the Attribute.Method Detail |
---|
public java.lang.Object clone()
Attribute
. A deep copy is performed
on all attribute values.
clone
in class java.lang.Object
Attribute
.public final java.lang.String getTypeString()
String
.
String
.public final int getType()
public final java.lang.String getName()
public final boolean isContainer()
public final boolean isAlias()
public final java.lang.String getAliasedTo()
public final AttributeTable getContainer()
AttributeTable
container.
AttributeTable
container.public final java.util.Enumeration getValues()
Enumeration
of String
.
Enumeration
of String
.public final java.lang.String getValueAt(int index)
index
.
index
- the index of the attribute value to return.
String
at index
.public final void appendValue(java.lang.String value) throws AttributeBadValueException
value
- the attribute String
to add.
AttributeBadValueException
- thrown if the value is not a legal
member of typepublic final void appendValue(java.lang.String value, boolean check) throws AttributeBadValueException
value
- the attribute String
to add.check
- if true, check the validity of he attribute's value, if
false don't.
AttributeBadValueException
- thrown if the value is not a legal
member of typepublic final void deleteValueAt(int index)
i
'th String
from this attribute.
index
- the index of the value to remove.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |