Package table
Class StringType
java.lang.Object
table.ColType
table.StringType
- All Implemented Interfaces:
Serializable
,Cloneable
Class for string types for data tables.
A string type is similar to a nominal type. However, the values are not recoded to integers for storing, but stored directly, that is, they are stored as strings.
- Since:
- 2007.02.13
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a string type.Create a clone of a string type. -
Method Summary
Modifier and TypeMethodDescriptionAdd a value, that is, adapt the range of values.void
clear()
Clear the range of values.clone()
Clone this type.boolean
Check whether an array fits this type.getName()
Get the name of the type.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 a 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.Methods inherited from class table.ColType
addType, addValue, clearInfo, findValue, getAllTypeNames, getAllTypeNames, getInfo, getInfo, getInfoCount, getNumberAt, getTypeClass, getTypeClass, getTypeCount, getTypeId, getTypeId, getTypeName, getValue, getValueCount, getValueId, setInfo, setInfo, toString
-
Field Details
-
NULL
a null value (of the storage class)
-
-
Constructor Details
-
StringType
public StringType()Create a string type.- Since:
- 2007.02.13 (Christian Borgelt)
-
StringType
Create a clone of a string type.- Parameters:
t
- the string type to clone- Since:
- 2007.02.13 (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:
- 2007.02.13 (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:
- 2007.02.13 (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, that is, adapt the range of values. -
clear
public void clear()Clear the range of values. -
getValueAt
Get an array element as an object.- Overrides:
getValueAt
in classColType
- Parameters:
array
- an array of string values, i.e.String[]
index
- the index of the array element to access- Returns:
- the value as an object
- Since:
- 2007.02.13 (Christian Borgelt)
-
setValueAt
Set an array element from an object.- Overrides:
setValueAt
in classColType
- Parameters:
array
- an array of string values, i.e.String[]
index
- the index of the array element to setvalue
- the value to set- Since:
- 2007.02.13 (Christian Borgelt)
-
getStringAt
Get an array element as a string.- Overrides:
getStringAt
in classColType
- Parameters:
array
- an array of string values, i.e.String[]
index
- the index of the array element to access- Returns:
- the created string description
- Since:
- 2007.02.13 (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 a value 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.13 (Christian Borgelt)
- See Also:
-
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)
-