Package org.goplanit.service.routed
Class RoutedTripFrequencyImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.service.routed.RoutedTripImpl
-
- org.goplanit.service.routed.RoutedTripFrequencyImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,Iterable<ServiceLegSegment>
,RoutedTrip
,RoutedTripFrequency
,ExternalIdAble
,IdAble
,ManagedId
public class RoutedTripFrequencyImpl extends RoutedTripImpl implements RoutedTripFrequency
Implementation of a RoutedTripFrequency interface.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description double
frequencyPerHour
frequency of the routed trip per hourList<ServiceLegSegment>
orderedLegSegments
Ordered list of leg segments for this trip from start to end-
Fields inherited from interface org.goplanit.service.routed.RoutedTrip
ROUTED_TRIP_ID_CLASS
-
-
Constructor Summary
Constructors Constructor Description RoutedTripFrequencyImpl(RoutedTripFrequencyImpl routedTripFrequencyImpl)
Copy constructorRoutedTripFrequencyImpl(IdGroupingToken tokenId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLegSegment(ServiceLegSegment legSegment)
Add a new leg segment (directed leg) to the end of the already registered legs.void
clearLegs()
Clear all legs from the tripRoutedTripFrequencyImpl
clone()
Create a shallow copy of this entitydouble
getFrequencyPerHour()
Collect frequency per hour for this tripServiceLegSegment
getLegSegment(int index)
Get a leg segment in a particular position of the routed tripint
getNumberOfLegSegments()
Collect the number of registered leg segmentsIterator<ServiceLegSegment>
iterator()
long
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idvoid
setFrequencyPerHour(double frequencyPerHour)
Set the frequency per hour-
Methods inherited from class org.goplanit.service.routed.RoutedTripImpl
generateId
-
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, toString, 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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.service.routed.RoutedTrip
getIdClass
-
Methods inherited from interface org.goplanit.service.routed.RoutedTripFrequency
getFirstLegSegment, getLastLegSegment, hasLegSegments, hasValidFrequency
-
-
-
-
Field Detail
-
orderedLegSegments
public final List<ServiceLegSegment> orderedLegSegments
Ordered list of leg segments for this trip from start to end
-
frequencyPerHour
public double frequencyPerHour
frequency of the routed trip per hour
-
-
Constructor Detail
-
RoutedTripFrequencyImpl
public RoutedTripFrequencyImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- to use for id generation
-
RoutedTripFrequencyImpl
public RoutedTripFrequencyImpl(RoutedTripFrequencyImpl routedTripFrequencyImpl)
Copy constructor- Parameters:
routedTripFrequencyImpl
- to copy
-
-
Method Detail
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Overrides:
recreateManagedIds
in classRoutedTripImpl
- Parameters:
tokenId
- to use- Returns:
- the updated internal id
-
clone
public RoutedTripFrequencyImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Specified by:
clone
in classRoutedTripImpl
- Returns:
- shallow copy of entity
-
clearLegs
public void clearLegs()
Clear all legs from the trip- Specified by:
clearLegs
in interfaceRoutedTripFrequency
-
addLegSegment
public void addLegSegment(ServiceLegSegment legSegment)
Add a new leg segment (directed leg) to the end of the already registered legs.- Specified by:
addLegSegment
in interfaceRoutedTripFrequency
- Parameters:
legSegment
- to add to the trip's route
-
getFrequencyPerHour
public double getFrequencyPerHour()
Collect frequency per hour for this trip- Specified by:
getFrequencyPerHour
in interfaceRoutedTripFrequency
- Returns:
- frequencyPerHour
-
setFrequencyPerHour
public void setFrequencyPerHour(double frequencyPerHour)
Set the frequency per hour- Specified by:
setFrequencyPerHour
in interfaceRoutedTripFrequency
- Parameters:
frequencyPerHour
- to use
-
iterator
public Iterator<ServiceLegSegment> iterator()
- Specified by:
iterator
in interfaceIterable<ServiceLegSegment>
-
getNumberOfLegSegments
public int getNumberOfLegSegments()
Collect the number of registered leg segments- Specified by:
getNumberOfLegSegments
in interfaceRoutedTripFrequency
- Returns:
- number of registered leg segments
-
getLegSegment
public ServiceLegSegment getLegSegment(int index)
Get a leg segment in a particular position of the routed trip- Specified by:
getLegSegment
in interfaceRoutedTripFrequency
- Parameters:
index
- to collect segment for- Returns:
- the leg segment found
-
-