edu.unh.sdb.common
Class MixedValues

java.lang.Object
  extended by edu.unh.sdb.common.Values
      extended by edu.unh.sdb.common.MixedValues

public class MixedValues
extends Values

MixedValues stores attributes as byte sequences in a 1 D byte array


Constructor Summary
protected MixedValues()
          construct a MixedValues with no data
  MixedValues(RecordDescriptor rd)
          construct a MixedValues with no data
  MixedValues(RecordDescriptor rd, byte[] byteArray)
          construct a MixedValues for a given byte array
  MixedValues(RecordDescriptor rd, int size)
          construct a MixedValues, given the size of the byteArray
 
Method Summary
 byte[] byteValues()
          Deprecated. Use getDataReference()
 float[] floatValues()
          Deprecated. Use getFloats();
 byte getByte(int index)
          return the byte value of the item at the given index of the byte array
 byte[] getBytes()
          Return a byte array representing all elements in the Values object
 byte[] getBytes(byte[] filler)
          fill the passed array with this data
 byte[] getDataReference()
          Return a reference to the data array this object contains.
 double getDouble(int index)
          return the double value represented by 8 adjacent bytes, starting with the byte of the given index
 double[] getDoubles()
          Return double array representing all elements in the Values object
 double[] getDoubles(double[] filler)
          fill the passed array with this data
 float getFloat(int index)
          return the float value represented by 4 adjacent bytes, starting with the byte of the given index
 float[] getFloats()
          Return float array representing all elements in the Values object
 float[] getFloats(float[] filler)
          fill the passed array with this data
 int getInt(int index)
          return the int value represented by 4 adjacent bytes, starting with the byte of the given index.
 int[] getInts()
          Return int array representing all elements in the Values object
 int[] getInts(int[] filler)
          fill the passed array with this data
 short getShort(int index)
          return the short value represented by 2 adjacent bytes, starting with the byte of the given index.
 short[] getShorts()
          Return a short array representing all elements in the Values object
 short[] getShorts(short[] filler)
          fill the passed array with this data
 int getStorageType()
          get StorageType
 Values reorder(int step)
          Return a new Values object with the values shuffled.
 void setByte(int index, byte val)
          Set the specified entry to the specified value after conversion, if needed.
 void setDouble(int index, double val)
          Set the specified entry to the specified value after conversion, if needed.
 void setFloat(int index, float val)
          Set the specified entry to the specified value after conversion, if needed.
 void setInt(int index, int val)
          Set the specified entry to the specified value after conversion, if needed.
 void setShort(int index, short val)
          Set the specified entry to the specified value after conversion, if needed.
 void setValues(int start, Values newVals)
          Assign elements of the passed in Values object to this one beginning at the start index .
 void setValues(Values newVals)
          Assign the data from the argument Values object to this object.
 int size()
          return the size of the 1 D array, in which the data is stored ( number of bytes)
 Values spawn()
          create a copy of this object
 Values spawn(int start, int stride, int count)
          Create a new instance of MixedValues with a subsest of the data in this object.
 
Methods inherited from class edu.unh.sdb.common.Values
getBytes, getBytes, getBytes, getBytes, getDoubles, getDoubles, getDoubles, getDoubles, getFloats, getFloats, getFloats, getFloats, getInts, getInts, getInts, getInts, getShorts, getShorts, getShorts, getShorts, main, spawn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MixedValues

protected MixedValues()
construct a MixedValues with no data


MixedValues

public MixedValues(RecordDescriptor rd)
construct a MixedValues with no data


MixedValues

public MixedValues(RecordDescriptor rd,
                   byte[] byteArray)
construct a MixedValues for a given byte array


MixedValues

public MixedValues(RecordDescriptor rd,
                   int size)
construct a MixedValues, given the size of the byteArray

Method Detail

spawn

public Values spawn()
create a copy of this object

Specified by:
spawn in class Values

spawn

public Values spawn(int start,
                    int stride,
                    int count)
Create a new instance of MixedValues with a subsest of the data in this object. Subsets can be contiguous or can have a stride as is done in point order storage. If there aren't "count" values to copy, the returned object will only be as large as the available values.

Specified by:
spawn in class Values
Parameters:
start - - first value to copy
stride - - steps between values
count - - number of values to copy

getStorageType

public int getStorageType()
get StorageType

Specified by:
getStorageType in class Values

