net.quasardb.qdb.ts.TimeRange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jni Show documentation
Show all versions of jni Show documentation
API for the JNI components of the QuasarDB API for Java. Should not be included directly.
package net.quasardb.qdb.ts;
import java.io.Serializable;
import net.quasardb.qdb.exception.InvalidArgumentException;
import net.quasardb.qdb.jni.*;
public class TimeRange implements Serializable {
protected Timespec begin;
protected Timespec end;
public TimeRange (Timespec begin, Timespec end) {
if (end.isBefore(begin)) {
throw new InvalidArgumentException("Timerange must satisfy requirement begin <= end, but got begin(" + begin.toString() + ") and end(" + end.toString() + ") instead");
}
this.begin = begin;
this.end = end;
}
public Timespec getBegin() {
return this.begin;
}
/**
* Returns a copy of this timerange with a different begin.
*/
public TimeRange withBegin(Timespec b) {
return new TimeRange(b, this.end);
}
public Timespec getEnd() {
return this.end;
}
/**
* Returns a copy of this timerange with a different end.
*/
public TimeRange withEnd(Timespec e) {
return new TimeRange(this.begin, e);
}
public String toString() {
return "TimeRange (begin: " + this.begin.toString() + ", end: " + this.end.toString() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy