Package com.rapidminer.belt.buffer
Class UInt16NominalBuffer
- java.lang.Object
-
- com.rapidminer.belt.buffer.NominalBuffer
-
- com.rapidminer.belt.buffer.UInt16NominalBuffer
-
public class UInt16NominalBuffer extends NominalBuffer
Implementation of aNominalBufferwith category index formatIntegerFormats.Format.UNSIGNED_INT16that can hold65535different categories. The category indices are stored asshort.- Author:
- Gisa Meier
-
-
Field Summary
-
Fields inherited from class com.rapidminer.belt.buffer.NominalBuffer
type
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdifferentValues()Returns the number of different values that were fed into this buffer.java.lang.Stringget(int index)Retrieves the value at the given index.IntegerFormats.FormatindexFormat()voidset(int index, java.lang.String value)Sets the data at the given index to the given value.booleansetSave(int index, java.lang.String value)Tries to set the data at the given index to the given value.intsize()CategoricalColumntoBooleanColumn(java.lang.String positiveValue)Creates a boolean column with the given positive value if the dictionary has at most two values.CategoricalColumntoColumn()Returns a column of the given type using the buffer's data.-
Methods inherited from class com.rapidminer.belt.buffer.NominalBuffer
toString
-
-
-
-
Method Detail
-
get
public java.lang.String get(int index)
Description copied from class:NominalBufferRetrieves the value at the given index. This method is thread-safe and can be used alongside invocations ofNominalBuffer.set(int, java.lang.String)andNominalBuffer.setSave(int, java.lang.String). However, this method might not return the latest value set on another thread.- Specified by:
getin classNominalBuffer- Parameters:
index- the index to look up- Returns:
- the value at the index
-
set
public void set(int index, java.lang.String value)Sets the data at the given index to the given value. This method is thread-safe.- Specified by:
setin classNominalBuffer- Parameters:
index- the index where the value should be setvalue- the value to set
-
setSave
public boolean setSave(int index, java.lang.String value)Tries to set the data at the given index to the given value. Returnstrueif it worked andfalseif the buffer format cannot hold any more different values. This method is thread-safe.- Specified by:
setSavein classNominalBuffer- Parameters:
index- the index where the value should be setvalue- the value to set- Returns:
falseif the buffer contained already to many different values to take this value,trueotherwise
-
size
public int size()
- Specified by:
sizein classNominalBuffer- Returns:
- the size of the buffer
-
indexFormat
public IntegerFormats.Format indexFormat()
- Specified by:
indexFormatin classNominalBuffer- Returns:
- the category index format of the buffer determining the maximal number of categories
-
differentValues
public int differentValues()
Description copied from class:NominalBufferReturns the number of different values that were fed into this buffer.nullvalues are not counted.- Specified by:
differentValuesin classNominalBuffer- Returns:
- the number of different values
-
toColumn
public CategoricalColumn toColumn()
Description copied from class:NominalBufferReturns a column of the given type using the buffer's data. The buffer becomes read-only. In contrast to constructing a new buffer from a column this method does not copy the data.- Specified by:
toColumnin classNominalBuffer- Returns:
- the categorical column
-
toBooleanColumn
public CategoricalColumn toBooleanColumn(java.lang.String positiveValue)
Description copied from class:NominalBufferCreates a boolean column with the given positive value if the dictionary has at most two values. The positive value must be either one of the dictionary values, making the other value, if it exists, negative. Or in case of a dictionary with only one value the positive value can benullmaking the only value negative.- Specified by:
toBooleanColumnin classNominalBuffer- Parameters:
positiveValue- the positive value ornull- Returns:
- a categorical column with a boolean
Dictionary
-
-