size

public int size()
return the size of the 1 D array, in which the data is stored ( number of bytes)

Specified by:
size in class Values

reorder

public Values reorder(int step)
Return a new Values object with the values shuffled. This method starts at positions 0 through step-1, copying every "step" values to the new array. This has the effect of converting an attribute ordered array to a point ordered array or vice versa. The Values object does not actually need to know the axisOrdering, the conversion is the same.

Specified by:
reorder in class Values

getDoubles

public double[] getDoubles()
Return double array representing all elements in the Values object

Specified by:
getDoubles in class Values

getFloats

public float[] getFloats()
Return float array representing all elements in the Values object

Specified by:
getFloats in class Values

getInts

public int[] getInts()
Return int array representing all elements in the Values object

Specified by:
getInts in class Values

getShorts

public short[] getShorts()
Return a short array representing all elements in the Values object

Specified by:
getShorts in class Values

getBytes

public byte[] getBytes()
Return a byte array representing all elements in the Values object

Specified by:
getBytes in class Values

getDoubles

public double[] getDoubles(double[] filler)
fill the passed array with this data

Overrides:
getDoubles in class Values

getFloats

public float[] getFloats(float[] filler)
fill the passed array with this data

Overrides:
getFloats in class Values

getInts

public int[] getInts(int[] filler)
fill the passed array with this data

Overrides:
getInts in class Values

getShorts

public short[] getShorts(short[] filler)
fill the passed array with this data

Overrides:
getShorts in class Values

getBytes

public byte[] getBytes(byte[] filler)
fill the passed array with this data

Overrides:
getBytes in class Values

getFloat

public float getFloat(int index)
               throws java.lang.NumberFormatException
return the float value represented by 4 adjacent bytes, starting with the byte of the given index

Specified by:
getFloat in class Values
Throws:
java.lang.NumberFormatException

getDouble

public double getDouble(int index)
                 throws java.lang.NumberFormatException
return the double value represented by 8 adjacent bytes, starting with the byte of the given index

Specified by:
getDouble in class Values
Throws:
java.lang.NumberFormatException

getInt

public int getInt(int index)
           throws java.lang.NumberFormatException
return the int value represented by 4 adjacent bytes, starting with the byte of the given index. If there are not enought bytes to convert to a int, NumberFormatException is thrown

Specified by:
getInt in class Values
Throws:
java.lang.NumberFormatException

getShort

public short getShort(int index)
return the short value represented by 2 adjacent bytes, starting with the byte of the given index. If there are not enought bytes to convert to a short, NumberFormatException is thrown

Specified by:
getShort in class Values

getByte

public byte getByte(int index)
return the byte value of the item at the given index of the byte array

Specified by:
getByte in class Values

byteValues

public byte[] byteValues()
Deprecated. Use getDataReference()

Return a reference to the byte data array this object contains. Note that each attribute value in the object uses a different number of bytes.


getDataReference

public byte[] getDataReference()
Return a reference to the data array this object contains.


floatValues

public float[] floatValues()
Deprecated. Use getFloats();

return the float array representation of the byte array.


setDouble

public void setDouble(int index,
                      double val)
Set the specified entry to the specified value after conversion, if needed. Questionable implementation

Specified by:
setDouble in class Values

setFloat

public void setFloat(int index,
                     float val)
Set the specified entry to the specified value after conversion, if needed. Questionable implementation

Specified by:
setFloat in class Values

setInt

public void setInt(int index,
                   int val)
Set the specified entry to the specified value after conversion, if needed. Questionable implementation

Specified by:
setInt in class Values

setShort

public void setShort(int index,
                     short val)
Set the specified entry to the specified value after conversion, if needed. Questionable implementation

Specified by:
setShort in class Values

setByte

public void setByte(int index,
                    byte val)
Set the specified entry to the specified value after conversion, if needed. Questionable implementation

Specified by:
setByte in class Values

setValues

public void setValues(Values newVals)
Assign the data from the argument Values object to this object. This object will now have a new data size that is the same as the arguments. (This version clones the data; do we want to just reference it?)

Specified by:
setValues in class Values

setValues

public void setValues(int start,
                      Values newVals)
Assign elements of the passed in Values object to this one beginning at the start index . Do conversions as needed. If the argument size is less than is available beginning at the start position, only the remaining values will be changed.

Specified by:
setValues in class Values