public class DateTimeColumn extends AbstractColumn<LocalDateTime> implements DateTimeMapFunctions, DateTimeFilters, DateTimeFillers<DateTimeColumn>, CategoricalColumn<LocalDateTime>
DEFAULT_ARRAY_SIZE
Modifier and Type | Method and Description |
---|---|
DateTimeColumn |
append(Column<LocalDateTime> column) |
DateTimeColumn |
append(Column<LocalDateTime> column,
int row) |
DateTimeColumn |
append(LocalDateTime dateTime) |
DateTimeColumn |
appendCell(String stringValue) |
DateTimeColumn |
appendCell(String stringValue,
AbstractColumnParser<?> parser) |
DateTimeColumn |
appendInternal(long dateTime) |
DateTimeColumn |
appendMissing()
Appends a missing value appropriate to the column
|
DateTimeColumn |
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 LocalDateTime and midnight, January 1, 1970 UTC.
|
long[] |
asEpochMillisArray(ZoneOffset offset)
Returns an array where each entry is the difference, measured in milliseconds,
between the LocalDateTime and midnight, January 1, 1970 UTC.
|
long[] |
asEpochSecondArray()
Returns an array where each entry is the difference, measured in seconds,
between the LocalDateTime 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
If a value is missing, Long.MIN_VALUE is used
|
LocalDateTime[] |
asObjectArray() |
Set<LocalDateTime> |
asSet() |
List<LocalDateTime> |
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(LocalDateTime o1,
LocalDateTime o2) |
boolean |
contains(LocalDateTime dateTime)
Returns
true if the given object appears in this column, and false otherwise
TODO override in column subtypes for performance |
DateTimeColumn |
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 DateTimeColumn |
create(String name) |
static DateTimeColumn |
create(String name,
int initialSize) |
static DateTimeColumn |
create(String name,
List<LocalDateTime> data) |
static DateTimeColumn |
create(String name,
LocalDateTime[] data) |
it.unimi.dsi.fastutil.longs.LongArrayList |
data() |
DateTimeColumn |
emptyCopy()
Returns a copy of the receiver with no data.
|
DateTimeColumn |
emptyCopy(int rowSize)
Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
|
DateTimeColumn |
fillWith(Iterable<LocalDateTime> iterable) |
DateTimeColumn |
fillWith(Iterator<LocalDateTime> iterator) |
DateTimeColumn |
fillWith(Supplier<LocalDateTime> supplier) |
DateTimeColumn |
filter(Predicate<? super LocalDateTime> test)
Returns a new Column of the same type with only those rows satisfying the predicate
|
DateTimeColumn |
first(int numRows) |
LocalDateTime |
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) |
DateTimeColumn |
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
|
boolean |
isMissing(int rowNumber) |
Iterator<LocalDateTime> |
iterator()
Returns an iterator over elements of type
T . |
DateTimeColumn |
lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.
|
DateTimeColumn |
last(int numRows) |
it.unimi.dsi.fastutil.longs.LongIterator |
longIterator() |
DateTimeColumn |
map(Function<? super LocalDateTime,? extends LocalDateTime> fun)
Maps the function across all rows, appending the results to a new Column of the same type
|
LocalDateTime |
max() |
DateTimeColumn |
max(Column<LocalDateTime> other)
Returns a column containing the element-wise min between this column and other column
TODO(lwhite) Override in column subtypes for better performance
|
LocalDateTime |
min() |
DateTimeColumn |
min(Column<LocalDateTime> other)
Returns a column containing the element-wise min between this column and other column
TODO(lwhite) Override in column subtypes for better performance
|
DateTimeColumn |
removeMissing() |
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
DateTimeColumn |
sampleN(int n)
Returns a column containing a random sample of the values in this column
|
DateTimeColumn |
sampleX(double proportion)
Returns a table consisting of randomly selected values from this column.
|
DateTimeColumn |
set(int row,
Column<LocalDateTime> column,
int sourceRow) |
DateTimeColumn |
set(int index,
LocalDateTime value) |
DateTimeColumn |
set(int index,
long value) |
DateTimeColumn |
set(Selection condition,
Column<LocalDateTime> other)
Updates this column where values matching the selection are replaced with the corresponding value
from the given column
|
DateTimeColumn |
set(Selection rowSelection,
LocalDateTime newValue)
Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria
|
Column<LocalDateTime> |
setMissing(int i) |
DateTimeColumn |
setName(String name)
Sets the columns name to the given string
|
void |
setPrintFormatter(DateTimeColumnFormatter formatter) |
void |
setPrintFormatter(DateTimeFormatter dateTimeFormatter) |
void |
setPrintFormatter(DateTimeFormatter dateTimeFormatter,
String missingValueString) |
int |
size() |
void |
sortAscending() |
void |
sortDescending() |
DateTimeColumn |
sorted(Comparator<? super LocalDateTime> comp)
Returns a new Column of the same type sorted according to the provided Comparator
|
DateTimeColumn |
subset(int[] rows) |
Table |
summary() |
List<LocalDateTime> |
top(int n)
Returns the largest ("top") n values in the column
|
DateTimeColumn |
unique()
Returns a column of the same type as the receiver, containing only the unique values of the receiver.
|
static boolean |
valueIsMissing(long value) |
DateTimeColumn |
where(Selection selection) |
asStringColumn, name, toString, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
date, dateTimeColumnName, dayOfMonth, dayOfWeek, dayOfWeekValue, dayOfYear, difference, differenceInDays, differenceInHours, differenceInMilliseconds, differenceInMinutes, differenceInSeconds, differenceInYears, hour, hourMinute, lead, minute, minuteOfDay, missingValues, month, monthValue, plus, plusDays, plusHours, plusMicros, plusMillis, plusMinutes, plusMonths, plusSeconds, plusWeeks, plusYears, secondOfDay, time, timeWindow, timeWindow, year, yearDay, yearMonth, yearQuarter, yearWeek
eval, eval, eval, eval, eval, isAfter, isAfter, isAfter, isAfterNoon, isBefore, isBefore, isBefore, isBeforeNoon, isBetweenExcluding, isBetweenExcluding, isBetweenIncluding, isBetweenIncluding, isEqualTo, isEqualTo, isFirstDayOfMonth, isFriday, isInApril, isInAugust, isInDecember, isInFebruary, isInJanuary, isInJuly, isInJune, isInMarch, isInMay, isInNovember, isInOctober, isInQ1, isInQ2, isInQ3, isInQ4, isInSeptember, isInYear, isLastDayOfMonth, isMidnight, isMissing, isMonday, isNoon, isNotEqualTo, isNotEqualTo, isNotMissing, isOnOrAfter, isOnOrAfter, isOnOrAfter, isOnOrBefore, isOnOrBefore, isOnOrBefore, isSaturday, isSunday, isThursday, isTuesday, isWednesday
countByCategory
allMatch, anyMatch, asList, asStringColumn, columnWidth, count, count, mapInto, max, min, name, noneMatch, print, reduce, reduce, rolling, title, type
forEach, spliterator
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static DateTimeColumn create(String name)
public static DateTimeColumn create(String name, int initialSize)
public static DateTimeColumn create(String name, List<LocalDateTime> data)
public static DateTimeColumn create(String name, LocalDateTime[] data)
public static boolean valueIsMissing(long value)
public boolean isMissing(int rowNumber)
isMissing
in interface Column<LocalDateTime>
public DateTimeColumn subset(int[] rows)
subset
in interface Column<LocalDateTime>
public DateTimeColumn removeMissing()
removeMissing
in interface Column<LocalDateTime>
public boolean contains(LocalDateTime dateTime)
Column
true
if the given object appears in this column, and false otherwise
TODO override in column subtypes for performancecontains
in interface Column<LocalDateTime>
public Column<LocalDateTime> setMissing(int i)
setMissing
in interface Column<LocalDateTime>
public DateTimeColumn where(Selection selection)
where
in interface Column<LocalDateTime>
public void setPrintFormatter(DateTimeFormatter dateTimeFormatter, String missingValueString)
public void setPrintFormatter(DateTimeFormatter dateTimeFormatter)
public void setPrintFormatter(DateTimeColumnFormatter formatter)
public DateTimeColumn 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
lag
in interface Column<LocalDateTime>
lag
in interface DateTimeMapFunctions
public DateTimeColumn appendCell(String stringValue)
appendCell
in interface Column<LocalDateTime>
public DateTimeColumn appendCell(String stringValue, AbstractColumnParser<?> parser)
appendCell
in interface Column<LocalDateTime>
public DateTimeColumn append(LocalDateTime dateTime)
append
in interface Column<LocalDateTime>
public DateTimeColumn appendObj(Object obj)
appendObj
in interface Column<LocalDateTime>
public int size()
size
in interface Column<LocalDateTime>
size
in interface DateTimeFilters
public it.unimi.dsi.fastutil.longs.LongArrayList data()
data
in interface DateTimeFilters
public DateTimeColumn appendInternal(long dateTime)
public String getString(int row)
Column
getString
in interface Column<LocalDateTime>
row
- The index of the row.public String getUnformattedString(int row)
getUnformattedString
in interface Column<LocalDateTime>
public DateTimeColumn emptyCopy()
Column
emptyCopy
in interface Column<LocalDateTime>
emptyCopy
in class AbstractColumn<LocalDateTime>
Column
public DateTimeColumn emptyCopy(int rowSize)
Column
emptyCopy
in interface Column<LocalDateTime>
rowSize
- the initial row sizeColumn
public DateTimeColumn copy()
Column
copy
in interface Column<LocalDateTime>
Column
public void clear()
clear
in interface Column<LocalDateTime>
public void sortAscending()
sortAscending
in interface Column<LocalDateTime>
public void sortDescending()
sortDescending
in interface Column<LocalDateTime>
public Table summary()
summary
in interface Column<LocalDateTime>
public int countUnique()
Column
countUnique
in interface Column<LocalDateTime>
public DateTimeColumn unique()
Column
unique
in interface Column<LocalDateTime>
Column
public boolean isEmpty()
Column
isEmpty
in interface Column<LocalDateTime>
public long getLongInternal(int index)
getLongInternal
in interface DateTimeFilters
getLongInternal
in interface DateTimeMapFunctions
protected long getPackedDateTime(int index)
public LocalDateTime get(int index)
get
in interface Column<LocalDateTime>
get
in interface DateTimeFilters
get
in interface DateTimeMapFunctions
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface Column<LocalDateTime>
public DateTimeColumn set(Selection rowSelection, LocalDateTime newValue)
Example: myColumn.set(myColumn.valueIsMissing(), LocalDateTime.now()); // no more missing values
set
in interface Column<LocalDateTime>
public int countMissing()
countMissing
in interface Column<LocalDateTime>
public long[] asEpochSecondArray()
public long[] asEpochSecondArray(ZoneOffset offset)
public long[] asEpochMillisArray()
public long[] asEpochMillisArray(ZoneOffset offset)
public DateTimeColumn append(Column<LocalDateTime> column)
append
in interface Column<LocalDateTime>
public DateTimeColumn append(Column<LocalDateTime> column, int row)
append
in interface Column<LocalDateTime>
public DateTimeColumn set(int row, Column<LocalDateTime> column, int sourceRow)
set
in interface Column<LocalDateTime>
public LocalDateTime max()
public DateTimeColumn appendMissing()
Column
appendMissing
in interface Column<LocalDateTime>
public LocalDateTime min()
min
in interface DateTimeMapFunctions
public DateTimeColumn set(int index, long value)
public DateTimeColumn set(int index, LocalDateTime value)
set
in interface Column<LocalDateTime>
public List<LocalDateTime> 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<LocalDateTime> 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 Set<LocalDateTime> asSet()
public int byteSize()
Column
byteSize
in interface Column<LocalDateTime>
public byte[] asBytes(int rowNumber)
asBytes
in interface Column<LocalDateTime>
rowNumber
- index of the rowpublic double getDouble(int i)
public double[] asDoubleArray()
public DoubleColumn asDoubleColumn()
public Iterator<LocalDateTime> iterator()
T
.iterator
in interface Iterable<LocalDateTime>
public DateTimeColumn fillWith(Iterator<LocalDateTime> iterator)
fillWith
in interface DateTimeFillers<DateTimeColumn>
public DateTimeColumn fillWith(Iterable<LocalDateTime> iterable)
fillWith
in interface DateTimeFillers<DateTimeColumn>
public DateTimeColumn fillWith(Supplier<LocalDateTime> supplier)
fillWith
in interface DateTimeFillers<DateTimeColumn>
public LocalDateTime[] asObjectArray()
asObjectArray
in interface Column<LocalDateTime>
public int compare(LocalDateTime o1, LocalDateTime o2)
compare
in interface Comparator<LocalDateTime>
public DateTimeColumn setName(String name)
Column
setName
in interface Column<LocalDateTime>
setName
in class AbstractColumn<LocalDateTime>
name
- The new name MUST be unique for any table containing this columnpublic DateTimeColumn filter(Predicate<? super LocalDateTime> test)
Column
filter
in interface Column<LocalDateTime>
test
- the predicatepublic DateTimeColumn sorted(Comparator<? super LocalDateTime> comp)
Column
sorted
in interface Column<LocalDateTime>
comp
- the Comparatorpublic DateTimeColumn map(Function<? super LocalDateTime,? extends LocalDateTime> fun)
Column
map
in interface Column<LocalDateTime>
fun
- function to mappublic DateTimeColumn min(Column<LocalDateTime> other)
Column
min
in interface Column<LocalDateTime>
public DateTimeColumn max(Column<LocalDateTime> other)
Column
max
in interface Column<LocalDateTime>
public DateTimeColumn set(Selection condition, Column<LocalDateTime> other)
Column
set
in interface Column<LocalDateTime>
public DateTimeColumn first(int numRows)
first
in interface Column<LocalDateTime>
public DateTimeColumn last(int numRows)
last
in interface Column<LocalDateTime>
public DateTimeColumn inRange(int start, int end)
Column
inRange
in interface Column<LocalDateTime>
public DateTimeColumn sampleN(int n)
Column
sampleN
in interface Column<LocalDateTime>
n
- the number of values to selectpublic DateTimeColumn sampleX(double proportion)
Column
sampleX
in interface Column<LocalDateTime>
proportion
- The proportion to go in the sampleCopyright © 2019. All rights reserved.