public class TextColumn extends AbstractColumn<String> implements CategoricalColumn<String>, StringFilters, StringMapFunctions, StringReduceUtils
This is the default column type for SQL longvarchar and longnvarchar types
Because the MISSING_VALUE for this column type is an empty string, there is little or no need for special handling of missing values in this class's methods.
DEFAULT_ARRAY_SIZE
Modifier and Type | Method and Description |
---|---|
TextColumn |
addAll(List<String> stringValues)
Add all the strings in the list to this column
|
TextColumn |
append(Column<String> column) |
Column<String> |
append(Column<String> column,
int row) |
TextColumn |
append(String value)
Added for naming consistency with all other columns
|
TextColumn |
appendCell(String object) |
TextColumn |
appendCell(String object,
AbstractColumnParser<?> parser) |
TextColumn |
appendMissing()
Appends a missing value appropriate to the column
|
TextColumn |
appendObj(Object obj) |
byte[] |
asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]
|
List<String> |
asList()
Returns a List<String> representation of all the values in this column
|
String[] |
asObjectArray() |
Set<String> |
asSet() |
StringColumn |
asStringColumn() |
List<String> |
bottom(int n)
Returns the smallest ("bottom") n values in the column
|
int |
byteSize()
Returns the width of a cell in this column, in bytes.
|
void |
clear() |
int |
compare(String o1,
String o2) |
boolean |
contains(String aString)
Returns true if this column contains a cell with the given string, and false otherwise
|
TextColumn |
copy()
Returns a deep copy of the receiver
|
int |
countMissing()
Returns the count of missing values in this column
|
int |
countUnique()
Returns the count of unique values in this column.
|
static TextColumn |
create(String name) |
static TextColumn |
create(String name,
int size) |
static TextColumn |
create(String name,
List<String> strings) |
static TextColumn |
create(String name,
String[] strings) |
TextColumn |
emptyCopy()
Returns a copy of the receiver with no data.
|
TextColumn |
emptyCopy(int rowSize)
Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
|
int |
firstIndexOf(String value) |
String |
get(int rowIndex)
Returns the value at rowIndex in this column.
|
StringColumnFormatter |
getPrintFormatter() |
String |
getString(int row)
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
boolean |
isEmpty()
Returns true if the column has no data
|
Selection |
isIn(Collection<String> strings) |
Selection |
isIn(String... strings) |
boolean |
isMissing(int rowNumber) |
Selection |
isNotIn(Collection<String> strings) |
Selection |
isNotIn(String... strings) |
Iterator<String> |
iterator() |
TextColumn |
lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.
|
TextColumn |
lead(int n)
Returns a column of the same type as the receiver, containing the receivers values offset -n
For example if you lead a column containing 2, 3, 4 by 1, you get a column containing 3, 4, NA.
|
TextColumn |
removeMissing() |
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
Column<String> |
set(int row,
Column<String> column,
int sourceRow) |
TextColumn |
set(int rowIndex,
String stringValue) |
TextColumn |
set(Selection rowSelection,
String newValue)
Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria
|
Column<String> |
setMissing(int i) |
void |
setPrintFormatter(StringColumnFormatter formatter) |
int |
size()
Returns the number of elements (a.k.a.
|
void |
sortAscending() |
void |
sortDescending() |
Table |
summary() |
List<String> |
top(int n)
Returns the largest ("top") n values in the column
|
TextColumn |
unique()
Returns a new Column containing all the unique values in this column
|
static boolean |
valueIsMissing(String string) |
TextColumn |
where(Selection selection) |
name, setName, toString, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
countByCategory
containsString, endsWith, equalsIgnoreCase, equalsIgnoreCase, eval, eval, eval, eval, isAlpha, isAlphaNumeric, isEmptyString, isEqualTo, isEqualTo, isLongerThan, isLowerCase, isMissing, isNotEqualTo, isNotEqualTo, isNotMissing, isNumeric, isShorterThan, isUpperCase, lengthEquals, matchesRegex, startsWith, startsWith
abbreviate, commonPrefix, commonSuffix, concatenate, countTokens, distance, format, join, length, lowerCase, padEnd, padStart, parseInt, replaceAll, replaceAll, replaceFirst, substring, substring, tokenizeAndRemoveDuplicates, tokenizeAndSort, tokenizeAndSort, tokens, trim, uniqueTokens, upperCase
appendAll, appendAll
allMatch, anyMatch, columnWidth, count, count, filter, first, inRange, last, map, mapInto, max, max, min, min, name, noneMatch, print, reduce, reduce, rolling, sampleN, sampleX, set, setName, sorted, subset, title, type
forEach, spliterator
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static boolean valueIsMissing(String string)
public TextColumn appendMissing()
Column
appendMissing
in interface Column<String>
public static TextColumn create(String name)
public static TextColumn create(String name, String[] strings)
public static TextColumn create(String name, List<String> strings)
public static TextColumn create(String name, int size)
public boolean isMissing(int rowNumber)
public void setPrintFormatter(StringColumnFormatter formatter)
public StringColumnFormatter getPrintFormatter()
public String getString(int row)
Column
public String getUnformattedString(int row)
getUnformattedString
in interface Column<String>
public TextColumn emptyCopy()
Column
public TextColumn emptyCopy(int rowSize)
Column
public void sortAscending()
sortAscending
in interface Column<String>
public void sortDescending()
sortDescending
in interface Column<String>
public int size()
public String get(int rowIndex)
get
in interface Column<String>
get
in interface StringFilters
rowIndex
- index of the rowIndexOutOfBoundsException
- if the given rowIndex is not in the columnpublic List<String> asList()
NOTE: Unless you really need a string consider using the column itself for large datasets as it uses much less memory
public TextColumn lead(int n)
Column
public TextColumn lag(int n)
Column
For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public TextColumn set(Selection rowSelection, String newValue)
Examples: myCatColumn.set(myCatColumn.isEqualTo("Cat"), "Dog"); // no more cats myCatColumn.set(myCatColumn.valueIsMissing(), "Fox"); // no more missing values
public TextColumn set(int rowIndex, String stringValue)
public int countUnique()
Column
countUnique
in interface Column<String>
public List<String> top(int n)
n
- The maximum number of records to return. The actual number will be smaller if n is greater than the
number of observations in the columnpublic List<String> bottom(int n)
n
- The maximum number of records to return. The actual number will be smaller if n is greater than the
number of observations in the columnpublic boolean contains(String aString)
public Column<String> setMissing(int i)
setMissing
in interface Column<String>
public TextColumn addAll(List<String> stringValues)
stringValues
- a list of valuespublic TextColumn appendCell(String object)
appendCell
in interface Column<String>
public TextColumn appendCell(String object, AbstractColumnParser<?> parser)
appendCell
in interface Column<String>
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface Column<String>
public boolean isEmpty()
Column
public TextColumn unique()
public TextColumn where(Selection selection)
public TextColumn copy()
Column
public TextColumn append(Column<String> column)
public int countMissing()
countMissing
in interface Column<String>
public TextColumn removeMissing()
removeMissing
in interface Column<String>
public int byteSize()
Column
public byte[] asBytes(int rowNumber)
public TextColumn append(String value)
public TextColumn appendObj(Object obj)
public Selection isIn(String... strings)
isIn
in interface StringFilters
public Selection isIn(Collection<String> strings)
isIn
in interface StringFilters
public Selection isNotIn(String... strings)
isNotIn
in interface StringFilters
public Selection isNotIn(Collection<String> strings)
isNotIn
in interface StringFilters
public int firstIndexOf(String value)
public String[] asObjectArray()
asObjectArray
in interface Column<String>
public StringColumn asStringColumn()
asStringColumn
in interface Column<String>
asStringColumn
in class AbstractColumn<String>
public int compare(String o1, String o2)
compare
in interface Comparator<String>
Copyright © 2019. All rights reserved.