public class InstantColumn extends AbstractColumn<Instant> implements InstantMapFunctions, TemporalFillers<Instant,InstantColumn>, TemporalFilters<Instant>, CategoricalColumn<Instant>
DEFAULT_ARRAY_SIZE
Modifier and Type | Method and Description |
---|---|
InstantColumn |
append(Column<Instant> column) |
InstantColumn |
append(Column<Instant> column,
int row) |
InstantColumn |
append(Instant dateTime) |
InstantColumn |
appendCell(String stringValue) |
InstantColumn |
appendCell(String stringValue,
AbstractColumnParser<?> parser) |
InstantColumn |
appendInternal(long dateTime) |
InstantColumn |
appendMissing()
Appends a missing value appropriate to the column
|
InstantColumn |
appendObj(Object obj) |
byte[] |
asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]
|
double[] |
asDoubleArray() |
DoubleColumn |
asDoubleColumn() |
long[] |
asEpochMillisArray()
Returns an array where each entry is the difference, measured in milliseconds, between the
Instant and midnight, January 1, 1970 UTC.
|
long[] |
asEpochMillisArray(ZoneOffset offset)
Returns an array where each entry is the difference, measured in milliseconds, between the
Instant and midnight, January 1, 1970 UTC.
|
long[] |
asEpochSecondArray()
Returns an array where each entry is the difference, measured in seconds, between the Instant
and midnight, January 1, 1970 UTC.
|
long[] |
asEpochSecondArray(ZoneOffset offset)
Returns the seconds from epoch for each value as an array based on the given offset
|
DateTimeColumn |
asLocalDateTimeColumn() |
DateTimeColumn |
asLocalDateTimeColumn(ZoneId zone) |
Instant[] |
asObjectArray() |
Set<Instant> |
asSet() |
List<Instant> |
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(Instant o1,
Instant o2) |
boolean |
contains(Instant dateTime)
Returns
true if the given object appears in this column, and false otherwise |
InstantColumn |
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 InstantColumn |
create(String name) |
static InstantColumn |
create(String name,
Instant[] data) |
static InstantColumn |
create(String name,
int initialSize) |
static InstantColumn |
create(String name,
List<Instant> data) |
static InstantColumn |
create(String name,
Stream<Instant> stream) |
it.unimi.dsi.fastutil.longs.LongArrayList |
data()
Deprecated.
Please use the longIterator() or getLongInternal() methods
|
InstantColumn |
emptyCopy()
Returns a copy of the receiver with no data.
|
InstantColumn |
emptyCopy(int rowSize)
Returns an empty copy of the receiver, with its internal storage initialized to the given row
size.
|
InstantColumn |
fillWith(Iterable<Instant> iterable) |
InstantColumn |
fillWith(Iterator<Instant> iterator) |
InstantColumn |
fillWith(Supplier<Instant> supplier) |
InstantColumn |
filter(Predicate<? super Instant> test)
Returns a new Column of the same type with only those rows satisfying the predicate
|
InstantColumn |
first(int numRows) |
Instant |
get(int index) |
double |
getDouble(int i) |
long |
getLongInternal(int index) |
protected long |
getPackedDateTime(int index) |
String |
getString(int row)
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
InstantColumn |
inRange(int start,
int end)
Returns a column containing the rows in this column beginning with start inclusive, and ending
with end exclusive
|
boolean |
isEmpty()
Returns true if the column has no data
|
Selection |
isMissing() |
boolean |
isMissing(int rowNumber) |
Selection |
isNotMissing() |
Iterator<Instant> |
iterator()
Returns an iterator over elements of type
T . |
InstantColumn |
lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values
offset by n.
|
InstantColumn |
last(int numRows) |
it.unimi.dsi.fastutil.longs.LongIterator |
longIterator() |
InstantColumn |
map(Function<? super Instant,? extends Instant> fun)
Maps the function across all rows, appending the results to a new Column of the same type
|
Instant |
max() |
InstantColumn |
max(Column<Instant> other)
Returns a column containing the element-wise min between this column and other column
|
Instant |
min() |
InstantColumn |
min(Column<Instant> other)
Returns a column containing the element-wise min between this column and other column
|
InstantColumn |
plus(long amountToAdd,
ChronoUnit unit) |
InstantColumn |
removeMissing() |
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
InstantColumn |
sampleN(int n)
Returns a column containing a random sample of the values in this column
|
InstantColumn |
sampleX(double proportion)
Returns a table consisting of randomly selected values from this column.
|
InstantColumn |
set(int row,
Column<Instant> column,
int sourceRow) |
InstantColumn |
set(int index,
Instant value) |
InstantColumn |
set(int index,
long value) |
InstantColumn |
set(Selection condition,
Column<Instant> other)
Updates this column where values matching the selection are replaced with the corresponding
value from the given column
|
InstantColumn |
set(Selection rowSelection,
Instant newValue)
Conditionally update this column, replacing current values with newValue for all rows where the
current value matches the selection criteria
|
Column<Instant> |
setMissing(int i) |
InstantColumn |
setName(String name)
Sets the columns name to the given string
|
void |
setPrintFormatter(InstantColumnFormatter formatter) |
int |
size() |
void |
sortAscending() |
void |
sortDescending() |
InstantColumn |
sorted(Comparator<? super Instant> comp)
Returns a new Column of the same type sorted according to the provided Comparator
|
InstantColumn |
subset(int[] rows) |
Table |
summary() |
List<Instant> |
top(int n)
Returns the largest ("top") n values in the column
|
InstantColumn |
unique()
Returns a column of the same type as the receiver, containing only the unique values of the
receiver.
|
static boolean |
valueIsMissing(long value) |
InstantColumn |
where(Selection selection) |
asStringColumn, name, toString, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
plusDays, plusHours, plusMicros, plusMillis, plusMinutes, plusMonths, plusSeconds, plusWeeks, plusYears
difference, differenceInDays, differenceInHours, differenceInMilliseconds, differenceInMinutes, differenceInSeconds, differenceInYears, missingValues, temporalColumnName
allMatch, anyMatch, asList, asStringColumn, columnWidth, count, count, lead, mapInto, max, min, name, noneMatch, print, reduce, reduce, rolling, set, setMissingTo, title, type
forEach, spliterator
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
eval, eval, eval, eval, eval, isAfter, isBefore, isBetweenExcluding, isBetweenIncluding, isEqualTo
countByCategory
public static InstantColumn create(String name)
public static InstantColumn create(String name, int initialSize)
public static InstantColumn create(String name, List<Instant> data)
public static InstantColumn create(String name, Instant[] data)
public static InstantColumn create(String name, Stream<Instant> stream)
public static boolean valueIsMissing(long value)
public boolean isMissing(int rowNumber)
public InstantColumn plus(long amountToAdd, ChronoUnit unit)
plus
in interface InstantMapFunctions
plus
in interface TemporalMapFunctions<Instant>
public InstantColumn subset(int[] rows)
public InstantColumn removeMissing()
removeMissing
in interface Column<Instant>
public boolean contains(Instant dateTime)
Column
true
if the given object appears in this column, and false otherwise
TODO override in column subtypes for performance
public Column<Instant> setMissing(int i)
setMissing
in interface Column<Instant>
public InstantColumn where(Selection selection)
public void setPrintFormatter(InstantColumnFormatter formatter)
public InstantColumn 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 InstantColumn appendCell(String stringValue)
appendCell
in interface Column<Instant>
public InstantColumn appendCell(String stringValue, AbstractColumnParser<?> parser)
appendCell
in interface Column<Instant>
public InstantColumn append(Instant dateTime)
public InstantColumn appendObj(Object obj)
public int size()
@Deprecated public it.unimi.dsi.fastutil.longs.LongArrayList data()
public InstantColumn appendInternal(long dateTime)
appendInternal
in interface TemporalColumn<Instant>
public String getString(int row)
Column
public String getUnformattedString(int row)
getUnformattedString
in interface Column<Instant>
public InstantColumn emptyCopy()
Column
emptyCopy
in interface Column<Instant>
emptyCopy
in interface TemporalMapFunctions<Instant>
emptyCopy
in class AbstractColumn<Instant>
Column
public InstantColumn emptyCopy(int rowSize)
Column
public InstantColumn copy()
Column
public void sortAscending()
sortAscending
in interface Column<Instant>
public void sortDescending()
sortDescending
in interface Column<Instant>
public int countUnique()
Column
countUnique
in interface Column<Instant>
public InstantColumn unique()
Column
public boolean isEmpty()
Column
public long getLongInternal(int index)
getLongInternal
in interface TemporalColumn<Instant>
getLongInternal
in interface TemporalFilters<Instant>
protected long getPackedDateTime(int index)
public Instant get(int index)
get
in interface Column<Instant>
get
in interface TemporalColumn<Instant>
get
in interface TemporalFilters<Instant>
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface Column<Instant>
public InstantColumn set(Selection rowSelection, Instant newValue)
Example: myColumn.set(myColumn.valueIsMissing(), Instant.now()); // no more missing values
public int countMissing()
countMissing
in interface Column<Instant>
public long[] asEpochSecondArray()
If a value is missing, InstantColumnType.missingValueIndicator() is used
public long[] asEpochSecondArray(ZoneOffset offset)
If a value is missing, InstantColumnType.missingValueIndicator() is used
public long[] asEpochMillisArray()
If a missing value is encountered, InstantColumnType.missingValueIndicator() is inserted in the array
public long[] asEpochMillisArray(ZoneOffset offset)
If a missing value is encountered, InstantColumnType.missingValueIndicator() is inserted in the array
public DateTimeColumn asLocalDateTimeColumn()
public DateTimeColumn asLocalDateTimeColumn(ZoneId zone)
public InstantColumn append(Column<Instant> column)
public InstantColumn append(Column<Instant> column, int row)
public InstantColumn set(int row, Column<Instant> column, int sourceRow)
public Instant max()
public InstantColumn appendMissing()
Column
appendMissing
in interface Column<Instant>
public Instant min()
min
in interface TemporalMapFunctions<Instant>
public InstantColumn set(int index, long value)
public InstantColumn set(int index, Instant value)
public List<Instant> 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<Instant> 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 it.unimi.dsi.fastutil.longs.LongIterator longIterator()
public int byteSize()
Column
public byte[] asBytes(int rowNumber)
public double getDouble(int i)
public double[] asDoubleArray()
public DoubleColumn asDoubleColumn()
public InstantColumn fillWith(Iterator<Instant> iterator)
fillWith
in interface TemporalFillers<Instant,InstantColumn>
public InstantColumn fillWith(Iterable<Instant> iterable)
fillWith
in interface TemporalFillers<Instant,InstantColumn>
public InstantColumn fillWith(Supplier<Instant> supplier)
fillWith
in interface TemporalFillers<Instant,InstantColumn>
public Instant[] asObjectArray()
asObjectArray
in interface Column<Instant>
public int compare(Instant o1, Instant o2)
compare
in interface Comparator<Instant>
public InstantColumn setName(String name)
Column
public InstantColumn filter(Predicate<? super Instant> test)
Column
public InstantColumn sorted(Comparator<? super Instant> comp)
Column
public InstantColumn map(Function<? super Instant,? extends Instant> fun)
Column
public InstantColumn min(Column<Instant> other)
Column
TODO(lwhite) Override in column subtypes for better performance
public InstantColumn max(Column<Instant> other)
Column
TODO(lwhite) Override in column subtypes for better performance
public InstantColumn set(Selection condition, Column<Instant> other)
Column
public InstantColumn first(int numRows)
public InstantColumn last(int numRows)
public InstantColumn inRange(int start, int end)
Column
public InstantColumn sampleN(int n)
Column
public InstantColumn sampleX(double proportion)
Column
public Selection isMissing()
isMissing
in interface Column<Instant>
isMissing
in interface TemporalFilters<Instant>
isMissing
in interface FilterSpec<Selection>
public Selection isNotMissing()
isNotMissing
in interface Column<Instant>
isNotMissing
in interface TemporalFilters<Instant>
isNotMissing
in interface FilterSpec<Selection>
Copyright © 2019. All rights reserved.