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:
Comparable<IdAble>,Iterable<ServiceLegSegment>,ExternalIdAble,IdAble,ManagedId,RoutedTrip,RoutedTripFrequency
public class RoutedTripFrequencyImpl extends RoutedTripImpl implements RoutedTripFrequency
Implementation of a RoutedTripFrequency interface.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description doublefrequencyPerHourfrequency of the routed trip per hourList<ServiceLegSegment>orderedLegSegmentsOrdered list of leg segments for this trip from start to end (leg segments not owned)-
Fields inherited from interface org.goplanit.utils.service.routed.RoutedTrip
ROUTED_TRIP_ID_CLASS
-
-
Constructor Summary
Constructors Constructor Description RoutedTripFrequencyImpl(RoutedTripFrequencyImpl routedTripFrequencyImpl, boolean deepCopy)Copy constructorRoutedTripFrequencyImpl(IdGroupingToken tokenId)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLegSegment(ServiceLegSegment legSegment)Add a new leg segment (directed leg) to the end of the already registered legs.voidclearLegs()Clear all legs from the tripRoutedTripFrequencyImpldeepClone()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.doublegetFrequencyPerHour()Collect frequency per hour for this tripServiceLegSegmentgetLegSegment(int index)Get a leg segment in a particular position of the routed tripintgetNumberOfLegSegments()Collect the number of registered leg segmentsSet<ServiceNode>getUsedServiceNodes()Get all used service nodes along the tripIterator<ServiceLegSegment>iterator()longrecreateManagedIds(IdGroupingToken tokenId)recreate the internal id(s) and set them including the Idable idvoidremoveAllLegSegments()Remove all service leg segments from the instancevoidremoveLegSegment(int index)Remove leg segment at given index from the instancevoidsetFrequencyPerHour(double frequencyPerHour)Set the frequency per hourRoutedTripFrequencyImplshallowClone()Create a shallow copy of this entity-
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
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
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 java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.service.routed.RoutedTrip
getIdClass
-
Methods inherited from interface org.goplanit.utils.service.routed.RoutedTripFrequency
clear, getFirstLegSegment, getLastLegSegment, getLastSegmentIndex, getLegSegmentsAsStream, hasLegSegments, hasPositiveFrequency, removeLegSegmentsIn
-
-
-
-
Field Detail
-
orderedLegSegments
public final List<ServiceLegSegment> orderedLegSegments
Ordered list of leg segments for this trip from start to end (leg segments not owned)
-
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, boolean deepCopy)
Copy constructor- Parameters:
routedTripFrequencyImpl- to copydeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIdsin interfaceManagedId- Overrides:
recreateManagedIdsin classRoutedTripImpl- Parameters:
tokenId- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
shallowClone
public RoutedTripFrequencyImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein interfaceRoutedTrip- Specified by:
shallowClonein interfaceRoutedTripFrequency- Specified by:
shallowClonein classRoutedTripImpl- Returns:
- shallow copy of entity
-
deepClone
public RoutedTripFrequencyImpl 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- Specified by:
deepClonein interfaceIdAble- Specified by:
deepClonein interfaceRoutedTrip- Specified by:
deepClonein interfaceRoutedTripFrequency- Specified by:
deepClonein classRoutedTripImpl- Returns:
- deep copy of entity
-
clearLegs
public void clearLegs()
Clear all legs from the trip- Specified by:
clearLegsin interfaceRoutedTripFrequency
-
addLegSegment
public void addLegSegment(ServiceLegSegment legSegment)
Add a new leg segment (directed leg) to the end of the already registered legs.- Specified by:
addLegSegmentin interfaceRoutedTripFrequency- Parameters:
legSegment- to add to the trip's route
-
getFrequencyPerHour
public double getFrequencyPerHour()
Collect frequency per hour for this trip- Specified by:
getFrequencyPerHourin interfaceRoutedTripFrequency- Returns:
- frequencyPerHour
-
setFrequencyPerHour
public void setFrequencyPerHour(double frequencyPerHour)
Set the frequency per hour- Specified by:
setFrequencyPerHourin interfaceRoutedTripFrequency- Parameters:
frequencyPerHour- to use
-
removeLegSegment
public void removeLegSegment(int index)
Remove leg segment at given index from the instance- Specified by:
removeLegSegmentin interfaceRoutedTripFrequency- Parameters:
index- to remove
-
removeAllLegSegments
public void removeAllLegSegments()
Remove all service leg segments from the instance- Specified by:
removeAllLegSegmentsin interfaceRoutedTripFrequency
-
iterator
public Iterator<ServiceLegSegment> iterator()
- Specified by:
iteratorin interfaceIterable<ServiceLegSegment>
-
getNumberOfLegSegments
public int getNumberOfLegSegments()
Collect the number of registered leg segments- Specified by:
getNumberOfLegSegmentsin 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:
getLegSegmentin interfaceRoutedTripFrequency- Parameters:
index- to collect segment for- Returns:
- the leg segment found
-
getUsedServiceNodes
public Set<ServiceNode> getUsedServiceNodes()
Get all used service nodes along the trip- Specified by:
getUsedServiceNodesin interfaceRoutedTrip- Returns:
- used service nodes
-
-