Record Class TimeRange
java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.TimeRange
- Record Components:
startTime- the start of the time rangeendTime- the end of the time range (defaults to now if null)includeBounds- whether to include points exactly at the boundaries
Represents a time range with optional boundary inclusion.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a timestamp falls within this time range.static TimeRangeCreates an optional time range, returning null if both times are null.endTime()Returns the value of theendTimerecord component.final booleanIndicates whether some other object is "equal to" this one.static TimeRangeCreates a time range with exclusive bounds.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theincludeBoundsrecord component.static TimeRangeCreates a time range with inclusive bounds.Creates a new time range that follows this one without gaps or overlaps.Returns the value of thestartTimerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TimeRange
Primary constructor with validation. -
TimeRange
public TimeRange(long startTimeMillis, long endTimeMillis, boolean includeBounds) Canonical constructor using epoch milliseconds.- Parameters:
startTimeMillis- the start time in epoch millisecondsendTimeMillis- the end time in epoch milliseconds, or 0 to use current timeincludeBounds- whether to include boundary points
-
-
Method Details
-
inclusive
Creates a time range with inclusive bounds.- Parameters:
startTime- the start timeendTime- the end time (null for current time)- Returns:
- new time range with inclusive bounds
-
exclusive
Creates a time range with exclusive bounds.- Parameters:
startTime- the start timeendTime- the end time (null for current time)- Returns:
- new time range with exclusive bounds
-
create
Creates an optional time range, returning null if both times are null.- Parameters:
startTime- the start timeendTime- the end timeincludeBounds- whether to include boundary points- Returns:
- new time range or null
-
contains
Checks if a timestamp falls within this time range.- Parameters:
timestamp- the timestamp to check- Returns:
- true if the timestamp is within the range
-
nextRange
Creates a new time range that follows this one without gaps or overlaps.- Returns:
- a new time range starting at this range's end time
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
startTime
Returns the value of thestartTimerecord component.- Returns:
- the value of the
startTimerecord component
-
endTime
Returns the value of theendTimerecord component.- Returns:
- the value of the
endTimerecord component
-
includeBounds
public boolean includeBounds()Returns the value of theincludeBoundsrecord component.- Returns:
- the value of the
includeBoundsrecord component
-