Package table
Class RealType
java.lang.Object
table.ColType
table.OrdinalType
table.MetricType
table.RealType
- All Implemented Interfaces:
Serializable
,Cloneable
Class for real-valued types for data tables.
- Since:
- 2006.09.11
- See Also:
-
Field Summary
FieldsFields inherited from class table.OrdinalType
maxinfo, mininfo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(double value) Add a value.Add a value.void
clear()
Clear the range of values.clone()
Clone this type.int
Compare two real values.Compute the difference of two valuesboolean
Check whether an array fits this type.getMax()
Get the maximal value.double
Get the maximal value.double
Get the maximal value.getMin()
Get the minimal value.double
Get the minimal value.double
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, that is,double.class
.getStringAt
(Object array, int index) Describe 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,Double.class
.boolean
Check whether an array element is null.static ColType
parseType
(util.Scanner scan) Parse a type description.parseValue
(String desc) Parse a double value 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 double NULLa null value (of the storage class)- See Also:
-
-
Constructor Details
-
RealType
public RealType()Create a real-valued type.- Since:
- 2006.09.16 (Christian Borgelt)
-
RealType
public RealType(double min, double max) Create a real-valued type.- Parameters:
min
- the minimum valuemax
- the maximum value- Since:
- 2006.09.16 (Christian Borgelt)
-
RealType
Create a clone of a real-valued type.- Parameters:
t
- the real-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,Double.class
.- Specified by:
getValueClass
in classColType
- Returns:
Double.class
- Since:
- 2006.10.04 (Christian Borgelt)
- See Also:
-
getStorageClass
Get the class used to store values of this type, that is,double.class
.- Specified by:
getStorageClass
in classColType
- Returns:
double.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.
-
addValue
Add a value. The range of values is adapted. -
addValue
public void addValue(double 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:
- 2006.09.11 (Christian Borgelt)
-
getMaxNumber
public double getMaxNumber()Get the maximal value.- Specified by:
getMaxNumber
in classMetricType
- Returns:
- the maximal value
- Since:
- 2006.09.11 (Christian Borgelt)
-
getMinRaw
public double getMinRaw()Get the minimal value.- Returns:
- the minimal value
- Since:
- 2007.02.02 (Christian Borgelt)
-
getMaxRaw
public double 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 double values, i.e.,double[]
index
- the index of the array element to access- Returns:
- the value as an object (of class
Double
) - Since:
- 2006.09.26 (Christian Borgelt)
-
setValueAt
Set an array element from an object.- Overrides:
setValueAt
in classColType
- Parameters:
array
- an array of real values, i.e.double[]
index
- the index of the array element to setvalue
- the value to set, must either be aString
or aNumber
- Since:
- 2006.09.26 (Christian Borgelt)
-
getStringAt
Describe an array element as a string.- Overrides:
getStringAt
in classColType
- Parameters:
array
- an array of real values, i.e.double[]
index
- the index of the array element to check- 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 a double value from a string.- Specified by:
parseValue
in classColType
- Parameters:
desc
- the string description to parse- Returns:
- the parsed double as a
Double
object ornull
if parsing failed - Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
toString
Create a string description. -
compare
Compare two real 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 column type
- Throws:
IOException
- if a read error occurs- Since:
- 2007.02.16 (Christian Borgelt)
-