Package com.qfs.snl.impl
Class TimePeriod
java.lang.Object
com.qfs.snl.impl.TimePeriod
- All Implemented Interfaces:
ITimePeriod
Effective implementation of ITimePeriod.
- Author:
- ActiveViam
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor with prescribed time supplier.TimePeriod
(ITimePeriod period) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(long time) Decides if a time is strictly contained by the period.boolean
from
(long time) Adds a start boundary.fromNow()
Adds a start boundary using server current time.long
Gets the resolved current time.long
Gets the resolved 'from' timestamp.long
Gets the resolved 'to' timestamp.boolean
Gets if the period has a start boundary.int
hashCode()
boolean
Gets if the period has an end boundary.boolean
Gets if the 'from' boundary is made of the server current time.boolean
isToNow()
Gets if the 'to' boundary is made of the server current time.void
resolve
(ITimeSupplier clock) Resolves the current time for boundaries.to
(long time) Adds an end boundary to the time period.toNow()
Adds an end boundary to the period using server current time.toString()
Methods inherited from interface com.qfs.snl.ITimePeriod
equals, hashCode
-
Constructor Details
-
Method Details
-
from
Adds a start boundary.- Parameters:
time
- timestamp in ms- Returns:
- this
-
fromNow
Adds a start boundary using server current time.- Returns:
- this
-
to
Adds an end boundary to the time period.- Parameters:
time
- timestamp in ms- Returns:
- this
-
toNow
Adds an end boundary to the period using server current time.- Returns:
- this
-
resolve
Description copied from interface:ITimePeriod
Resolves the current time for boundaries.- Specified by:
resolve
in interfaceITimePeriod
- Parameters:
clock
- the time supplier with respect to which the time period need be resolved
-
hasFromTime
public boolean hasFromTime()Description copied from interface:ITimePeriod
Gets if the period has a start boundary.- Specified by:
hasFromTime
in interfaceITimePeriod
- Returns:
- true if a 'from' value is defined
-
getFromTime
public long getFromTime()Description copied from interface:ITimePeriod
Gets the resolved 'from' timestamp.- Specified by:
getFromTime
in interfaceITimePeriod
- Returns:
- boundary as a UNIX timestamp in ms
-
isFromNow
public boolean isFromNow()Description copied from interface:ITimePeriod
Gets if the 'from' boundary is made of the server current time.- Specified by:
isFromNow
in interfaceITimePeriod
- Returns:
- true if the boundary is dynamic, false otherwise
-
hasToTime
public boolean hasToTime()Description copied from interface:ITimePeriod
Gets if the period has an end boundary.- Specified by:
hasToTime
in interfaceITimePeriod
- Returns:
- true if a 'to' value is defined
-
getToTime
public long getToTime()Description copied from interface:ITimePeriod
Gets the resolved 'to' timestamp.- Specified by:
getToTime
in interfaceITimePeriod
- Returns:
- boundary as a UNIX timestamp in ms
-
isToNow
public boolean isToNow()Description copied from interface:ITimePeriod
Gets if the 'to' boundary is made of the server current time.- Specified by:
isToNow
in interfaceITimePeriod
- Returns:
- true if the boundary is dynamic, false otherwise
-
getCurrentTime
public long getCurrentTime()Description copied from interface:ITimePeriod
Gets the resolved current time.- Specified by:
getCurrentTime
in interfaceITimePeriod
- Returns:
- the current time.
-
contains
public boolean contains(long time) Description copied from interface:ITimePeriod
Decides if a time is strictly contained by the period.- Specified by:
contains
in interfaceITimePeriod
- Parameters:
time
- timestamp in ms- Returns:
- true if the period contains the time.
-
toString
-
equals
-
hashCode
public int hashCode()
-