Package com.iizix
Class TimeInterval
java.lang.Object
com.iizix.TimeInterval
Class holding a start and end time. The start time may be unset, or the end time. The time is a time value in milliseconds since the epoch in UMT.
- Author:
- Christopher Mindus
- Field SummaryFields
- Method SummaryModifier and TypeMethodDescription- static TimeInterval- between- (long startTime, long endTime) Creates a new instance of the time interval with only a end time set.- static TimeInterval- endingAt- (long endTime) Creates a new instance of the time interval with only a end time set.- booleanChecks for equality.- int- hashCode()Gets the hash code of the time interval.- boolean- isIncluded- (long time) Verifies if the time is between included in the time interval.- static TimeInterval- startingAt- (long startTime) Creates a new instance of the time interval with only a start time set.- toString()Get a string representation of the time interval.
- Field Details- NO_INTERVALSEmpty array of time intervals.
 
- Method Details- startingAtCreates a new instance of the time interval with only a start time set.- Parameters:
- startTime- The starting time in milliseconds since the epoch in UMT.
- Returns:
- A new instance of the time interval.
- Throws:
- IllegalArgumentException- If the- startTimeis zero or negative.
 
- endingAtCreates a new instance of the time interval with only a end time set.- Parameters:
- endTime- The end time in milliseconds since the epoch in UMT.
- Returns:
- A new instance of the time interval.
- Throws:
- IllegalArgumentException- If the- endTimeis zero or negative.
 
- betweenCreates a new instance of the time interval with only a end time set.- Parameters:
- startTime- The starting time in milliseconds since the epoch in UMT.
- endTime- The end time in milliseconds since the epoch in UMT.
- Returns:
- A new instance of the time interval.
- Throws:
- IllegalArgumentException- If the- startTimeis zero or negative,- endTimeis zero or negative or- startTimeis larger or equal to- endTime.
 
- isIncludedpublic boolean isIncluded- (long time) Verifies if the time is between included in the time interval.- Parameters:
- time- The time in milliseconds since the epoch in GMT.
- Returns:
- trueif the time is included,- falseif not.
 
- hashCodepublic int hashCode()Gets the hash code of the time interval.
- equalsChecks for equality.
- toStringGet a string representation of the time interval.