edu.unh.sdb.common
Class Datum

java.lang.Object
  extended by edu.unh.sdb.common.Datum
Direct Known Subclasses:
ByteDatum, DoubleDatum, FloatDatum, IntDatum, MixedDatum, ShortDatum

public abstract class Datum
extends java.lang.Object

Represents multiple data values (attributes) for a single point in the index space.


Constructor Summary
Datum()
          Default constructor does nothing.
 
Method Summary
abstract  int byteSize()
          Return the size in bytes required to store the attributes in the datum.
abstract  java.lang.Object clone()
          Return a copy of this datum.
abstract  void copyTo(Datum d)
          Copy the values of this Datum object into the argument datum.
static Datum create(byte value)
          Create a single attribute Datum composed of 1 byte.
static Datum create(byte[] vals)
          Create a multi attribute Datum composed of byte attributes.
static Datum create(double value)
          Create a single attribute Datum composed of 1 double.
static Datum create(double[] vals)
          Create a multi attribute Datum composed of double attributes.
static Datum create(float value)
          Create a single attribute Datum composed of 1 float.
static Datum create(float[] vals)
          Create a multi attribute Datum composed of double attributes.
static Datum create(int value)
          Create a single attribute Datum composed of 1 int.
static Datum create(int[] vals)
          Create a multi attribute Datum composed of int attributes.
static Datum create(RecordDescriptor rd)
          Create a multi attribute Datum composed of mixed type attributes.
static Datum create(RecordDescriptor rd, RecordSpec rs)
          Create a multi attribute Datum composed of mixed type attributes.
static Datum create(short value)
          Create a single attribute Datum composed of 1 short.
static Datum create(short[] vals)
          Create a multi attribute Datum composed of short attributes.
abstract  byte getByte(int i)
          Return the field specified by the argument as a byte.
 byte[] getBytes()
          Return all attributes of the Datum as a 1-d byte array
 byte[] getBytes(byte[] fill)
          Return all attributes of the Datum in the passed array.
 void getBytes(byte[] destination, int index)
          Returns all the attributes of the Datum in the passed array, storing them starting at 'index'.
abstract  double getDouble(int i)
          Return the field specified by the argument as a double.
 double[] getDoubles()
          Return all attributes of the Datum as a 1-d double array
 double[] getDoubles(double[] fill)
          Return all attributes of the Datum in the passed array.
abstract  float getFloat(int i)
          Return the field specified by the argument as a float.
 float[] getFloats()
          Return all attributes of the Datum as a 1-d float array
 float[] getFloats(float[] fill)
          Return all attributes of the Datum in the passed array.
abstract  int getInt(int i)
          Return the field specified by the argument as a int.
 int[] getInts()
          Return all attributes of the Datum as a 1-d int array
 int[] getInts(int[] fill)
          Return all attributes of the Datum in the passed array.
 int getNumAttributes()
          Return the number of attributes in the datum.
abstract  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
 short[] getShorts(short[] fill)
          Return all attributes of the Datum in the passed array.
abstract  int getStorageType()
          Return the StorageType for this Datum.
abstract  Values getValues()
          Return all attributes of the Datum in a Values object
