context.arch.storage
Class Attribute

java.lang.Object
  extended bycontext.arch.storage.Attribute
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
AttributeFunction, AttributeNameValue

public class Attribute
extends java.lang.Object
implements java.lang.Comparable

This class is a container for an attribute name, subAttributes (used for structures - STRUCT) and type. Implements Comparable; for proper operation Attributes must compare by name.


Field Summary
static java.lang.String ATTRIBUTE
          Tag for an attribute
static java.lang.String ATTRIBUTE_TYPE
          Tag for an attribute data type
protected  Attributes attributes
           
static java.lang.String DEFAULT_TYPE
          Tag for default attribute type
static java.lang.String DOUBLE
          Tag for DOUBLE datatype
static java.lang.String FLOAT
          Tag for FLOAT datatype
static java.lang.String INT
          Tag for INT datatype
static java.lang.String LONG
          Tag for LONG datatype
protected  java.lang.String name
           
static java.lang.String SHORT
          Tag for SHORT datatype
static java.lang.String STRING
          Tag for STRING datatype
static java.lang.String STRUCT
          Tag for structure type
protected  java.lang.String type
           
 
Constructor Summary
Attribute()
          Empty constructor
Attribute(DataObject attribute)
          Constructor that takes a DataObject as input.
Attribute(java.lang.String name)
          Constructor that takes only a name
Attribute(java.lang.String name, Attributes attributes, java.lang.String type)
          Constructor that takes a name, value, and type
 
Method Summary
 int compareTo(java.lang.Object o)
          Attributes can be ordered by name
 java.lang.String getName()
          Returns the name of the stored attribute
 Attributes getSubAttributes()
          Returns the subAttributes of the stored attribute
 java.lang.String getType()
          Returns the datatype of the attribute
 void setName(java.lang.String name)
          Sets the name of an attribute
 void setSubAttributes(Attributes attributes)
          Sets the subAttributes of this attribute
 void setType(java.lang.String type)
          Sets the datatype of an attribute
 DataObject toDataObject()
          Converts this object to a DataObject.
 java.lang.String toString()
          A printable version of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

attributes

protected Attributes attributes

type

protected java.lang.String type

ATTRIBUTE_TYPE

public static final java.lang.String ATTRIBUTE_TYPE
Tag for an attribute data type

See Also:
Constant Field Values

ATTRIBUTE

public static final java.lang.String ATTRIBUTE
Tag for an attribute

See Also:
Constant Field Values

DEFAULT_TYPE

public static final java.lang.String DEFAULT_TYPE
Tag for default attribute type

See Also:
Constant Field Values

STRUCT

public static final java.lang.String STRUCT
Tag for structure type

See Also:
Constant Field Values

LONG

public static final java.lang.String LONG
Tag for LONG datatype

See Also:
Constant Field Values

DOUBLE

public static final java.lang.String DOUBLE
Tag for DOUBLE datatype

See Also:
Constant Field Values

FLOAT

public static final java.lang.String FLOAT
Tag for FLOAT datatype

See Also:
Constant Field Values

SHORT

public static final java.lang.String SHORT
Tag for SHORT datatype

See Also:
Constant Field Values

INT

public static final java.lang.String INT
Tag for INT datatype

See Also:
Constant Field Values

STRING

public static final java.lang.String STRING
Tag for STRING datatype

See Also:
Constant Field Values
Constructor Detail

Attribute

public Attribute()
Empty constructor


Attribute

public Attribute(java.lang.String name)
Constructor that takes only a name

Parameters:
name - Name of attribute to store

Attribute

public Attribute(java.lang.String name,
                 Attributes attributes,
                 java.lang.String type)
Constructor that takes a name, value, and type

Parameters:
name - Name of attribute to store
attributes - subAttributes of this attribute
type - Datatype of attribute to store

Attribute

public Attribute(DataObject attribute)
Constructor that takes a DataObject as input. The DataObject must have as its top-level tag

Parameters:
attribute - DataObject containing the attribute info
Method Detail

toDataObject

public DataObject toDataObject()
Converts this object to a DataObject.

Returns:
Attribute object converted to an DataObject

setName

public void setName(java.lang.String name)
Sets the name of an attribute

Parameters:
name - Name of the attribute to store

setSubAttributes

public void setSubAttributes(Attributes attributes)
Sets the subAttributes of this attribute

Parameters:
attributes - subAttributes of the attribute to store

setType

public void setType(java.lang.String type)
Sets the datatype of an attribute

Parameters:
type - Datatype of the attribute to store

getName

public java.lang.String getName()
Returns the name of the stored attribute

Returns:
name of the stored attribute

getSubAttributes

public Attributes getSubAttributes()
Returns the subAttributes of the stored attribute

Returns:
subAttributes of the stored attribute

getType

public java.lang.String getType()
Returns the datatype of the attribute

Returns:
name of the attribute

toString

public java.lang.String toString()
A printable version of this class.

Returns:
String version of this class

compareTo

public int compareTo(java.lang.Object o)
Attributes can be ordered by name

Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(java.lang.Object)