edu.unh.sdb.common
Class ShortDatum

java.lang.Object
  extended by edu.unh.sdb.common.Datum
      extended by edu.unh.sdb.common.ShortDatum

public class ShortDatum
extends Datum

Represent multiple data values for a single point. This implementation stores values as an array of shorts, regardless of the orginal type of an attribute.


Constructor Summary
ShortDatum(Datum d)
          Copy Constructor creates a copy of the argument datum.
ShortDatum(int numvalues)
          Creates a null datum with the specified number of values.
ShortDatum(int[] values)
          Creates a datum with attributes containing the argument values.
ShortDatum(short value)
          Deprecated.  
ShortDatum(short[] values)
          Creates a datum with attributes containing the argument values.
ShortDatum(short[] values, int startIndex, int numAttributes)
          Deprecated. Not really deprecated. Just looking for usage. specifies the datum index of the datum to be copied, where all datums in the array are assumed to be of the same length.
ShortDatum(ShortDatum d)
          Copy Constructor creates a copy of the argument datum.
ShortDatum(ShortDatum[] datums)
          This constructor creates a single ShortDatum from an array of datums.
 
Method Summary
 void assign(short[] data)
          Deprecated. Use setShorts( short[] )/
 void assign(short[] values, int startIndex, int numAttributes)
          Deprecated. Use setShorts( short[], int start, int numAttr ); Note that the semantics of the start argument of setShorts is different.
 int byteSize()
          Return the size in bytes needed to store the data for the attributes.
 java.lang.Object clone()
          Return a copy of this datum.
 void copyTo(Datum d)
          Copy the values of this ShortDatum object into the argument datum.
 void copyTo(ShortDatum d)
          Copy the values of this ShortDatum object into the argument datum.
 boolean equals(java.lang.Object o)
          Determine if the argument is a ShortDatum with the same set of data values.
 byte getByte(int i)
          Return the field specified by the argument as a byte.
 double getDouble(int i)
          Return the field specified by the argument as a double.
 float getFloat(int i)
          Return the field specified by the argument as a float.
 int getInt(int i)
          Return the field specified by the argument as a int.
 short getShort(int i)
          Return the field specified by the argument as a short.
 short[] getShorts()
          Return all attributes of the Datum as a 1-d short array
 int getStorageType()
          Return the StorageType for this Datum
 Values getValues()
          Return all attributes in a Values object
 void setByte(int i, byte v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setDouble(int i, double v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setFloat(int i, float v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setInt(int i, int v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setShort(int i, short v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setShorts(short[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
 int size()
          Return the number of attributes in the datum.
 void subset(Datum d, RecordSpec spec)
          Copy the attributes specified by the RecordSpec into the argument datum.
 Datum subset(RecordSpec spec)
          Return a new datum with the attributes indicated by the RecordSpec.
 void subset(ShortDatum d, RecordSpec spec)
          Copy the attributes specified by the RecordSpec into the argument datum.
 java.lang.String toString()
          Return a string representation of the datum.
 
Methods inherited from class edu.unh.sdb.common.Datum
create, create, create, create, create, create, create, create, create, create, create, create, getBytes, getBytes, getBytes, getDoubles, getDoubles, getFloats, getFloats, getInts, getInts, getNumAttributes, getShorts, setBytes, setBytes, setBytes, setDoubles, setDoubles, setDoubles, setFloats, setFloats, setFloats, setInts, setInts, setInts, setShorts, setShorts
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShortDatum

public ShortDatum(int numvalues)
Creates a null datum with the specified number of values.


ShortDatum

public ShortDatum(short value)
Deprecated. 

Creates a datum with a single attribute containing the argument value.


ShortDatum

public ShortDatum(short[] values)
Creates a datum with attributes containing the argument values.


ShortDatum

public ShortDatum(short[] values,
                  int startIndex,
                  int numAttributes)
Deprecated. Not really deprecated. Just looking for usage. specifies the datum index of the datum to be copied, where all datums in the array are assumed to be of the same length.

Creates a datum by copying a subset of values from an array. The second argument specifies where to start copying; the 3rd argument specifies how many values to copy.


ShortDatum

public ShortDatum(int[] values)
Creates a datum with attributes containing the argument values.


ShortDatum

public ShortDatum(ShortDatum d)
Copy Constructor creates a copy of the argument datum.


ShortDatum

public ShortDatum(Datum d)
Copy Constructor creates a copy of the argument datum.


ShortDatum

public ShortDatum(ShortDatum[] datums)
This constructor creates a single ShortDatum from an array of datums. The Datums in the array are copied in the order they are given.

Method Detail

clone

public java.lang.Object clone()
Return a copy of this datum.

Specified by:
clone in class Datum

copyTo

public void copyTo(ShortDatum d)
Copy the values of this ShortDatum object into the argument datum.


copyTo

public void copyTo(Datum d)
Copy the values of this ShortDatum object into the argument datum.

Specified by:
copyTo in class Datum

equals

public boolean equals(java.lang.Object o)
Determine if the argument is a ShortDatum with the same set of data values.

Overrides:
equals in class java.lang.Object

setDouble

public void setDouble(int i,
                      double v)
Set the attribute indicated by the first argument to the value of the second argument.

Specified by:
setDouble in class Datum

setFloat

public void setFloat(int i,
                     float v)
Set the attribute indicated by the first argument to the value of the second argument.

Specified by:
setFloat in class Datum

setInt

public void setInt(int i,
                   int v)
Set the attribute indicated by the first argument to the value of the second argument.

Specified by:
setInt in class Datum

setShort

public void setShort(int i,
                     short v)
Set the attribute indicated by the first argument to the value of the second argument.

Specified by:
setShort in class Datum

setByte

public void setByte(int i,
                    byte v)
Set the attribute indicated by the first argument to the value of the second argument.

Specified by:
setByte in class Datum

setShorts

public void setShorts(short[] values,
                      int startIndex,
                      int numAttributes)
Assigns values to an existing datum by copying a subset of values from an array. The second argument specifies where to start copying; the 3rd argument defines how many values to copy. If this object contains too few attributes to hold the new data, an error is created.

Overrides:
setShorts in class Datum

assign

public void assign(short[] data)
Deprecated. Use setShorts( short[] )/

Copy the values in the argument to this datum.


assign

public void assign(short[] values,
                   int startIndex,
                   int numAttributes)
Deprecated. Use setShorts( short[], int start, int numAttr ); Note that the semantics of the start argument of setShorts is different.

Assigns values to an existing datum by copying a subset of values from an array. 2nd arg specifies the datum index of the datum to be copied, where all datums in the array are assumed to be of the same length. Copying continues until numAttributes elements have been copied. If this object contains too few attributes to hold the new data, an error is created.


getDouble

public double getDouble(int i)
Return the field specified by the argument as a double.

Specified by:
getDouble in class Datum

getFloat

public float getFloat(int i)
Return the field specified by the argument as a float.

Specified by:
getFloat in class Datum

getInt

public int getInt(int i)
Return the field specified by the argument as a int.

Specified by:
getInt in class Datum

getShort

public short getShort(int i)
Return the field specified by the argument as a short.

Specified by:
getShort in class Datum

getByte

public byte getByte(int i)
Return the field specified by the argument as a byte.

Specified by:
getByte in class Datum

getShorts

public short[] getShorts()
Return all attributes of the Datum as a 1-d short array

Overrides:
getShorts in class Datum

getValues

public Values getValues()
Return all attributes in a Values object

Specified by:
getValues in class Datum

subset

public Datum subset(RecordSpec spec)
Return a new datum with the attributes indicated by the RecordSpec. The values of these attributes are taken from this ShortDatum object.

Specified by:
subset in class Datum

subset

public void subset(ShortDatum d,
                   RecordSpec spec)
Copy the attributes specified by the RecordSpec into the argument datum.


subset

public void subset(Datum d,
                   RecordSpec spec)
Copy the attributes specified by the RecordSpec into the argument datum.

Specified by:
subset in class Datum

toString

public java.lang.String toString()
Return a string representation of the datum.

Overrides:
toString in class java.lang.Object

size

public int size()
Return the number of attributes in the datum.

Specified by:
size in class Datum

byteSize

public int byteSize()
Return the size in bytes needed to store the data for the attributes.

Specified by:
byteSize in class Datum

getStorageType

public int getStorageType()
Return the StorageType for this Datum

Specified by:
getStorageType in class Datum