abstract  void setByte(int i, byte v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setBytes(byte[] data)
          Copy the values in the argument array to this datum.
 void setBytes(byte[] data, int start)
          Copy the values in the argument array to this datum.
 void setBytes(byte[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
abstract  void setDouble(int i, double v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setDoubles(double[] data)
          Copy the values in the argument array to this datum.
 void setDoubles(double[] data, int start)
          Copy values from a piece of the argument array to this datum.
 void setDoubles(double[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
abstract  void setFloat(int i, float v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setFloats(float[] data)
          Copy the values in the argument array to this datum.
 void setFloats(float[] data, int start)
          Copy the values in the argument array to this datum.
 void setFloats(float[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
abstract  void setInt(int i, int v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setInts(int[] data)
          Copy the values in the argument array to this datum.
 void setInts(int[] data, int start)
          Copy the values in the argument array to this datum.
 void setInts(int[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
abstract  void setShort(int i, short v)
          Set the attribute indicated by the first argument to the value of the second argument.
 void setShorts(short[] data)
          Copy the values in the argument array to this datum.
 void setShorts(short[] data, int start)
          Copy the values in the argument array to this datum.
 void setShorts(short[] values, int startIndex, int numAttributes)
          Assigns values to an existing datum by copying a subset of values from an array.
abstract  int size()
          Return the number of attributes in the datum.
abstract  void subset(Datum d, RecordSpec spec)
          Copy the attributes specified by the RecordSpec into the argument datum.
abstract  Datum subset(RecordSpec spec)
          Return a new datum with the attributes indicated by the RecordSpec.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Datum

public Datum()
Default constructor does nothing.

Method Detail

create

public static Datum create(double value)
Create a single attribute Datum composed of 1 double.


create

public static Datum create(double[] vals)
Create a multi attribute Datum composed of double attributes.


create

public static Datum create(float value)
Create a single attribute Datum composed of 1 float.


create

public static Datum create(float[] vals)
Create a multi attribute Datum composed of double attributes.


create

public static Datum create(int value)
Create a single attribute Datum composed of 1 int.


create

public static Datum create(int[] vals)
Create a multi attribute Datum composed of int attributes.


create

public static Datum create(short value)
Create a single attribute Datum composed of 1 short.


create

public static Datum create(short[] vals)
Create a multi attribute Datum composed of short attributes.


create

public static Datum create(byte value)
Create a single attribute Datum composed of 1 byte.


create

public static Datum create(byte[] vals)
Create a multi attribute Datum composed of byte attributes.


create

public static Datum create(RecordDescriptor rd)
Create a multi attribute Datum composed of mixed type attributes.


create

public static Datum create(RecordDescriptor rd,
                           RecordSpec rs)
Create a multi attribute Datum composed of mixed type attributes.


clone

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

Overrides:
clone in class java.lang.Object

copyTo

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


setDouble

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


setFloat

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


setInt

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


setShort

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


setByte

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


getDouble

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


getFloat

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


getInt

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


getShort

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


getByte

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


getDoubles

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


getDoubles

public double[] getDoubles(double[] fill)
Return all attributes of the Datum in the passed array. Passed array is returned for convenience, but if it is null or not the right length, a new array is created and returned.


getFloats

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


getFloats

public float[] getFloats(float[] fill)
Return all attributes of the Datum in the passed array. Passed array is returned for convenience, but if it is null or not the right length, a new array is created and returned.


getInts

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


getInts

public int[] getInts(int[] fill)
Return all attributes of the Datum in the passed array. Passed array is returned for convenience, but if it is null or not the right length, a new array is created and returned.


getShorts

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


getShorts

public short[] getShorts(short[] fill)
Return all attributes of the Datum in the passed array. Passed array is returned for convenience, but if it is null or not the right length, a new array is created and returned.


getBytes

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


getBytes

public byte[] getBytes(byte[] fill)
Return all attributes of the Datum in the passed array. Passed array is returned for convenience, but if it is null or not the right length, a new array is created and returned.


getBytes

public void getBytes(byte[] destination,
                     int index)
Returns all the attributes of the Datum in the passed array, storing them starting at 'index'. It is an error for 'destination' to be null. 'Index' should be within bounds of 'destination' array.


getValues

public abstract Values getValues()
Return all attributes of the Datum in a Values object


setDoubles

public void setDoubles(double[] data)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setDoubles

public void setDoubles(double[] data,
                       int start)
Copy values from a piece of the argument array to this datum. The 2nd argument indicates where in the array to start the copy. Copy enough data to fill the Datum. It is an error if there is not enough data.


setDoubles

public void setDoubles(double[] 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 the object contains too few attributes to hold the new data, an error occurs.


setFloats

public void setFloats(float[] data)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setFloats

public void setFloats(float[] data,
                      int start)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setFloats

public void setFloats(float[] 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 the object contains too few attributes to hold the new data, an error occurs.


setInts

public void setInts(int[] data)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setInts

public void setInts(int[] data,
                    int start)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setInts

public void setInts(int[] 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 the object contains too few attributes to hold the new data, an error occurs.


setShorts

public void setShorts(short[] data)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setShorts

public void setShorts(short[] data,
                      int start)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the 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 the object contains too few attributes to hold the new data, an error occurs.


setBytes

public void setBytes(byte[] data)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setBytes

public void setBytes(byte[] data,
                     int start)
Copy the values in the argument array to this datum. The array length should be <= the number of attributes in the datum.


setBytes

public void setBytes(byte[] 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 the object contains too few attributes to hold the new data, an error occurs.


subset

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


subset

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


getStorageType

public abstract int getStorageType()
Return the StorageType for this Datum.


size

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


byteSize

public abstract int byteSize()
Return the size in bytes required to store the attributes in the datum.


getNumAttributes

public final int getNumAttributes()
Return the number of attributes in the datum. Alternative to size() that is consistent with the same method in other classes.