edu.ksu.cis.projects.bogor.module.value
Class UniformValueArray

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.module.value.UniformValueArray
All Implemented Interfaces:
IValueArray, Disposable, Serializable

public class UniformValueArray
extends Object
implements IValueArray, Serializable

The default implementation of IValueArray

Version:
CVS $Revision: 1.5 $ $Date: 2005/01/14 15:48:13 $
Author:
Robby , Matt Hoosier
See Also:
Serialized Form

Field Summary
protected  Type baseType
           
protected static byte DOUBLE_TYPE
          A constant to indicate a double type.
protected  double[] doubleElementValues
          Holds the values of this array value's double value elements.
protected  byte elementType
           
protected static byte FLOAT_TYPE
          A constant to indicate a float type.
protected  float[] floatElementValues
          Holds the values of this array value's float value elements.
protected static byte INT_TYPE
          A constant to indicate an int type.
protected  int[] intElementValues
          Holds the values of this array value's int value elements.
protected static byte LONG_TYPE
          A constant to indicate a long type.
protected  long[] longElementValues
          Holds the values of this array value's long value elements.
protected static byte NON_PRIMITIVE_TYPE
          A constant to indicate a non-primitive type.
protected  INonPrimitiveValue[] nonPrimitiveElementValues
          Holds the values of this array value's non-primitive value elements.
protected static byte PRIMITIVE_EXT_TYPE
          A constant to indicate a primitive ext type.
protected  IPrimitiveExtValue[] primitiveExtElementValues
          Holds the values of this array value's primitive ext value elements.
protected  int size
           
protected  IValueFactory valueFactory
          Holds the value factory.
 
Constructor Summary
protected UniformValueArray()
          Private constructor for cloning purposes.
protected UniformValueArray(IValueFactory valueFactory, IValue[] elementValues)
          Default constructor.
 
Method Summary
 IValueArray clone(boolean deepClone, Map<Object,Object> cloneMap)
          Clone this value array.
 void dispose()
          Remove references.
 IValue getElementValue(int elementIndex)
          Gets a value array element's value.
 int getLength()
          Gets the length of this value array.
 void linearize(boolean isMapDefaultValues, int bitsPerNonPrimitiveValue, ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap, int bitsPerThreadId, IntIntTable threadOrderMap, BitSet elidedPositions, BitBuffer bb)
          Linearizes the contained values.
 void linearize(boolean isMapDefaultValues, int bitsPerNonPrimitiveValue, ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap, int bitsPerThreadId, IntIntTable threadOrderMap, BitSet elidedPositions, BitBuffer bb, int fromIndex, int toIndex)
          Linearizes the contained values.
 void setElementValue(int elementIndex, IValue elementValue)
          Sets a value array element's value.
 IValue[] toArray()
          Returns the contained values as an array.
 String toString()
           
 void validate(IBogorConfiguration bc)
          Validates this value array wrt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INT_TYPE

protected static final byte INT_TYPE
A constant to indicate an int type.

See Also:
Constant Field Values

LONG_TYPE

protected static final byte LONG_TYPE
A constant to indicate a long type.

See Also:
Constant Field Values

FLOAT_TYPE

protected static final byte FLOAT_TYPE
A constant to indicate a float type.

See Also:
Constant Field Values

DOUBLE_TYPE

protected static final byte DOUBLE_TYPE
A constant to indicate a double type.

See Also:
Constant Field Values

PRIMITIVE_EXT_TYPE

protected static final byte PRIMITIVE_EXT_TYPE
A constant to indicate a primitive ext type.

See Also:
Constant Field Values

NON_PRIMITIVE_TYPE

protected static final byte NON_PRIMITIVE_TYPE
A constant to indicate a non-primitive type.

See Also:
Constant Field Values

valueFactory

protected transient IValueFactory valueFactory
Holds the value factory. Non-null. Needed to create IPrimitiveValue to implement getElementValue since we store each primitive value by its corresponding Java primitive values.


intElementValues

protected int[] intElementValues
Holds the values of this array value's int value elements. Non-null if there is at least one int value element.


longElementValues

protected long[] longElementValues
Holds the values of this array value's long value elements. Non-null if there is at least one long value element.


floatElementValues

protected float[] floatElementValues
Holds the values of this array value's float value elements. Non-null if there is at least one float value element.


doubleElementValues

protected double[] doubleElementValues
Holds the values of this array value's double value elements. Non-null if there is at least one double value element.


primitiveExtElementValues

protected IPrimitiveExtValue[] primitiveExtElementValues
Holds the values of this array value's primitive ext value elements. Non-null if there is at least one primitive ext value element. Each element is non-null.


nonPrimitiveElementValues

