Package tech.tablesaw.columns.strings
Class AbstractStringColumn<C extends AbstractColumn<C,String>>
java.lang.Object
tech.tablesaw.columns.AbstractColumn<C,String>
tech.tablesaw.columns.strings.AbstractStringColumn<C>
- All Implemented Interfaces:
Iterable<String>
,Comparator<String>
,CategoricalColumn<String>
,Column<String>
,StringFilters
,StringMapFunctions
,StringReduceUtils
,FilterSpec<Selection>
,StringFilterSpec<Selection>
- Direct Known Subclasses:
StringColumn
,TextColumn
public abstract class AbstractStringColumn<C extends AbstractColumn<C,String>>
extends AbstractColumn<C,String>
implements CategoricalColumn<String>, StringFilters, StringMapFunctions, StringReduceUtils
Abstract super class for Text like columns.
-
Field Summary
Fields inherited from class tech.tablesaw.columns.AbstractColumn
DEFAULT_ARRAY_SIZE, DEFAULT_COLUMN_TYPE_MISMATCH_MESSAGE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractStringColumn
(ColumnType type, String name, AbstractColumnParser<String> parser) Constructs a column of the given ColumnType, name, and parser -
Method Summary
Modifier and TypeMethodDescriptionAppends the value at the given row in the given column to the bottom of this column and return this columnbottom
(int n) Returns the smallest ("bottom") n values in the columnint
byteSize()
Returns the width of a cell in this column, in bytes.int
Returns the currentStringColumnFormatter
.getString
(int row) Returns a string representation of the value at the given row.getUnformattedString
(int row) Returns a String representation of the value at index r, without any formatting appliedSets the value at row to the value at sourceRow in the given column and return this columnvoid
setPrintFormatter
(StringColumnFormatter formatter) Sets anStringColumnFormatter
which will be used to format the display of data from this column when it is printed (using, for example, Table:print()) and optionally when written to a text file like a CSV.top
(int n) Returns the largest ("top") n values in the columnMethods inherited from class tech.tablesaw.columns.AbstractColumn
asStringColumn, filter, first, indexOf, inRange, last, map, max, min, name, parser, sampleN, sampleX, set, set, setName, setParser, sorted, subset, toString, type
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface tech.tablesaw.api.CategoricalColumn
countByCategory
Methods inherited from interface tech.tablesaw.columns.Column
allMatch, anyMatch, append, append, appendCell, appendCell, appendMissing, appendObj, asBytes, asList, asObjectArray, asSet, asStringColumn, clear, columnWidth, contains, copy, count, count, countMissing, countUnique, emptyCopy, emptyCopy, equals, filter, first, indexOf, inRange, interpolate, isEmpty, isMissing, lag, last, lead, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, removeMissing, rolling, rowComparator, sampleN, sampleX, set, set, set, set, set, setMissing, setMissingTo, setName, setParser, size, sortAscending, sortDescending, sorted, subset, summary, title, type, unique, valueHash, where
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface tech.tablesaw.columns.strings.StringFilters
containsString, endsWith, equalsIgnoreCase, equalsIgnoreCase, eval, eval, eval, eval, get, isAlpha, isAlphaNumeric, isEmptyString, isEqualTo, isEqualTo, isIn, isIn, isIn, isLongerThan, isLowerCase, isMissing, isNotEqualTo, isNotEqualTo, isNotIn, isNotIn, isNotIn, isNotMissing, isNumeric, isShorterThan, isUpperCase, lengthEquals, matchesRegex, startsWith, startsWith
Methods inherited from interface tech.tablesaw.columns.strings.StringMapFunctions
abbreviate, capitalize, commonPrefix, commonSuffix, concatenate, concatenate, countTokens, distance, format, join, length, lowerCase, padEnd, padStart, parseDouble, parseFloat, parseInt, repeat, replaceAll, replaceAll, replaceFirst, substring, substring, tokenizeAndRemoveDuplicates, tokenizeAndSort, tokenizeAndSort, tokens, trim, uniqueTokens, upperCase
Methods inherited from interface tech.tablesaw.columns.strings.StringReduceUtils
appendAll, appendAll
-
Constructor Details
-
AbstractStringColumn
Constructs a column of the given ColumnType, name, and parser
-
-
Method Details
-
setPrintFormatter
Sets anStringColumnFormatter
which will be used to format the display of data from this column when it is printed (using, for example, Table:print()) and optionally when written to a text file like a CSV. -
getPrintFormatter
Returns the currentStringColumnFormatter
. -
getString
Returns a string representation of the value at the given row. -
getUnformattedString
Returns a String representation of the value at index r, without any formatting applied- Specified by:
getUnformattedString
in interfaceColumn<C extends AbstractColumn<C,
String>>
-
top
Returns the largest ("top") n values in the column- Parameters:
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 column- Returns:
- A list, possibly empty, of the largest observations
-
bottom
Returns the smallest ("bottom") n values in the column- Parameters:
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 column- Returns:
- A list, possibly empty, of the smallest n observations
-
append
Appends the value at the given row in the given column to the bottom of this column and return this column -
set
Sets the value at row to the value at sourceRow in the given column and return this column -
byteSize
public int byteSize()Returns the width of a cell in this column, in bytes. -
compare
- Specified by:
compare
in interfaceComparator<C extends AbstractColumn<C,
String>>
-