Record Class TimeRange
java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.common.util.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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a timestamp falls within this time range.static @Nullable 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
-
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
-
exclusive
-
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
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
startTime
-
endTime
-
includeBounds
public boolean includeBounds()Returns the value of theincludeBoundsrecord component.- Returns:
- the value of the
includeBoundsrecord component
-