Iterable<Short>
, Comparator<Short>
, CategoricalColumn<Short>
, NumericColumn<Short>
, Column<Short>
, NumberFilters
, NumberMapFunctions
, FilterSpec<Short>
, NumberFilterSpec<Short>
public class ShortColumn extends NumberColumn<ShortColumn,Short> implements CategoricalColumn<Short>
Modifier and Type | Field | Description |
---|---|---|
protected it.unimi.dsi.fastutil.shorts.ShortArrayList |
data |
DEFAULT_ARRAY_SIZE
comparator, locale
Modifier | Constructor | Description |
---|---|---|
protected |
ShortColumn(String name,
it.unimi.dsi.fastutil.shorts.ShortArrayList data) |
Modifier and Type | Method | Description |
---|---|---|
ShortColumn |
append(short i) |
|
ShortColumn |
append(Short val) |
Appends value to the bottom of this column and return this column
|
ShortColumn |
append(Column<Short> column) |
Appends all the values in the argument to the bottom of this column and return this column
|
ShortColumn |
append(Column<Short> column,
int row) |
Appends the value at the given row in the given column to the bottom of this column and return
this column
|
ShortColumn |
appendCell(String value) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String.
|
ShortColumn |
appendCell(String value,
AbstractColumnParser<?> parser) |
Add one element to the bottom of this column and set its value to the parsed value of the given
String, as performed by the given parser
|
ShortColumn |
appendMissing() |
Appends a missing value appropriate to the column
|
ShortColumn |
appendObj(Object obj) |
Appends the given value to the bottom of this column and return this column
|
byte[] |
asBytes(int rowNumber) |
Returns the contents of the cell at rowNumber as a byte[].
|
DoubleColumn |
asDoubleColumn() |
Returns a new DoubleColumn containing a value for each value in this column, truncating if
necessary.
|
FloatColumn |
asFloatColumn() |
Returns a new FloatColumn containing a value for each value in this column, truncating if
necessary.
|
IntColumn |
asIntColumn() |
Returns a new IntColumn containing a value for each value in this column
|
LongColumn |
asLongColumn() |
Returns a new LongColumn containing a value for each value in this column
|
Short[] |
asObjectArray() |
Returns an array of objects as appropriate for my type of column
|
Set<Short> |
asSet() |
Returns a Set containing all the unique values in this column
|
short[] |
asShortArray() |
|
ShortColumn |
bottom(int n) |
Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this
should exclude missing
|
void |
clear() |
Removes all elements TODO: Make this return this column
|
int |
compare(Short o1,
Short o2) |
|
ShortColumn |
copy() |
Returns a deep copy of the receiver
|
int |
countUnique() |
Returns the count of unique values in this column.
|
static ShortColumn |
create(String name) |
|
static ShortColumn |
create(String name,
int initialSize) |
|
static ShortColumn |
create(String name,
short... arr) |
|
static ShortColumn |
create(String name,
Short[] arr) |
|
static ShortColumn |
create(String name,
Stream<Short> stream) |
|
ShortColumn |
createCol(String name) |
|
ShortColumn |
createCol(String name,
int initialSize) |
|
ShortColumn |
emptyCopy() |
Returns a copy of the receiver with no data.
|
ShortColumn |
emptyCopy(int rowSize) |
Returns an empty copy of the receiver, with its internal storage initialized to the given row
size.
|
boolean |
equals(int rowNumber1,
int rowNumber2) |
Returns true if the value in this column at rowNumber1 is equal to the value at rowNumber2
|
Short |
get(int index) |
Returns the value at the given zero-based index
|
double |
getDouble(int row) |
Returns a double representation of the number at
index |
int |
getInt(int row) |
Returns the value at the given index.
|
short |
getShort(int index) |
|
String |
getString(int row) |
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
Returns a String representation of the value at index r, without any formatting applied
|
Selection |
isIn(int... numbers) |
|
boolean |
isMissing(int rowNumber) |
Returns true if the value at rowNumber is missing
|
boolean |
isMissingValue(short value) |
|
Selection |
isNotIn(int... numbers) |
|
Iterator<Short> |
iterator() |
|
ShortColumn |
lag(int n) |
Returns a column of the same type and size as the receiver, containing the receivers values
offset by n.
|
ShortColumn |
removeMissing() |
Returns a copy of this column with the missing values removed
|
ShortColumn |
set(int i,
short val) |
|
ShortColumn |
set(int i,
Short val) |
Sets the value at index row to the given value and return this column
|
Column<Short> |
set(int row,
String stringValue,
AbstractColumnParser<?> parser) |
Sets the value at row to the parsed value of the given String using the given parser and
returns this column
|
ShortColumn |
set(int row,
Column<Short> column,
int sourceRow) |
Sets the value at row to the value at sourceRow in the given column and return this column
|
ShortColumn |
setMissing(int i) |
Sets the value at index i to the missing-value indicator for this column type, and return this
column
|
int |
size() |
Returns the number of elements in this column, including missing values
|
void |
sortAscending() |
Sorts my values in ascending order
|
void |
sortDescending() |
Sorts my values in descending order
|
ShortColumn |
subset(int[] rows) |
Return a column of the same type containing just those elements whose indexes are included in
the given array
|
ShortColumn |
top(int n) |
Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should
exclude missing
|
ShortColumn |
unique() |
Returns a column of the same type containing only the unique values
|
int |
valueHash(int rowNumber) |
Returns an int suitable as a hash for the value in this column at the given index
|
static boolean |
valueIsMissing(int value) |
asStringColumn, filter, first, indexOf, inRange, last, map, max, min, name, parser, sampleN, sampleX, set, set, setName, setParser, sorted, toString, type
countByCategory
allMatch, anyMatch, asList, asStringColumn, byteSize, columnWidth, contains, count, count, countMissing, filter, first, indexOf, inRange, interpolate, isEmpty, isMissing, isNotMissing, last, lead, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, rolling, rowComparator, sampleN, sampleX, set, set, set, setMissingTo, setName, setParser, sorted, summary, title, type, where
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
byteSize, countMissing, getPrintFormatter, rowComparator, set, set, setPrintFormatter, setPrintFormatter
isBetweenExclusive, isBetweenInclusive, isCloseTo, isEqualTo, isEqualTo, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNegative, isNonNegative, isNotEqualTo, isNotEqualTo, isPositive, isZero
abs, add, add, add, asPercent, asRatio, bin, cube, cubeRoot, cumMax, cumMin, cumProd, cumSum, difference, divide, divide, divide, log10, log1p, logN, multiply, multiply, multiply, name, neg, normalize, pctChange, power, power, reciprocal, remainder, remainder, round, roundInt, sqrt, square, subtract, subtract, subtract
allMatch, anyMatch, asDoubleArray, asShortColumn, asStringColumn, autoCorrelation, autoCorrelation, count, count, eval, eval, geometricMean, interpolate, isEmpty, isIn, isMissing, isNotIn, isNotMissing, kendalls, kurtosis, lead, mapInto, max, max, mean, median, min, min, noneMatch, pctChange, pearsons, percentile, populationVariance, product, quadraticMean, quartile1, quartile3, range, reduce, reduce, rolling, skewness, spearmans, standardDeviation, stats, sum, summarize, summary, sumOfLogs, sumOfSquares, variance, where
protected ShortColumn(String name, it.unimi.dsi.fastutil.shorts.ShortArrayList data)
public int valueHash(int rowNumber)
public boolean equals(int rowNumber1, int rowNumber2)
public static ShortColumn create(String name)
public static ShortColumn create(String name, short... arr)
public static ShortColumn create(String name, int initialSize)
public static ShortColumn create(String name, Short[] arr)
public static ShortColumn create(String name, Stream<Short> stream)
public ShortColumn createCol(String name, int initialSize)
createCol
in class NumberColumn<ShortColumn,Short>
public ShortColumn createCol(String name)
createCol
in class NumberColumn<ShortColumn,Short>
public static boolean valueIsMissing(int value)
public Short get(int index)
public short getShort(int index)
public ShortColumn subset(int[] rows)
subset
in interface Column<Short>
subset
in class AbstractColumn<ShortColumn,Short>
public Selection isIn(int... numbers)
public Selection isNotIn(int... numbers)
public int size()
size
in interface Column<Short>
size
in interface NumberFilters
size
in interface NumberMapFunctions
public void clear()
public ShortColumn unique()
public ShortColumn top(int n)
top
in class NumberColumn<ShortColumn,Short>
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 ShortColumn bottom(int n)
bottom
in class NumberColumn<ShortColumn,Short>
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 ShortColumn lag(int n)
For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public ShortColumn removeMissing()
removeMissing
in interface Column<Short>
public ShortColumn append(short i)
public ShortColumn append(Short val)
public ShortColumn emptyCopy()
emptyCopy
in interface Column<Short>
emptyCopy
in class NumberColumn<ShortColumn,Short>
Column
public ShortColumn emptyCopy(int rowSize)
emptyCopy
in interface Column<Short>
emptyCopy
in class NumberColumn<ShortColumn,Short>
rowSize
- the initial row sizeColumn
public ShortColumn copy()
public Short[] asObjectArray()
asObjectArray
in interface Column<Short>
public short[] asShortArray()
public int compare(Short o1, Short o2)
compare
in interface Comparator<Short>
public ShortColumn set(int i, Short val)
public ShortColumn set(int i, short val)
public Column<Short> set(int row, String stringValue, AbstractColumnParser<?> parser)
public ShortColumn append(Column<Short> column)
public String getString(int row)
getString
in interface Column<Short>
getString
in class NumberColumn<ShortColumn,Short>
row
- The index of the row.public ShortColumn append(Column<Short> column, int row)
public ShortColumn set(int row, Column<Short> column, int sourceRow)
public ShortColumn appendMissing()
appendMissing
in interface Column<Short>
public byte[] asBytes(int rowNumber)
public int countUnique()
countUnique
in interface Column<Short>
public int getInt(int row)
Returns the closest int
to the argument, with ties rounding to positive infinity.
Special cases:
Special cases:
Integer.MAX_VALUE
, an error will be thrown
row
- the index of the value to be rounded to an integer.int
value.ClassCastException
- if the absolute value of the value to be rounded is too large to be
cast to an intpublic double getDouble(int row)
index
getDouble
in interface NumberFilters
getDouble
in interface NumberMapFunctions
getDouble
in interface NumericColumn<Short>
public boolean isMissingValue(short value)
public boolean isMissing(int rowNumber)
isMissing
in interface Column<Short>
isMissing
in interface NumberMapFunctions
public ShortColumn setMissing(int i)
setMissing
in interface Column<Short>
public void sortAscending()
sortAscending
in interface Column<Short>
public void sortDescending()
sortDescending
in interface Column<Short>
public ShortColumn appendObj(Object obj)
public ShortColumn appendCell(String value)
appendCell
in interface Column<Short>
public ShortColumn appendCell(String value, AbstractColumnParser<?> parser)
appendCell
in interface Column<Short>
public String getUnformattedString(int row)
getUnformattedString
in interface Column<Short>
public LongColumn asLongColumn()
A widening primitive conversion from short to long does not lose any information at all; the numeric value is preserved exactly.
A missing value in the receiver is converted to a missing value in the result
asLongColumn
in interface NumericColumn<Short>
public FloatColumn asFloatColumn()
A widening primitive conversion from an int to a float does not lose information about the overall magnitude of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the least significant bits of the value. In this case, the resulting floating-point value will be a correctly rounded version of the integer value, using IEEE 754 round-to-nearest mode.
Despite the fact that a loss of precision may occur, a widening primitive conversion never results in a run-time exception.
A missing value in the receiver is converted to a missing value in the result
asFloatColumn
in interface NumericColumn<Short>
public DoubleColumn asDoubleColumn()
A widening primitive conversion from an int to a double does not lose information about the overall magnitude of a numeric value. It may, however, result in loss of precision - that is, the result may lose some of the least significant bits of the value. In this case, the resulting floating-point value will be a correctly rounded version of the integer value, using IEEE 754 round-to-nearest mode.
Despite the fact that a loss of precision may occur, a widening primitive conversion never results in a run-time exception.
A missing value in the receiver is converted to a missing value in the result
asDoubleColumn
in interface NumericColumn<Short>
public IntColumn asIntColumn()
The exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
asIntColumn
in interface NumericColumn<Short>
Copyright © 2022. All rights reserved.