Package com.qfs.snl
Interface ITimePeriod
- All Known Implementing Classes:
TimePeriod,TimePeriodDto
public interface ITimePeriod
Definition of a time period.
It can optional be bounded with a start and an end.
It it possible to define the boundaries as the current time on the server, allowing clients to
cope with potential time desynchronization.
- Author:
- ActiveViam
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(long time) Decides if a time is strictly contained by the period.default booleanequals(ITimePeriod period, Object other) Tests two objects for equality as ITimePeriod.longGets the resolved current time.longGets the resolved 'from' timestamp.longGets the resolved 'to' timestamp.booleanGets if the period has a start boundary.default inthashCode(ITimePeriod period) Computes a hashcode for a time period.booleanGets if the period has an end boundary.booleanGets if the 'from' boundary is made of the server current time.booleanisToNow()Gets if the 'to' boundary is made of the server current time.voidresolve(ITimeSupplier clock) Resolves the current time for boundaries.
-
Method Details
-
resolve
Resolves the current time for boundaries.- Parameters:
clock- the time supplier with respect to which the time period need be resolved
-
hasFromTime
boolean hasFromTime()Gets if the period has a start boundary.- Returns:
- true if a 'from' value is defined
-
getFromTime
long getFromTime()Gets the resolved 'from' timestamp.- Returns:
- boundary as a UNIX timestamp in ms
-
isFromNow
boolean isFromNow()Gets if the 'from' boundary is made of the server current time.- Returns:
- true if the boundary is dynamic, false otherwise
-
hasToTime
boolean hasToTime()Gets if the period has an end boundary.- Returns:
- true if a 'to' value is defined
-
getToTime
long getToTime()Gets the resolved 'to' timestamp.- Returns:
- boundary as a UNIX timestamp in ms
-
isToNow
boolean isToNow()Gets if the 'to' boundary is made of the server current time.- Returns:
- true if the boundary is dynamic, false otherwise
-
getCurrentTime
long getCurrentTime()Gets the resolved current time.- Returns:
- the current time.
-
contains
boolean contains(long time) Decides if a time is strictly contained by the period.- Parameters:
time- timestamp in ms- Returns:
- true if the period contains the time.
-
hashCode
Computes a hashcode for a time period.- Parameters:
period- period to consider- Returns:
- computed hashcode
-
equals
Tests two objects for equality as ITimePeriod.- Parameters:
period- first objectother- other object- Returns:
- true if the objects are equal as time periods
-