protected INonPrimitiveValue[] nonPrimitiveElementValues
Holds the values of this array value's non-primitive value elements. Non-null if there is at least one non-primitive value element. Each element is non-null.


baseType

protected Type baseType

elementType

protected byte elementType

size

protected int size
Constructor Detail

UniformValueArray

protected UniformValueArray(IValueFactory valueFactory,
                            IValue[] elementValues)
Default constructor.

Parameters:
valueFactory - The value factory for this value array. Needed to create IPrimitiveValue to implement getElementValue since we store each primitive value by its corresponding ava primitive values.
elementValues - The element values for this value array. Must be non-null. Each element must be non-null.

UniformValueArray

protected UniformValueArray()
Private constructor for cloning purposes.

Method Detail

setElementValue

public void setElementValue(int elementIndex,
                            IValue elementValue)
Description copied from interface: IValueArray
Sets a value array element's value.

Specified by:
setElementValue in interface IValueArray
Parameters:
elementIndex - The index of the element in this value array. Must be greater than zero and less than the length of this value array.
elementValue - The new value of the element. Must be non-null.

getElementValue

public IValue getElementValue(int elementIndex)
Description copied from interface: IValueArray
Gets a value array element's value.

Specified by:
getElementValue in interface IValueArray
Parameters:
elementIndex - The index of the element in this value array. Must be greater than zero and less than the length of this value array.
Returns:
The element's array value. Non-null.

getLength

public int getLength()
Description copied from interface: IValueArray
Gets the length of this value array.

Specified by:
getLength in interface IValueArray
Returns:
The length of this value array. At least zero.

clone

public IValueArray clone(boolean deepClone,
                         Map<Object,Object> cloneMap)
Description copied from interface: IValueArray
Clone this value array.

Specified by:
clone in interface IValueArray
Parameters:
deepClone - Indicates whether deep cloning.
cloneMap - Original values (IValue) to their clones ( IValue) mapping. The clone map to solve circular references in values. If this value is a key in the map, then this method returns the value of the key in the map. Must be non-null if deep cloning.
Returns:
The clone this value array.

dispose

public void dispose()
Description copied from interface: Disposable
Remove references. Once called, avoid using this object.

Specified by:
dispose in interface Disposable

linearize

public void linearize(boolean isMapDefaultValues,
                      int bitsPerNonPrimitiveValue,
                      ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap,
                      int bitsPerThreadId,
                      IntIntTable threadOrderMap,
                      BitSet elidedPositions,
                      BitBuffer bb)
Description copied from interface: IValueArray
Linearizes the contained values.

Specified by:
linearize in interface IValueArray
Parameters:
isMapDefaultValues - Indicates whether to bitmap default values.
bitsPerNonPrimitiveValue - The number of bits used to encode a non-primitive value.
nonPrimitiveValueIdMap - A mapping of non-primitive values to their unique id. Must be non-null.
bitsPerThreadId - The number of bits used to encode a thread descriptor.
threadOrderMap - A mapping of thread descriptors to their order number. Must be non-null.
elidedPositions - A bitset indicating which elements of the array should be omitted from the bit-vector. A null reference here indicates that all elements should be linearized.
bb - The bit-buffer for linearizing the values. Must be non-null.

linearize

public void linearize(boolean isMapDefaultValues,
                      int bitsPerNonPrimitiveValue,
                      ObjectIntTable<INonPrimitiveValue> nonPrimitiveValueIdMap,
                      int bitsPerThreadId,
                      IntIntTable threadOrderMap,
                      BitSet elidedPositions,
                      BitBuffer bb,
                      int fromIndex,
                      int toIndex)
Description copied from interface: IValueArray
Linearizes the contained values.

Specified by:
linearize in interface IValueArray
Parameters:
isMapDefaultValues - Indicates whether to bitmap default values.
bitsPerNonPrimitiveValue - The number of bits used to encode a non-primitive value.
nonPrimitiveValueIdMap - A mapping of non-primitive values to their unique id. Must be non-null.
bitsPerThreadId - The number of bits used to encode a thread descriptor.
threadOrderMap - A mapping of thread descriptors to their order number. Must be non-null.
elidedPositions - A bitset indicating which elements of the array should be omitted from the bit-vector. A null reference here indicates that all elements should be linearized.
bb - The bit-buffer for linearizing the values. Must be non-null.
fromIndex - The index of the first element to be linearized.
toIndex - The index after the last element to be linearized.

toArray

public IValue[] toArray()
Description copied from interface: IValueArray
Returns the contained values as an array.

Specified by:
toArray in interface IValueArray
Returns:
The array consisting the contained values. Non-null.

toString

public String toString()
Overrides:
toString in class Object

validate

public void validate(IBogorConfiguration bc)
Description copied from interface: IValueArray
Validates this value array wrt. a configuration.

Specified by:
validate in interface IValueArray