net.sf.farrago.type.runtime
Class EncodedSqlInterval

java.lang.Object
  extended by net.sf.farrago.type.runtime.EncodedSqlInterval
All Implemented Interfaces:
AssignableValue, DataValue
Direct Known Subclasses:
EncodedSqlInterval.EncodedSqlIntervalDT, EncodedSqlInterval.EncodedSqlIntervalYM

public abstract class EncodedSqlInterval
extends Object
implements AssignableValue

Runtime type for interval values.

TODO:

Since:
Aug 20, 2006
Version:
$Id: //open/dev/farrago/src/net/sf/farrago/type/runtime/EncodedSqlInterval.java#11 $
Author:
angel

Nested Class Summary
static class EncodedSqlInterval.EncodedSqlIntervalDT
           
static class EncodedSqlInterval.EncodedSqlIntervalYM
           
 
Field Summary
static String GET_END_UNIT_METHOD_NAME
           
static String GET_START_UNIT_METHOD_NAME
           
private  boolean isNull
           
protected static NumberFormat NF2
           
protected static NumberFormat NF3
           
 long value
           
 
Fields inherited from interface net.sf.farrago.type.runtime.AssignableValue
ASSIGNMENT_METHOD_NAME
 
Constructor Summary
EncodedSqlInterval()
          Creates a runtime object
 
Method Summary
private static void appendHours(StringBuffer buf, long hours)
           
private static void appendMinutes(StringBuffer buf, long minutes)
           
private static void appendSeconds(StringBuffer buf, long seconds, long fractions)
           
 void assignFrom(long v)
           
 void assignFrom(Object obj)
          Assigns value from an Object.
 void ceil(int timeUnitOrdinal)
          Rounds this interval value up to a unit of time expressed using its ordinal.
protected  void ceil(SqlIntervalQualifier.TimeUnit timeUnit)
           
 void floor(int timeUnitOrdinal)
          Rounds this interval value down to a unit of time expressed using its ordinal.
protected  void floor(SqlIntervalQualifier.TimeUnit timeUnit)
           
protected abstract  SqlIntervalQualifier.TimeUnit getEndUnit()
           
 Object getNullableData()
           
static Class getPrimitiveClass()
           
protected abstract  SqlIntervalQualifier.TimeUnit getStartUnit()
           
 boolean isNull()
           
protected abstract  void parse(String date)
           
 void setNull(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_START_UNIT_METHOD_NAME

public static final String GET_START_UNIT_METHOD_NAME
See Also:
Constant Field Values

GET_END_UNIT_METHOD_NAME

public static final String GET_END_UNIT_METHOD_NAME
See Also:
Constant Field Values

NF2

protected static final NumberFormat NF2

NF3

protected static final NumberFormat NF3

isNull

private boolean isNull

value

public long value
Constructor Detail

EncodedSqlInterval

public EncodedSqlInterval()
Creates a runtime object

Method Detail

parse

protected abstract void parse(String date)

getPrimitiveClass

public static Class getPrimitiveClass()
Returns:
long.class

isNull

public boolean isNull()

setNull

public void setNull(boolean b)

assignFrom

public void assignFrom(Object obj)
Description copied from interface: AssignableValue
Assigns value from an Object.

Specified by:
assignFrom in interface AssignableValue
Parameters:
obj - value to assign, or null to set null

assignFrom

public void assignFrom(long v)

getNullableData

public Object getNullableData()
Specified by:
getNullableData in interface DataValue
Returns:
an Object representation of this value's data, or null if this value is null

getStartUnit

protected abstract SqlIntervalQualifier.TimeUnit getStartUnit()

getEndUnit

protected abstract SqlIntervalQualifier.TimeUnit getEndUnit()

floor

public void floor(int timeUnitOrdinal)
Rounds this interval value down to a unit of time expressed using its ordinal. Called by generated code.

Parameters:
timeUnitOrdinal - Ordinal of SqlIntervalQualifier.TimeUnit value

floor

protected void floor(SqlIntervalQualifier.TimeUnit timeUnit)

ceil

public void ceil(int timeUnitOrdinal)
Rounds this interval value up to a unit of time expressed using its ordinal. Called by generated code.

Parameters:
timeUnitOrdinal - Ordinal of SqlIntervalQualifier.TimeUnit value

ceil

protected void ceil(SqlIntervalQualifier.TimeUnit timeUnit)

appendHours

private static void appendHours(StringBuffer buf,
                                long hours)

appendMinutes

private static void appendMinutes(StringBuffer buf,
                                  long minutes)

appendSeconds

private static void appendSeconds(StringBuffer buf,
                                  long seconds,
                                  long fractions)