use of tech.tablesaw.api.DateColumn in project symja_android_library by axkr.
the class CsvWriter method writeValues.
private void writeValues(Table table, CsvWriteOptions options, int r, String[] entries, int c) {
DateTimeFormatter dateFormatter = options.dateFormatter();
DateTimeFormatter dateTimeFormatter = options.dateTimeFormatter();
ColumnType columnType = table.column(c).type();
if (dateFormatter != null && columnType.equals(ColumnType.LOCAL_DATE)) {
DateColumn dc = (DateColumn) table.column(c);
entries[c] = options.dateFormatter().format(dc.get(r));
} else if (dateTimeFormatter != null && columnType.equals(ColumnType.LOCAL_DATE_TIME)) {
DateTimeColumn dc = (DateTimeColumn) table.column(c);
entries[c] = options.dateTimeFormatter().format(dc.get(r));
} else {
if (options.usePrintFormatters()) {
entries[c] = table.getString(r, c);
} else {
entries[c] = table.getUnformatted(r, c);
}
}
}
use of tech.tablesaw.api.DateColumn in project symja_android_library by axkr.
the class DateMapFunctions method plus.
default DateColumn plus(int value, ChronoUnit unit) {
DateColumn newColumn = DateColumn.create(dateColumnName(this, value, unit));
DateColumn column1 = (DateColumn) this;
for (int r = 0; r < column1.size(); r++) {
int packedDate = column1.getIntInternal(r);
if (packedDate == DateColumnType.missingValueIndicator()) {
newColumn.appendMissing();
} else {
newColumn.appendInternal(PackedLocalDate.plus(value, unit, packedDate));
}
}
return newColumn;
}
use of tech.tablesaw.api.DateColumn in project symja_android_library by axkr.
the class DateTimeMapFunctions method date.
/**
* Returns a DateColumn containing the date portion of each dateTime in this DateTimeColumn
*/
default DateColumn date() {
DateColumn newColumn = DateColumn.create(this.name() + " date");
for (int r = 0; r < this.size(); r++) {
if (isMissing(r)) {
newColumn.appendMissing();
} else {
long c1 = getLongInternal(r);
newColumn.appendInternal(PackedLocalDateTime.date(c1));
}
}
return newColumn;
}
Aggregations