net.sf.farrago.fennel.tuple
Class FennelStandardTypeDescriptor.FennelNumericType

java.lang.Object
  extended by org.eigenbase.util14.Enum14.BasicValue
      extended by net.sf.farrago.fennel.tuple.FennelStandardTypeDescriptor
          extended by net.sf.farrago.fennel.tuple.FennelStandardTypeDescriptor.FennelType
              extended by net.sf.farrago.fennel.tuple.FennelStandardTypeDescriptor.FennelNumericType
All Implemented Interfaces:
Serializable, Comparable, FennelStoredTypeDescriptor, Enum14.Value
Direct Known Subclasses:
FennelStandardTypeDescriptor.Type_BOOL, 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
Enclosing class:
FennelStandardTypeDescriptor

private abstract static class FennelStandardTypeDescriptor.FennelNumericType
extends FennelStandardTypeDescriptor.FennelType

Abstract base class for all numeric types.


Field Summary
private  int bitCount
           
private  boolean exact
           
private  int fixedByteCount
           
private static long serialVersionUID
          SerialVersionUID created with JDK 1.5 serialver tool.
private  boolean signed
           
 
Fields inherited from class net.sf.farrago.fennel.tuple.FennelStandardTypeDescriptor
BINARY, BINARY_ORDINAL, BOOL, BOOL_ORDINAL, CHAR, CHAR_ORDINAL, DOUBLE, DOUBLE_ORDINAL, enumeration, EXTENSION_MIN_ORDINAL, INT_16, INT_16_ORDINAL, INT_32, INT_32_ORDINAL, INT_64, INT_64_ORDINAL, INT_8, INT_8_ORDINAL, MIN_ORDINAL, REAL, REAL_ORDINAL, UINT_16, UINT_16_ORDINAL, UINT_32, UINT_32_ORDINAL, UINT_64, UINT_64_ORDINAL, UINT_8, UINT_8_ORDINAL, UNICODE_CHAR, UNICODE_CHAR_ORDINAL, UNICODE_VARCHAR, UNICODE_VARCHAR_ORDINAL, VARBINARY, VARBINARY_ORDINAL, VARCHAR, VARCHAR_ORDINAL
 
Constructor Summary
protected FennelStandardTypeDescriptor.FennelNumericType()
          Required by the serialization mechanism; should never be used.
protected FennelStandardTypeDescriptor.FennelNumericType(String name, int ordinal, int bitCount, int fixedByteCount, boolean signed, boolean exact)
          Creates a FennelNumericType.
 
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.
 boolean isExact()
          Returns whether this ordinal is an exact numeric.
 boolean isNumeric()
          Returns whether this type is numeric.
 boolean isSigned()
          Indicates whether numeric data type is signed.
 
Methods inherited from class net.sf.farrago.fennel.tuple.FennelStandardTypeDescriptor
forOrdinal, get, isApprox, isArray, isBinaryArray, isFixedLenArray, isIntegralNative, isNative, isNativeNotBool, isTextArray, isVariableLenArray
 
Methods inherited from class org.eigenbase.util14.Enum14.BasicValue
compareTo, equals, equals, getDescription, getName, getOrdinal, hashCode, toString, unexpected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.farrago.fennel.tuple.FennelStoredTypeDescriptor
getOrdinal, newAttributeAccessor
 

Field Detail

serialVersionUID

private static final long serialVersionUID
SerialVersionUID created with JDK 1.5 serialver tool.

See Also:
Constant Field Values

bitCount

private final int bitCount

fixedByteCount

private final int fixedByteCount

signed

private final boolean signed

exact

private final boolean exact
Constructor Detail

FennelStandardTypeDescriptor.FennelNumericType

protected FennelStandardTypeDescriptor.FennelNumericType(String name,
                                                         int ordinal,
                                                         int bitCount,
                                                         int fixedByteCount,
                                                         boolean signed,
                                                         boolean exact)
Creates a FennelNumericType.


FennelStandardTypeDescriptor.FennelNumericType

protected FennelStandardTypeDescriptor.FennelNumericType()
Required by the serialization mechanism; should never be used.

Method Detail

getBitCount

public int getBitCount()
Description copied from interface: FennelStoredTypeDescriptor
Returns number of bits in marshalled representation, or 0 for a non-bit type; currently only 0 or 1 is supported.

Specified by:
getBitCount in interface FennelStoredTypeDescriptor
Overrides:
getBitCount in class FennelStandardTypeDescriptor.FennelType

getFixedByteCount

public int getFixedByteCount()
Description copied from interface: FennelStoredTypeDescriptor
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.

Specified by:
getFixedByteCount in interface FennelStoredTypeDescriptor
Overrides:
getFixedByteCount in class FennelStandardTypeDescriptor.FennelType

getMinByteCount

public int getMinByteCount(int maxWidth)
Description copied from interface: FennelStoredTypeDescriptor
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.

Specified by:
getMinByteCount in interface FennelStoredTypeDescriptor
Overrides:
getMinByteCount in class FennelStandardTypeDescriptor.FennelType
Parameters:
maxWidth - maximum width for which to compute the minimum
Returns:
number of bytes

getAlignmentByteCount

public int getAlignmentByteCount(int width)
Description copied from interface: FennelStoredTypeDescriptor
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.

Specified by:
getAlignmentByteCount in interface FennelStoredTypeDescriptor
Overrides:
getAlignmentByteCount in class FennelStandardTypeDescriptor.FennelType
Parameters:
width - width for which to compute the alignment
Returns:
number of bytes

isSigned

public boolean isSigned()
Description copied from interface: FennelStoredTypeDescriptor
Indicates whether numeric data type is signed.

Specified by:
isSigned in interface FennelStoredTypeDescriptor
Overrides:
isSigned in class FennelStandardTypeDescriptor.FennelType
Returns:
false for non-numeric data types, false for unsigned numeric data types, true for signed numeric data types

isExact

public boolean isExact()
Description copied from class: FennelStandardTypeDescriptor
Returns whether this ordinal is an exact numeric.

Specified by:
isExact in interface FennelStoredTypeDescriptor
Overrides:
isExact in class FennelStandardTypeDescriptor.FennelType
Returns:
false for non-numeric data types, false for approximate numeric data types (REAL, FLOAT) true for exact numeric data types

isNumeric

public boolean isNumeric()
Description copied from class: FennelStandardTypeDescriptor
Returns whether this type is numeric.

Overrides:
isNumeric in class FennelStandardTypeDescriptor.FennelType