uk.ac.bristol.star.cdf
Class AttributeEntry

java.lang.Object
  extended by uk.ac.bristol.star.cdf.AttributeEntry

public class AttributeEntry
extends java.lang.Object

Represents an entry in a global or variable attribute.

Since:
28 Jun 2013

Constructor Summary
AttributeEntry(DataType dataType, java.lang.Object rawValue, int nitem)
          Constructor.
 
Method Summary
 DataType getDataType()
          Returns the data type of this entry.
 java.lang.Object getItem(int itemIndex)
          Returns an object representing one of the items in this entry.
 int getItemCount()
          Returns the number of items in this entry.
 java.lang.Object getRawValue()
          Returns the array object storing the original representation of the object in the CDF.
 java.lang.Object getShapedValue()
          Returns the value of this entry as a convenient object.
 java.lang.String toString()
          Formats the value of this entry as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeEntry

public AttributeEntry(DataType dataType,
                      java.lang.Object rawValue,
                      int nitem)
Constructor.

Parameters:
dataType - data type
rawValue - array object storing original representation of the object in the CDF (array of primitives or Strings)
nitem - number of items represented by the array
Method Detail

getDataType

public DataType getDataType()
Returns the data type of this entry.

Returns:
data type

getRawValue

public java.lang.Object getRawValue()
Returns the array object storing the original representation of the object in the CDF. This is either an array of either primitives or Strings.

Returns:
raw array value

getShapedValue

public java.lang.Object getShapedValue()
Returns the value of this entry as a convenient object. If the item count is 1 it's the same as getItem(0), and if the item count is >1 it's the same as the raw value.

Returns:
shaped entry value

getItemCount

public int getItemCount()
Returns the number of items in this entry.

Returns:
item count

getItem

public java.lang.Object getItem(int itemIndex)
Returns an object representing one of the items in this entry. If the raw array is a primitive, the result is a wrapper object.

Parameters:
itemIndex - item index
Returns:
value of item

toString

public java.lang.String toString()
Formats the value of this entry as a string.

Overrides:
toString in class java.lang.Object