use of tech.tablesaw.api.TimeColumn in project symja_android_library by axkr.
the class TimeMapFunctions method with.
default TimeColumn with(int time, ChronoUnit unit) {
TimeColumn newColumn = TimeColumn.create("");
String timeUnitString = "";
for (int r = 0; r < size(); r++) {
int c1 = this.getIntInternal(r);
if (TimeColumn.valueIsMissing(c1)) {
newColumn.appendInternal(TimeColumnType.missingValueIndicator());
} else {
switch(unit) {
case HOURS:
newColumn.appendInternal(PackedLocalTime.withHour(time, c1));
timeUnitString = "hours";
break;
case MINUTES:
newColumn.appendInternal(PackedLocalTime.withMinute(time, c1));
timeUnitString = "minutes";
break;
case SECONDS:
newColumn.appendInternal(PackedLocalTime.withSecond(time, c1));
timeUnitString = "seconds";
break;
case MILLIS:
newColumn.appendInternal(PackedLocalTime.withMillisecond(time, c1));
timeUnitString = "ms";
break;
default:
throw new UnsupportedTemporalTypeException("Type " + unit + " is not currently supported");
}
}
}
newColumn.setName(name() + " with " + time + " " + timeUnitString + "(s)");
return newColumn;
}
use of tech.tablesaw.api.TimeColumn in project symja_android_library by axkr.
the class TimeMapFunctions method lead.
@Override
default TimeColumn lead(int n) {
TimeColumn column = lag(-n);
column.setName(name() + " lead(" + n + ")");
return column;
}
use of tech.tablesaw.api.TimeColumn in project symja_android_library by axkr.
the class TimeMapFunctions method minus.
default TimeColumn minus(int time, ChronoUnit unit) {
TimeColumn newColumn = TimeColumn.create("");
String timeUnitString = "";
for (int r = 0; r < size(); r++) {
int c1 = this.getIntInternal(r);
if (TimeColumn.valueIsMissing(c1)) {
newColumn.appendInternal(TimeColumnType.missingValueIndicator());
} else {
switch(unit) {
case HOURS:
newColumn.appendInternal(PackedLocalTime.minusHours(time, c1));
timeUnitString = "hours";
break;
case MINUTES:
newColumn.appendInternal(PackedLocalTime.minusMinutes(time, c1));
timeUnitString = "minutes";
break;
case SECONDS:
newColumn.appendInternal(PackedLocalTime.minusSeconds(time, c1));
timeUnitString = "seconds";
break;
case MILLIS:
newColumn.appendInternal(PackedLocalTime.minusMilliseconds(time, c1));
timeUnitString = "ms";
break;
default:
throw new UnsupportedTemporalTypeException("Type " + unit + " is not currently supported");
}
}
}
newColumn.setName(name() + " - " + time + " " + timeUnitString + "(s)");
return newColumn;
}
use of tech.tablesaw.api.TimeColumn in project symja_android_library by axkr.
the class TimeMapFunctions method plus.
default TimeColumn plus(int time, ChronoUnit unit) {
TimeColumn newColumn = TimeColumn.create("");
String timeUnitString = "";
for (int r = 0; r < size(); r++) {
int c1 = this.getIntInternal(r);
if (TimeColumn.valueIsMissing(c1)) {
newColumn.appendInternal(TimeColumnType.missingValueIndicator());
} else {
switch(unit) {
case HOURS:
newColumn.appendInternal(PackedLocalTime.plusHours(time, c1));
timeUnitString = "hours";
break;
case MINUTES:
newColumn.appendInternal(PackedLocalTime.plusMinutes(time, c1));
timeUnitString = "minutes";
break;
case SECONDS:
newColumn.appendInternal(PackedLocalTime.plusSeconds(time, c1));
timeUnitString = "seconds";
break;
case MILLIS:
newColumn.appendInternal(PackedLocalTime.plusMilliseconds(time, c1));
timeUnitString = "ms";
break;
default:
throw new UnsupportedTemporalTypeException("Type " + unit + " is not currently supported");
}
}
}
newColumn.setName(name() + " + " + time + " " + timeUnitString + "(s)");
return newColumn;
}
Aggregations