Package org.goplanit.path
Class DirectedPathImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.path.DirectedPathImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,Iterable<EdgeSegment>
,ExternalIdAble
,IdAble
,ManagedId
,DirectedPath
public class DirectedPathImpl extends ExternalIdAbleImpl implements DirectedPath
This object represents a path based on a number of consecutive LinkSegments The path creation makes use of the fact that the origin pair will have a null EdgeSegment, so there is no need to specify the origin.- Author:
- gman6028, markr
-
-
Field Summary
-
Fields inherited from interface org.goplanit.utils.path.DirectedPath
PATH_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DirectedPathImpl(IdGroupingToken groupId)
Constructorprotected
DirectedPathImpl(IdGroupingToken groupId, Deque<? extends EdgeSegment> pathEdgeSegments)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsSubPath(Collection<? extends EdgeSegment> subPath)
Verify if the path contains the provided subpath.protected static long
generateId(IdGroupingToken groupId)
Generate an id for this instanceIterator<EdgeSegment>
iterator()
long
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idlong
size()
The size of the path is given by the number of edge segments it holds-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
clone, 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.path.DirectedPath
getIdClass, isEmpty
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
clone, compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
-
-
-
Constructor Detail
-
DirectedPathImpl
protected DirectedPathImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this class
-
DirectedPathImpl
protected DirectedPathImpl(IdGroupingToken groupId, Deque<? extends EdgeSegment> pathEdgeSegments)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classpathEdgeSegments
- the path to set (not copied)
-
-
Method Detail
-
generateId
protected static long generateId(IdGroupingToken groupId)
Generate an id for this instance- Parameters:
groupId
- to use- Returns:
- created id
-
iterator
public Iterator<EdgeSegment> iterator()
- Specified by:
iterator
in interfaceIterable<EdgeSegment>
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Parameters:
tokenId
- to use- Returns:
- the updated internal id
-
size
public long size()
The size of the path is given by the number of edge segments it holds- Specified by:
size
in interfaceDirectedPath
- Returns:
- size
-
containsSubPath
public boolean containsSubPath(Collection<? extends EdgeSegment> subPath)
Verify if the path contains the provided subpath. It is only a subpath of the subpath is present continguously- Specified by:
containsSubPath
in interfaceDirectedPath
- Parameters:
subPath
- to verify- Returns:
- true when it contains the subpath, false otherwise.
-
-