Package table
Class IntegerType
java.lang.Object
table.ColType
table.OrdinalType
table.MetricType
table.IntegerType
- All Implemented Interfaces:
Serializable
,Cloneable
Class for integer types for data tables.
- Since:
- 2006.09.11
- See Also:
-
Field Summary
FieldsFields inherited from class table.OrdinalType
maxinfo, mininfo
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an integer type.IntegerType
(int min, int max) Create an integer type.Create a clone of an integer type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(int value) Add a value.Add a value.void
clear()
Clear the range of values.clone()
Clone this type.int
Compare two integer values.Compute the difference of two valuesboolean
Check whether an array fits this type.getMax()
Get the maximal value.double
Get the maximal value.int
Get the maximal value.getMin()
Get the minimal value.double
Get the minimal value.int
Get the minimal value.getName()
Get the name of the type.double
getNumberAt
(Object array, int index) Get an array element as a number.Class<?>
Get the class used to store values of this type.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.boolean
Check whether an array element is null.static ColType
parseType
(util.Scanner scan) Parse a type description.parseValue
(String desc) Parse an integer 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.Sum two values.toString()
Create a string description.Methods inherited from class table.MetricType
clearInfo, getInfo, getInfo, getInfoCount, setInfo, setInfo
Methods inherited from class table.OrdinalType
getMaxInfo, getMinInfo, getValue, setMaxInfo, setMinInfo
Methods inherited from class table.ColType
addType, addValue, findValue, getAllTypeNames, getAllTypeNames, getTypeClass, getTypeClass, getTypeCount, getTypeId, getTypeId, getTypeName, getValueCount, getValueId
-
Field Details
-
NULL
public static final int NULLa null value (of the storage class)- See Also:
-
-
Constructor Details
-
IntegerType
public IntegerType()Create an integer type. The range of values is set empty (max < min
).- Since:
- 2006.09.16 (Christian Borgelt)
-
IntegerType
public IntegerType(int min, int max) Create an integer type.- Parameters:
min
- the minimum attribute valuemax
- the maximum attribute value- Since:
- 2006.09.16 (Christian Borgelt)
-
IntegerType
Create a clone of an integer type.- Parameters:
t
- the integer 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.- Specified by:
getValueClass
in classColType
- Returns:
- the class used for accessing values of this type
- Since:
- 2006.10.04 (Christian Borgelt)
- See Also:
-
getStorageClass
Get the class used to store values of this type.- Specified by:
getStorageClass
in classColType
- Returns:
- the class used for storing values of this type
- 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.
-
addValue
Add a value. The range of values is adapted. -
addValue
public void addValue(int 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)
-
getMinNumber
public double getMinNumber()Get the minimal value.- Specified by:
getMinNumber
in classMetricType
- Returns:
- the minimal value
- Since:
- 2007.02.09 (Christian Borgelt)
-
getMaxNumber
public double getMaxNumber()Get the maximal value.- Specified by:
getMaxNumber
in classMetricType
- Returns:
- the maximal value
- Since:
- 2006.02.09 (Christian Borgelt)
-
getMinRaw
public int getMinRaw()Get the minimal value.- Returns:
- the minimal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getMaxRaw
public int 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 integer values, i.e.int[]
index
- the index of the array element to access- Returns:
- the value as an object (of class
Integer
) - Since:
- 2006.09.26 (Christian Borgelt)
-
setValueAt
Set an array element from an object.- Overrides:
setValueAt
in classColType
- Parameters:
array
- an array of integer values, i.e.int[]
index
- the index of the array element to setvalue
- the value to set, must be an instance ofNumber
,String
, orIntegerType
- Since:
- 2006.09.26 (Christian Borgelt)
-
getStringAt
Get an array element as a string.- Overrides:
getStringAt
in classColType
- Parameters:
array
- an array of integer values; i.e.int[]
index
- the index of the array element to get- Returns:
- the created string description
- Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
getNumberAt
Get an array element as a number.- Overrides:
getNumberAt
in classColType
- Parameters:
array
- the array to retrieve an element fromindex
- the array index from which to retrieve- Returns:
- the array element as a number
- Since:
- 2007.02.09 (Christian Borgelt)
-
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 integer from a string.- Specified by:
parseValue
in classColType
- Parameters:
desc
- the string description to parse- Returns:
- the parsed integer as an
Integer
object ornull
if parsing failed - Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
toString
Create a string description. -
compare
Compare two integer 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)
-
sum
Sum two values.- Specified by:
sum
in classMetricType
- Parameters:
a
- the first valueb
- the second value- Returns:
- the sum of the two values
- Since:
- 2007.02.02 (Christian Borgelt)
-
diff
Compute the difference of two values- Specified by:
diff
in classMetricType
- Parameters:
a
- the value from which to subtractb
- the value to subtract- Returns:
- the difference of the two values
- Since:
- 2007.02.02 (Christian Borgelt)
-
parseType
Parse a type description.- Parameters:
scan
- the scanner to read from- Returns:
- the described type
- Throws:
IOException
- if a read error occurs- Since:
- 2007.02.16 (Christian Borgelt)
-