net.sf.farrago.type.runtime
Class FarragoSyntheticObject

java.lang.Object
  extended by org.eigenbase.runtime.SyntheticObject
      extended by net.sf.farrago.type.runtime.FarragoSyntheticObject
All Implemented Interfaces:
Struct

public abstract class FarragoSyntheticObject
extends SyntheticObject
implements Struct

FarragoSyntheticObject refines SyntheticObject with Farrago-specific runtime information such as null values.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/type/runtime/FarragoSyntheticObject.java#9 $
Author:
John V. Sichi

Nested Class Summary
private  class FarragoSyntheticObject.BooleanBitReference
          Implementation of BitReference for accessing a NOT NULL boolean field.
private static class FarragoSyntheticObject.NullIndicatorBitReference
          Implementation of BitReference for accessing a null indicator.
 
Field Summary
private  BitReference[] bitReferences
          Array of BitReferences to be used by marshal/unmarshal.
 
Constructor Summary
protected FarragoSyntheticObject()
          Creates a new FarragoSyntheticObject object.
 
Method Summary
 Object[] getAttributes()
           
 Object[] getAttributes(Map<String,Class<?>> map)
           
 String getSQLTypeName()
           
private  void indexBitFields()
          Constructs an array of BitReferences for use in marshalling and unmarshalling bit fields.
private  void initFields()
          Uses reflection to construct instances of all non-primitive fields.
 void marshalBitFields(ByteBuffer byteBuffer, int bitFieldByteOffset)
          Marshals all bit fields in this tuple.
static boolean testIsDifferentFrom(FarragoSyntheticObject row1, FarragoSyntheticObject row2)
          Called at runtime to implement the SqlStdOperatorTable.isDifferentFromOperator operator in a row-size fashion.
 String toString()
           
 void unmarshalBitFields(ByteBuffer byteBuffer, int bitFieldByteOffset)
          Unmarshals all bit fields in this tuple.
 
Methods inherited from class org.eigenbase.runtime.SyntheticObject
getFields, getFieldValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bitReferences

private BitReference[] bitReferences
Array of BitReferences to be used by marshal/unmarshal.

TODO: assert somewhere that position in this array corresponds to FemTupleAccessor info.

Constructor Detail

FarragoSyntheticObject

protected FarragoSyntheticObject()
Creates a new FarragoSyntheticObject object.

Method Detail

marshalBitFields

public void marshalBitFields(ByteBuffer byteBuffer,
                             int bitFieldByteOffset)
Marshals all bit fields in this tuple.

Parameters:
byteBuffer - destination ByteBuffer
bitFieldByteOffset - absolute offset of first byte of bit fields in ByteBuffer

unmarshalBitFields

public void unmarshalBitFields(ByteBuffer byteBuffer,
                               int bitFieldByteOffset)
Unmarshals all bit fields in this tuple.

Parameters:
byteBuffer - source ByteBuffer
bitFieldByteOffset - absolute offset of first byte of bit fields in ByteBuffer

indexBitFields

private void indexBitFields()
Constructs an array of BitReferences for use in marshalling and unmarshalling bit fields. Note that this can't be done at construction time, because subclass constructors may change field references. Instead, we do it lazily.


initFields

private void initFields()
Uses reflection to construct instances of all non-primitive fields.


getAttributes

public Object[] getAttributes()
Specified by:
getAttributes in interface Struct

getAttributes

public Object[] getAttributes(Map<String,Class<?>> map)
Specified by:
getAttributes in interface Struct

getSQLTypeName

public String getSQLTypeName()
                      throws SQLException
Specified by:
getSQLTypeName in interface Struct
Throws:
SQLException

toString

public String toString()
Overrides:
toString in class Object

testIsDifferentFrom

public static boolean testIsDifferentFrom(FarragoSyntheticObject row1,
                                          FarragoSyntheticObject row2)
Called at runtime to implement the SqlStdOperatorTable.isDifferentFromOperator operator in a row-size fashion.

Parameters:
row1 - first row to compare
row2 - second row to compare (must be of exact same type as row1)
Returns:
whether row1 differs from row2 according to the definition of $IS_DIFFERENT_FROM