Class Column
- All Implemented Interfaces:
Serializable
,Cloneable
- Since:
- 2007.01.31
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Object
the data of the column (array of row values)protected int
the direction of the columnstatic final int
direction: (unique) identifierstatic final int
direction: input columnstatic final int
direction: do not use columnstatic final int
direction: output columnstatic final int
direction: weight column (tuple occurrences)protected int
the marker of the columnprotected String
the name of the columnprotected ColType
the type of the columnprotected double
the weight of the column -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a value, that is, adapt the range of values.void
autoType()
Automatically determine the type of a nominal or string column.void
Clear all additional information.clone()
Clone this column.Clone a column as a type/domain description.void
Clone the value array of the column.void
Clone the type of the column.void
cloneType
(boolean update) Clone the type of the column.static String[]
Get all direction names.static String[]
getAllDirNames
(int cnt) Get the name for a direction identifier.getData()
Get the value array of the column.int
getDir()
Get the direction of the column.static int
Get the identifier for a direction name.static String
getDirName
(int id) Get the name for a direction identifier.getInfo
(int id) Get the information associated with a value.Get the information associated with a value.int
Get the number of values for which there is information.int
getMark()
Get the marker value of the column.getName()
Get the name of the column.double
getNumberAt
(int row) Get the value of a column row as a number.int
Get the number of rows of the column.getStringAt
(int row) Get the value of a column row as a string.getType()
Get the type of the column.getValue
(int id) Get the value associated with an identifier.getValueAt
(int row) Get the value of a column row as an object.int
Get the number of values.double
Get the weight of the column.boolean
hasNulls()
Check whether a column contains null values.boolean
isNull
(int row) Check whether a column row is null.static Column
parse
(util.Scanner scan) Parse a column description.void
resize
(int newcnt) Resize the value array of the column.void
resize
(int newcnt, boolean init) Resize the value array of the column.void
Set the value array of the column.void
setDir
(int dir) Set the direction of the column.void
Set the information associated with a value or property.void
Set the information associated with a value.void
setMark
(int mark) Set the marker value of the column.void
setNull
(int row) Set a column row to a null value.void
setNull
(int beg, int end) Set a range of column rows to a null value.void
Set the type of the column, that is, convert its type.void
setValueAt
(Object value, int row) Set the value of a column row from an object.void
setWeight
(double weight) Set the weight of the column.void
sortType()
Sort the values of the column type by their string description.void
sortType
(Comparator<Object> cmp) Sort the values of the column type.toString()
Create a string description of the column type.
-
Field Details
-
DIR_NONE
public static final int DIR_NONEdirection: do not use column- See Also:
-
DIR_IN
public static final int DIR_INdirection: input column- See Also:
-
DIR_OUT
public static final int DIR_OUTdirection: output column- See Also:
-
DIR_ID
public static final int DIR_IDdirection: (unique) identifier- See Also:
-
DIR_WGT
public static final int DIR_WGTdirection: weight column (tuple occurrences)- See Also:
-
name
the name of the column -
type
the type of the column -
data
the data of the column (array of row values) -
dir
protected int dirthe direction of the column -
mark
protected int markthe marker of the column -
weight
protected double weightthe weight of the column
-
-
Constructor Details
-
Column
Create a column of a data table.The direction of the column is set to
DIR_IN
and its marker is initialized to 0.- Parameters:
name
- the name of the columntype
- the type of the columndata
- the data of the column (array of row values)- Since:
- 2007.01.31 (Christian Borgelt)
-
Column
Create a column of a data table.- Parameters:
name
- the name of the columntype
- the type of the column- Since:
- 2007.02.16 (Christian Borgelt)
-
Column
Create a column of a data table.- Parameters:
name
- the name of the columntype
- the type of the columnrowcnt
- the number of rows of the column- Since:
- 2007.01.31 (Christian Borgelt)
-
-
Method Details
-
getDirId
Get the identifier for a direction name.- Parameters:
name
- the name of the direction- Returns:
- the identifier of the direction
- Since:
- 2007.06.07 (Christian Borgelt)
-
getDirName
Get the name for a direction identifier.- Parameters:
id
- the identifier of the direction- Returns:
- the name of the direction
- Since:
- 2007.06.07 (Christian Borgelt)
-
getAllDirNames
Get all direction names.- Returns:
- an array of direction names
- Since:
- 2007.06.07 (Christian Borgelt)
-
getAllDirNames
Get the name for a direction identifier.- Parameters:
cnt
- the maximum number of names- Returns:
- an array of direction names
- Since:
- 2007.06.07 (Christian Borgelt)
-
clone
Clone this column.The clone is a shallow copy: it keeps the type and the value array of the original column. If a deep copy is desired, the functions
cloneType()
andcloneData()
must be called afterwards. -
cloneAsType
Clone a column as a type/domain description.The column as well as its type are cloned, while the data is omitted (the new column has a size of 0).
- Returns:
- a clone of the column as a type/domain description
- Since:
- 2007.04.13 (Christian Borgelt)
-
cloneType
public void cloneType()Clone the type of the column.- Since:
- 2007.01.31 (Christian Borgelt)
-
cloneType
public void cloneType(boolean update) Clone the type of the column.Note that if
update == true
this function may also clone the value array if an update of the range of values requires recoding the values (e.g. for a nominal type).- Parameters:
update
- whether to update the range of values- Since:
- 2007.02.02 (Christian Borgelt)
- See Also:
-
cloneData
public void cloneData()Clone the value array of the column.Note, however, that this does not clone the row values itself if they are object instances (rather than basic types). Only the array containing them is cloned.
- Since:
- 2007.01.31 (Christian Borgelt)
- See Also:
-
getName
Get the name of the column.Note that there is no corresponding
setName()
function, because when a column is part of a table, it may not be renamed directly, since the column access structure of the table needs to be updated.- Returns:
- the name of the column
- Since:
- 2007.01.31 (Christian Borgelt)
-
getType
Get the type of the column.- Returns:
- the type of the column
- Since:
- 2007.01.31 (Christian Borgelt)
-
setType
Set the type of the column, that is, convert its type.Note that the type to convert to may coincide with the current type of the column. In this case the value array is cloned, maybe recoded, and the new range of values is determined.
- Parameters:
type
- the new type of the column- Since:
- 2007.01.31 (Christian Borgelt)
-
autoType
public void autoType()Automatically determine the type of a nominal or string column.- Since:
- 2007.02.07 (Christian Borgelt)
-
sortType
public void sortType()Sort the values of the column type by their string description.- Since:
- 2007.07.26 (Christian Borgelt)
-
sortType
Sort the values of the column type.- Parameters:
cmp
- the comparator for the values- Since:
- 2007.07.26 (Christian Borgelt)
-
getValueCount
public int getValueCount()Get the number of values.- Returns:
- the number of values
- Since:
- 2007.07.13 (Christian Borgelt)
- See Also:
-
addValue
Add a value, that is, adapt the range of values.- Parameters:
value
- the value to add- Returns:
- the argument, possibly in a different form
- Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
getValue
Get the value associated with an identifier.- Parameters:
id
- the value identifier- Returns:
- the value with the given identifier
- Since:
- 2007.07.13 (Christian Borgelt)
- See Also:
-
clearInfo
public void clearInfo()Clear all additional information.- Since:
- 2013.12.26 (Christian Borgelt)
-
getInfoCount
public int getInfoCount()Get the number of values for which there is information.- Returns:
- the number of values for which there is information
- Since:
- 2007.06.11 (Christian Borgelt)
- See Also:
-
getInfo
Get the information associated with a value.- Parameters:
value
- the value for which to get the information- Returns:
- the additional information stored with the value
- Since:
- 2007.02.18 (Christian Borgelt)
- See Also:
-
setInfo
Set the information associated with a value.- Parameters:
value
- the value for which to set the informationinfo
- the information to set- Since:
- 2007.02.18 (Christian Borgelt)
- See Also:
-
getInfo
Get the information associated with a value.- Parameters:
id
- the identifier of the value or property- Returns:
- the information associated with the value
- Since:
- 2007.02.20 (Christian Borgelt)
- See Also:
-
setInfo
Set the information associated with a value or property.- Parameters:
id
- the identifier of the value or propertyinfo
- the information to set- Since:
- 2007.02.20 (Christian Borgelt)
- See Also:
-
getData
Get the value array of the column.- Returns:
- the value array of the column
- Since:
- 2007.01.31 (Christian Borgelt)
-
setData
Set the value array of the column.Note that this function does not update the range of values of the column type. This may be achieved afterwards (except for nominal columns) by calling the function
cloneType(true)
.- Parameters:
data
- the value array of the column- Since:
- 2007.01.31 (Christian Borgelt)
- See Also:
-
getRowCount
public int getRowCount()Get the number of rows of the column.- Returns:
- the number of rows of the column
- Since:
- 2007.02.01 (Christian Borgelt)
-
getDir
public int getDir()Get the direction of the column.- Returns:
- the direction of the column
- Since:
- 2007.02.02 (Christian Borgelt)
-
setDir
public void setDir(int dir) Set the direction of the column.- Parameters:
dir
- the direction of the column- Since:
- 2007.02.02 (Christian Borgelt)
-
getWeight
public double getWeight()Get the weight of the column.- Returns:
- the weight of the column
- Since:
- 2007.02.17 (Christian Borgelt)
-
setWeight
public void setWeight(double weight) Set the weight of the column.- Parameters:
weight
- the weight of the column- Since:
- 2007.02.17 (Christian Borgelt)
-
getMark
public int getMark()Get the marker value of the column.- Returns:
- the marker value of the column
- Since:
- 2007.02.02 (Christian Borgelt)
-
setMark
public void setMark(int mark) Set the marker value of the column.- Parameters:
mark
- the marker value of the column- Since:
- 2007.02.02 (Christian Borgelt)
-
getValueAt
Get the value of a column row as an object.- Parameters:
row
- the row to access- Returns:
- an object representing the value in the specified row
- Since:
- 2007.02.01 (Christian Borgelt)
-
setValueAt
Set the value of a column row from an object.- Parameters:
value
- the value to set in the specified cellrow
- the row to set- Since:
- 2007.02.01 (Christian Borgelt)
-
getStringAt
Get the value of a column row as a string.- Parameters:
row
- the row to access- Returns:
- the created string description
- Since:
- 2007.02.02 (Christian Borgelt)
-
getNumberAt
public double getNumberAt(int row) Get the value of a column row as a number.- Parameters:
row
- the row to get- Returns:
- the row entry as a number
- Since:
- 2007.02.09 (Christian Borgelt)
-
isNull
public boolean isNull(int row) Check whether a column row is null.- Parameters:
row
- the row to check- Returns:
- whether the column row is null
- Since:
- 2007.02.02 (Christian Borgelt)
-
setNull
public void setNull(int row) Set a column row to a null value.- Parameters:
row
- the row to set- Since:
- 2007.02.02 (Christian Borgelt)
-
setNull
public void setNull(int beg, int end) Set a range of column rows to a null value.- Parameters:
beg
- the index of the first row (inclusive)end
- the index of the last row (exclusive)- Since:
- 2007.03.15 (Christian Borgelt)
-
hasNulls
public boolean hasNulls()Check whether a column contains null values.- Returns:
- whether the column contains null values
- Since:
- 2007.02.09 (Christian Borgelt)
-
resize
public void resize(int newcnt) Resize the value array of the column.If the new number of rows is greater than the old, the additional fields are initialized with null values.
Note that a new value array is allocated regardless of whether the new number of rows coincides with the old number or not. Hence calling this function with the old number of rows effectively clones the value array of the column.
- Parameters:
newcnt
- the new number of rows- Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
resize
public void resize(int newcnt, boolean init) Resize the value array of the column.Note that a new value array is allocated regardless of whether the new number of rows coincides with the old number or not. Hence calling this function with the old number of columns effectively clones the value array of the column.
- Parameters:
newcnt
- the new number of rowsinit
- whether new fields should be initialized with null values- Since:
- 2007.02.01 (Christian Borgelt)
- See Also:
-
toString
Create a string description of the column type. -
parse
Parse a column description.- Parameters:
scan
- the scanner to read from- Returns:
- the parsed description as a Column object
- Throws:
IOException
- if a read error occurs- Since:
- 2007.02.16 (Christian Borgelt)
-