Package org.goplanit.time
Class TimePeriodImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.time.TimePeriodImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,ExternalIdAble
,IdAble
,TimePeriod
public class TimePeriodImpl extends ExternalIdAbleImpl implements TimePeriod
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
-
-
Constructor Summary
Constructors Constructor Description TimePeriodImpl(TimePeriodImpl timePeriodImpl)
Copy constructorTimePeriodImpl(IdGroupingToken groupId, long startTimeSeconds, long durationSeconds)
ConstructorTimePeriodImpl(IdGroupingToken groupId, String description, long startTimeSeconds, long durationSeconds)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimePeriodImpl
clone()
Create a shallow copy of this entityString
getDescription()
Return the descriptionlong
getDurationSeconds()
Return the duration in secondslong
getStartTimeSeconds()
Return the start timeString
toString()
Output this object as a String-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
-
-
-
Constructor Detail
-
TimePeriodImpl
public TimePeriodImpl(IdGroupingToken groupId, long startTimeSeconds, long durationSeconds) throws PlanItException
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classstartTimeSeconds
- start time in seconds from midnightdurationSeconds
- duration in seconds- Throws:
PlanItException
- thrown if error
-
TimePeriodImpl
public TimePeriodImpl(IdGroupingToken groupId, String description, long startTimeSeconds, long durationSeconds) throws PlanItException
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classdescription
- description of this time periodstartTimeSeconds
- start time of this time perioddurationSeconds
- duration of this time period- Throws:
PlanItException
- thrown if error
-
TimePeriodImpl
public TimePeriodImpl(TimePeriodImpl timePeriodImpl)
Copy constructor- Parameters:
timePeriodImpl
- to copy
-
-
Method Detail
-
getStartTimeSeconds
public long getStartTimeSeconds()
Return the start time- Specified by:
getStartTimeSeconds
in interfaceTimePeriod
- Returns:
- start time
-
getDurationSeconds
public long getDurationSeconds()
Return the duration in seconds- Specified by:
getDurationSeconds
in interfaceTimePeriod
- Returns:
- duration
-
getDescription
public String getDescription()
Return the description- Specified by:
getDescription
in interfaceTimePeriod
- Returns:
- description of this TimePeriod
-
clone
public TimePeriodImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Overrides:
clone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
-