public class DateColumn extends AbstractColumn implements DateFilters, DateFillers<DateColumn>, DateMapFunctions, CategoricalColumn, Iterable<LocalDate>
Modifier and Type | Field and Description |
---|---|
static int |
MISSING_VALUE |
DEFAULT_ARRAY_SIZE
Modifier and Type | Method and Description |
---|---|
void |
append(Column column) |
DateColumn |
append(LocalDate f) |
DateColumn |
appendCell(String string) |
DateColumn |
appendInternal(int f) |
DateColumn |
appendMissing()
Appends a missing value appropriate to the column
|
byte[] |
asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]
|
double[] |
asDoubleArray() |
int[] |
asIntArray() |
List<LocalDate> |
asList() |
Set<LocalDate> |
asSet() |
List<LocalDate> |
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() |
boolean |
contains(LocalDate localDate) |
int |
convert(String value)
Returns a PackedDate as converted from the given string
|
DateColumn |
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 DateColumn |
create(String name) |
static DateColumn |
create(String name,
int initialSize) |
static DateColumn |
create(String name,
int initialSize,
Locale locale) |
static DateColumn |
create(String name,
List<LocalDate> data) |
static DateColumn |
create(String name,
LocalDate[] data) |
static DateColumn |
create(String name,
Locale locale) |
it.unimi.dsi.fastutil.ints.IntArrayList |
data() |
DateColumn |
emptyCopy()
Returns a copy of the receiver with no data.
|
DateColumn |
emptyCopy(int rowSize)
Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
|
Selection |
eval(BiPredicate<LocalDate,LocalDate> predicate,
LocalDate valueToCompare) |
Selection |
eval(IntBiPredicate predicate,
DateColumn otherColumn) |
Selection |
eval(IntBiPredicate predicate,
int value) |
Selection |
eval(IntPredicate predicate)
This version operates on predicates that treat the given IntPredicate as operating on a packed local time
This is much more efficient that using a LocalTimePredicate, but requires that the developer understand the
semantics of packedLocalTimes
|
Selection |
eval(Predicate<LocalDate> predicate)
Returns a selection formed by applying the given predicate
|
DateColumn |
fillWith(Iterable<LocalDate> iterable) |
DateColumn |
fillWith(Iterator<LocalDate> iterator) |
DateColumn |
fillWith(Supplier<LocalDate> supplier) |
LocalDate |
firstElement() |
LocalDate |
get(int index) |
double |
getDouble(int i)
Returns a double representation of the value at the given row.
|
int |
getIntInternal(int index) |
String |
getString(int row)
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
it.unimi.dsi.fastutil.ints.IntIterator |
intIterator() |
boolean |
isEmpty()
Returns true if the column has no data
|
boolean |
isMissing(int rowNumber) |
Iterator<LocalDate> |
iterator()
Returns an iterator over elements of type
T . |
DateColumn |
lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.
|
DateColumn |
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.
|
LocalDate |
max() |
LocalDate |
min() |
DateColumn |
removeMissing() |
it.unimi.dsi.fastutil.ints.IntComparator |
rowComparator() |
DateColumn |
set(int index,
int value) |
DateColumn |
set(int index,
LocalDate value) |
DateColumn |
set(Selection rowSelection,
LocalDate newValue)
Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria
|
void |
setFormatter(DateTimeFormatter formatter) |
void |
setPrintFormatter(DateTimeFormatter dateTimeFormatter) |
void |
setPrintFormatter(DateTimeFormatter dateTimeFormatter,
String missingValueString) |
int |
size() |
void |
sortAscending() |
void |
sortDescending() |
Table |
summary()
Returns a table of dates and the number of observations of those dates
|
List<LocalDate> |
top(int n)
Returns the largest ("top") n values in the column
|
ColumnType |
type()
Returns this column's ColumnType
|
DateColumn |
unique()
Returns a column of the same type as the receiver, containing only the unique values of the receiver.
|
static boolean |
valueIsMissing(int i) |
DateColumn |
where(Selection selection) |
columnWidth, name, print, setName, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isAfter, isAfter, isAfter, isBefore, isBefore, isBefore, isBetweenExcluding, isBetweenExcluding, isBetweenIncluding, isBetweenIncluding, isEqualTo, isEqualTo, isEqualTo, isFirstDayOfMonth, isFriday, isInApril, isInAugust, isInDecember, isInFebruary, isInJanuary, isInJuly, isInJune, isInMarch, isInMay, isInNovember, isInOctober, isInQ1, isInQ2, isInQ3, isInQ4, isInSeptember, isInYear, isLastDayOfMonth, isMissing, isMonday, isNotEqualTo, isNotMissing, isOnOrAfter, isOnOrAfter, isOnOrBefore, isOnOrBefore, isSaturday, isSunday, isThursday, isTuesday, isWednesday
atStartOfDay, atTime, atTime, dateColumnName, dayOfMonth, dayOfWeek, dayOfWeekValue, dayOfYear, daysUntil, minus, minusDays, minusMonths, minusWeeks, minusYears, month, monthsUntil, monthValue, plus, plusDays, plusMonths, plusWeeks, plusYears, timeUntil, timeWindow, timeWindow, weeksUntil, year, yearDay, yearMonth, yearQuarter, yearsUntil, yearWeek
countByCategory
columnWidth, create, first, inRange, last, name, print, rolling, rows, sampleN, sampleX, setName, subset, summarizeIf, title
forEach, spliterator
public void setFormatter(DateTimeFormatter formatter)
public static DateColumn create(String name)
public static DateColumn create(String name, Locale locale)
public static DateColumn create(String name, int initialSize, Locale locale)
public static DateColumn create(String name, int initialSize)
public static DateColumn create(String name, List<LocalDate> data)
public static DateColumn create(String name, LocalDate[] data)
public ColumnType type()
Column
type
in interface Column
type
in class AbstractColumn
ColumnType
public DateColumn appendInternal(int f)
public it.unimi.dsi.fastutil.ints.IntArrayList data()
data
in interface DateFilters
public DateColumn set(int index, int value)
public DateColumn set(int index, LocalDate value)
public DateColumn append(LocalDate f)
public void setPrintFormatter(DateTimeFormatter dateTimeFormatter, String missingValueString)
public void setPrintFormatter(DateTimeFormatter dateTimeFormatter)
public String getString(int row)
Column
public String getUnformattedString(int row)
getUnformattedString
in interface Column
public DateColumn emptyCopy()
Column
public DateColumn emptyCopy(int rowSize)
Column
public DateColumn copy()
Column
public DateColumn lead(int n)
Column
public DateColumn 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 void sortAscending()
sortAscending
in interface Column
public void sortDescending()
sortDescending
in interface Column
public int countUnique()
Column
countUnique
in interface Column
public DateColumn unique()
Column
public LocalDate firstElement()
public LocalDate max()
max
in interface DateMapFunctions
public LocalDate min()
min
in interface DateMapFunctions
public DateColumn set(Selection rowSelection, LocalDate newValue)
Example: myColumn.set(myColumn.valueIsMissing(), LocalDate.now()); // no more missing values
public DateColumn appendMissing()
Column
appendMissing
in interface Column
public LocalDate get(int index)
get
in interface DateMapFunctions
public boolean isEmpty()
Column
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface Column
public int convert(String value)
value
- A string representation of a dateDateTimeParseException
- if no parser can be found for the date formatpublic DateColumn appendCell(String string)
appendCell
in interface Column
appendCell
in class AbstractColumn
public int getIntInternal(int index)
getIntInternal
in interface DateMapFunctions
public Table summary()
public static boolean valueIsMissing(int i)
public int countMissing()
countMissing
in interface Column
public List<LocalDate> 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<LocalDate> 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.ints.IntIterator intIterator()
public DateColumn removeMissing()
removeMissing
in interface Column
public DateColumn where(Selection selection)
where
in interface Column
where
in interface DateFilters
public Selection eval(IntPredicate predicate)
eval
in interface DateFilters
public Selection eval(IntBiPredicate predicate, int value)
eval
in interface DateFilters
public Selection eval(IntBiPredicate predicate, DateColumn otherColumn)
public Selection eval(BiPredicate<LocalDate,LocalDate> predicate, LocalDate valueToCompare)
eval
in interface DateFilters
public Selection eval(Predicate<LocalDate> predicate)
DateFilters
Prefer using an IntPredicate where the int is a PackedDate, as this version creates a date object for each value in the column
eval
in interface DateFilters
public boolean contains(LocalDate localDate)
public double[] asDoubleArray()
asDoubleArray
in interface Column
public double getDouble(int i)
Column
public int byteSize()
Column
public byte[] asBytes(int rowNumber)
public DateColumn fillWith(Iterator<LocalDate> iterator)
fillWith
in interface DateFillers<DateColumn>
public DateColumn fillWith(Iterable<LocalDate> iterable)
fillWith
in interface DateFillers<DateColumn>
public DateColumn fillWith(Supplier<LocalDate> supplier)
fillWith
in interface DateFillers<DateColumn>
public int[] asIntArray()
asIntArray
in interface CategoricalColumn
Copyright © 2018. All rights reserved.