net.sf.farrago.fennel.tuple
Interface FennelStoredTypeDescriptor

All Known Implementing Classes:
FennelStandardTypeDescriptor, FennelStandardTypeDescriptor.FennelNumericType, FennelStandardTypeDescriptor.FennelType, FennelStandardTypeDescriptor.Type_BINARY, FennelStandardTypeDescriptor.Type_BOOL, FennelStandardTypeDescriptor.Type_CHAR, FennelStandardTypeDescriptor.Type_DOUBLE, FennelStandardTypeDescriptor.Type_INT_16, FennelStandardTypeDescriptor.Type_INT_32, FennelStandardTypeDescriptor.Type_INT_64, FennelStandardTypeDescriptor.Type_INT_8, FennelStandardTypeDescriptor.Type_REAL, FennelStandardTypeDescriptor.Type_UINT_16, FennelStandardTypeDescriptor.Type_UINT_32, FennelStandardTypeDescriptor.Type_UINT_64, FennelStandardTypeDescriptor.Type_UINT_8, FennelStandardTypeDescriptor.Type_UNICODE_CHAR, FennelStandardTypeDescriptor.Type_UNICODE_VARCHAR, FennelStandardTypeDescriptor.Type_VARBINARY, FennelStandardTypeDescriptor.Type_VARCHAR

public interface FennelStoredTypeDescriptor

FennelStoredTypeDescriptor provides an abstraction to describe a type of data element supported by the tuple library.

StoredTypeDescriptors are created by FennelStoredTypeDescriptorFactory objects.

Each FennelStoredTypeDescriptor has a unique ordinal number assigned to it, which should match across all implementations of tuple libraries that would interact. How to maintain these ordinals in synch is left as an exercise for the reader.

NOTE: this interface varies from the C++ implementation by requiring the stored type to know how to create a FennelAttributeAccessor for itself. This seems cleaner than trying to infer it within the standard FennelTupleAccessor. This class is JDK 1.4 compatible.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/fennel/tuple/FennelStoredTypeDescriptor.java#11 $
Author:
Mike Bennett

Method Summary
 int getAlignmentByteCount(int width)
          Gets the alignment size in bytes required for values of this type, given a particular max byte count.
 int getBitCount()
          Returns number of bits in marshalled representation, or 0 for a non-bit type; currently only 0 or 1 is supported.
 int getFixedByteCount()
          Returns the width in bytes for a fixed-width non-bit type which admits no per-attribute precision, or 0 for types with per-attribute precision; for bit types, this yields the size of the unmarshalled representation.
 int getMinByteCount(int maxWidth)
          Gets the number of bytes required to store the narrowest value with this type, given a particular max byte count.
 int getOrdinal()
          Returns the ordinal representing this type.
 boolean isExact()
          Indicates whether numeric data type is exact.
 boolean isSigned()
          Indicates whether numeric data type is signed.
 FennelAttributeAccessor newAttributeAccessor()
          Creates an FennelAttributeAccessor appropriate for marshalling an element of this type.
 

Method Detail

getOrdinal

int getOrdinal()
Returns the ordinal representing this type.


getBitCount

int getBitCount()
Returns number of bits in marshalled representation, or 0 for a non-bit type; currently only 0 or 1 is supported.


getFixedByteCount

int getFixedByteCount()
Returns the width in bytes for a fixed-width non-bit type which admits no per-attribute precision, or 0 for types with per-attribute precision; for bit types, this yields the size of the unmarshalled representation.


getMinByteCount

int getMinByteCount(int maxWidth)
Gets the number of bytes required to store the narrowest value with this type, given a particular max byte count. For a fixed-width type, the return value is the same as the input.

Parameters:
maxWidth - maximum width for which to compute the minimum
Returns:
number of bytes

getAlignmentByteCount

int getAlignmentByteCount(int width)
Gets the alignment size in bytes required for values of this type, given a particular max byte count. This must be 1, 2, 4, or 8, and may not be greater than 1 for variable-width datatypes. For fixed-width datatypes, the width must be a multiple of the alignment size.

Parameters:
width - width for which to compute the alignment
Returns:
number of bytes

newAttributeAccessor

FennelAttributeAccessor newAttributeAccessor()
Creates an FennelAttributeAccessor appropriate for marshalling an element of this type.

Returns:
FennelAttributeAccessor

isSigned

boolean isSigned()
Indicates whether numeric data type is signed.

Returns:
false for non-numeric data types, false for unsigned numeric data types, true for signed numeric data types

isExact

boolean isExact()
Indicates whether numeric data type is exact.

Returns:
false for non-numeric data types, false for approximate numeric data types (REAL, FLOAT) true for exact numeric data types