Package org.goplanit.utils.time
Interface TimePeriod
-
- All Superinterfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
- All Known Implementing Classes:
TimePeriodImpl
public interface TimePeriod extends ExternalIdAble, ManagedId
Represents a time period within the day. Used to determine the duration and start time of trips for example. We internally adopt seconds as the unit- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static Class<TimePeriod>
TIMEPERIOD_ID_CLASS
id class for generating ids
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TimePeriod
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.String
getDescription()
Return the descriptiondefault Double
getDurationHours()
Get the duration in hourslong
getDurationSeconds()
Return the duration in secondsdefault Class<? extends TimePeriod>
getIdClass()
Each managed id class is expected to generate its ids based on its class signature.long
getStartTimeSeconds()
Return the start timedefault boolean
hasDescription()
Verify if time period has a descriptionTimePeriod
shallowClone()
Create a shallow copy of this entity-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
-
-
-
Field Detail
-
TIMEPERIOD_ID_CLASS
static final Class<TimePeriod> TIMEPERIOD_ID_CLASS
id class for generating ids
-
-
Method Detail
-
getIdClass
default Class<? extends TimePeriod> getIdClass()
Each managed id class is expected to generate its ids based on its class signature. To be able to generate the correct id the class used for id generation is to be provided via this method call.- Specified by:
getIdClass
in interfaceManagedId
- Returns:
- idClass to use for generating ids for instances of this idable derived class
-
getStartTimeSeconds
long getStartTimeSeconds()
Return the start time- Returns:
- start time
-
getDurationSeconds
long getDurationSeconds()
Return the duration in seconds- Returns:
- duration
-
getDescription
String getDescription()
Return the description- Returns:
- description of this TimePeriod
-
hasDescription
default boolean hasDescription()
Verify if time period has a description- Returns:
- true when description present, false otherwise
-
getDurationHours
default Double getDurationHours()
Get the duration in hours- Returns:
- duration in hours
-
shallowClone
TimePeriod shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Returns:
- shallow copy of entity
-
deepClone
TimePeriod deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code
-
-