Package table
Class DateType
java.lang.Object
table.ColType
table.OrdinalType
table.DateType
- All Implemented Interfaces:
Serializable
,Cloneable
Class for date-valued types for data tables.
- Since:
- 2006.10.04
- See Also:
-
Field Summary
FieldsFields inherited from class table.OrdinalType
maxinfo, mininfo
-
Constructor Summary
ConstructorsConstructorDescriptionDateType()
Create a date-valued type.DateType
(DateFormat fmt) Create a date-valued type.DateType
(DateFormat fmt, long min, long max) Create a date-valued type.Create a clone of a date-valued type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(long value) Add a value.Add a value.void
clear()
Clear the range of values.clone()
Clone this type.int
Compare two date values.boolean
Check whether an array fits this type.Get the format used for parsing and formatting.getMax()
Get the maximal value.long
Get the maximal value.getMin()
Get the minimal value.long
Get the minimal value.getName()
Get the name of the type.Class<?>
Get the class used to store values of this type, that is,long.class
.getStringAt
(Object array, int index) Get an array element as a string.getValueAt
(Object array, int index) Get an array element as an object.Class<?>
Get the class used to access values of this type, that is,Date.class
.boolean
Check whether an array element is null.static ColType
parseType
(util.Scanner scan) Parse a type description.parseValue
(String desc) Parse an instance from a string.void
Set an array element to a null value.void
Set a range of array elements to a null value.void
setValueAt
(Object array, int index, Object value) Set an array element from an object.toString()
Create a string description.Methods inherited from class table.OrdinalType
getInfo, getInfo, getInfoCount, getMaxInfo, getMinInfo, getValue, setInfo, setInfo, setMaxInfo, setMinInfo
Methods inherited from class table.ColType
addType, addValue, clearInfo, findValue, getAllTypeNames, getAllTypeNames, getNumberAt, getTypeClass, getTypeClass, getTypeCount, getTypeId, getTypeId, getTypeName, getValueCount, getValueId
-
Field Details
-
NULL
public static final long NULLa null value (of the storage class)- See Also:
-
-
Constructor Details
-
DateType
public DateType()Create a date-valued type. The range of values is set empty (max < min
).- Since:
- 2006.10.04 (Christian Borgelt)
-
DateType
Create a date-valued type. The range of values is set empty (max < min
).- Parameters:
fmt
- the date format- Since:
- 2006.10.04 (Christian Borgelt)
-
DateType
Create a date-valued type.- Parameters:
fmt
- the date formatmin
- the minimum valuemax
- the maximum value- Since:
- 2006.10.04 (Christian Borgelt)
-
DateType
Create a clone of a date-valued type.- Parameters:
t
- the date-valued type to clone- Since:
- 2006.11.15 (Christian Borgelt)
-
-
Method Details
-
clone
Clone this type. -
getName
Get the name of the type. -
getValueClass
Get the class used to access values of this type, that is,Date.class
.- Specified by:
getValueClass
in classColType
- Returns:
Date.class
- Since:
- 2006.10.04 (Christian Borgelt)
- See Also:
-
getStorageClass
Get the class used to store values of this type, that is,long.class
.- Specified by:
getStorageClass
in classColType
- Returns:
long.class
- Since:
- 2006.10.04 (Christian Borgelt)
- See Also:
-
fits
Check whether an array fits this type.This function need not really be here, since the generic version in ColType.java yields the same result. However, this version is more efficient.
-
getFormat
Get the format used for parsing and formatting.- Returns:
- the format used for parsing and printing
- Since:
- 2007.01.31 (Christian Borgelt)
-
addValue
Add a value. The range of values is adapted. -
addValue
public void addValue(long value) Add a value. The range of values is adapted.- Parameters:
value
- the value to add- Since:
- 2006.09.16 (Christian Borgelt)
-
clear
public void clear()Clear the range of values. -
getMin
Get the minimal value.- Specified by:
getMin
in classOrdinalType
- Returns:
- the minimal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getMax
Get the maximal value.- Specified by:
getMax
in classOrdinalType
- Returns:
- the maximal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getMinRaw
public long getMinRaw()Get the minimal value.- Returns:
- the minimal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getMaxRaw
public long getMaxRaw()Get the maximal value.- Returns:
- the maximal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getValueAt
Get an array element as an object.- Overrides:
getValueAt
in classColType
- Parameters:
array
- an array of dates, i.e.long[]
index
- the index of the array element to get- Returns:
- the value as an object
- Since:
- 2006.09.26 (Christian Borgelt)
-
setValueAt
Set an array element from an object.- Overrides:
setValueAt
in classColType
- Parameters:
array
- an array of dates, i.e.long[]
index
- the index of the array element to setvalue
- the value to set, must be an object of classString
,Long
, orDate
- Since:
- 2006.09.26 (Christian Borgelt)
-
getStringAt
Get an array element as a string.- Overrides:
getStringAt
in classColType
- Parameters:
array
- an array of dates, i.e.long[]
index
- the index of the array element to get- Returns:
- the created string description
- Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
isNull
Check whether an array element is null. -
setNull
Set an array element to a null value. -
setNull
Set a range of array elements to a null value. -
parseValue
Parse an instance from a string.- Specified by:
parseValue
in classColType
- Parameters:
desc
- the string description to parse- Returns:
- the parsed object or
null
if parsing failed - Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
toString
Create a string description. -
compare
Compare two date values.- Specified by:
compare
in classOrdinalType
- Parameters:
a
- the first valueb
- the second value- Returns:
- -1 if the first value is smaller,
+1 if the second value is smaller,
0 if the value are equal - Since:
- 2007.02.02 (Christian Borgelt)
-
parseType
Parse a type description.- Parameters:
scan
- the scanner to read from- Returns:
- the column type read from the description
- Throws:
IOException
- if a read error occurs- Since:
- 2007.02.16 (Christian Borgelt)
-