Package org.goplanit.graph.directed
Class EdgeSegmentsImpl
- java.lang.Object
-
- org.goplanit.utils.wrapper.MapWrapperImpl<Long,V>
-
- org.goplanit.utils.wrapper.LongMapWrapperImpl<E>
-
- org.goplanit.utils.graph.GraphEntitiesImpl<EdgeSegment>
-
- org.goplanit.graph.directed.EdgeSegmentsImpl
-
- All Implemented Interfaces:
Cloneable,Iterable<EdgeSegment>,EdgeSegments,GraphEntities<EdgeSegment>,LongMapWrapper<EdgeSegment>,MapWrapper<Long,EdgeSegment>
public class EdgeSegmentsImpl extends GraphEntitiesImpl<EdgeSegment> implements EdgeSegments
Implementation of EdgeSegments interface.- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description EdgeSegmentsImpl(EdgeSegmentsImpl other, boolean deepCopy, BiConsumer<EdgeSegment,EdgeSegment> biConsumer)Copy constructor, also creates a new factory with reference to this containerEdgeSegmentsImpl(IdGroupingToken groupId)ConstructorEdgeSegmentsImpl(IdGroupingToken groupId, EdgeSegmentFactory edgeSegmentFactory)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeSegmentsImpldeepClone()Deep clone implementationEdgeSegmentsImpldeepCloneWithMapping(BiConsumer<EdgeSegment,EdgeSegment> mapper)Deep clone implementation with mapping retained between original and copies createdEdgeSegmentFactorygetFactory()Collect the edge segment factory to use for creating instancesvoidregister(DirectedEdge parentEdge, EdgeSegment edgeSegment, boolean directionAB)Register a edge segment (not registered on nodes and edge)EdgeSegmentsImplshallowClone()Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created-
Methods inherited from class org.goplanit.utils.graph.GraphEntitiesImpl
getByXmlId
-
Methods inherited from class org.goplanit.utils.wrapper.LongMapWrapperImpl
containsKey, get, remove
-
Methods inherited from class org.goplanit.utils.wrapper.MapWrapperImpl
clear, containsValue, createEmptyInstance, firstMatch, get, getKeyByValue, getMap, getValueToKey, isEmpty, iterator, register, remove, removeIf, setMap, size, toCollection, valuesAsNewSet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.graph.GraphEntities
forEachMatchingIdIn, getByExternalId, getByXmlId
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.wrapper.LongMapWrapper
containsKey, get, remove
-
Methods inherited from interface org.goplanit.utils.wrapper.MapWrapper
addAll, clear, containsValue, firstMatch, forEachIn, get, getFirst, getKeyByValue, isEmpty, register, remove, removeAll, removeIf, size, stream, streamSorted, toCollection, toMap, valuesAsNewSet
-
-
-
-
Constructor Detail
-
EdgeSegmentsImpl
public EdgeSegmentsImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- to use for creating ids for instances
-
EdgeSegmentsImpl
public EdgeSegmentsImpl(IdGroupingToken groupId, EdgeSegmentFactory edgeSegmentFactory)
Constructor- Parameters:
groupId- to use for creating ids for instancesedgeSegmentFactory- to use
-
EdgeSegmentsImpl
public EdgeSegmentsImpl(EdgeSegmentsImpl other, boolean deepCopy, BiConsumer<EdgeSegment,EdgeSegment> biConsumer)
Copy constructor, also creates a new factory with reference to this container- Parameters:
other- top copydeepCopy- when true, create a deep copy, shallow copy otherwisebiConsumer- when deepCopy applied to each original and copy, may be null
-
-
Method Detail
-
register
public void register(DirectedEdge parentEdge, EdgeSegment edgeSegment, boolean directionAB) throws PlanItException
Register a edge segment (not registered on nodes and edge)- Specified by:
registerin interfaceEdgeSegments- Parameters:
parentEdge- the parent edge which specified edge segment will be registered onedgeSegment- edge segment to be registereddirectionAB- direction of travel- Throws:
PlanItException- thrown if there is an error
-
getFactory
public EdgeSegmentFactory getFactory()
Collect the edge segment factory to use for creating instances- Specified by:
getFactoryin interfaceEdgeSegments- Specified by:
getFactoryin interfaceGraphEntities<EdgeSegment>- Returns:
- edgeSegmentFactory to create edge segments for this container
-
shallowClone
public EdgeSegmentsImpl shallowClone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created- Specified by:
shallowClonein interfaceEdgeSegments- Specified by:
shallowClonein interfaceGraphEntities<EdgeSegment>- Specified by:
shallowClonein interfaceMapWrapper<Long,EdgeSegment>- Specified by:
shallowClonein classGraphEntitiesImpl<EdgeSegment>- Returns:
- copy
-
deepClone
public EdgeSegmentsImpl deepClone()
Deep clone implementation- Specified by:
deepClonein interfaceEdgeSegments- Specified by:
deepClonein interfaceGraphEntities<EdgeSegment>- Specified by:
deepClonein classGraphEntitiesImpl<EdgeSegment>- Returns:
- deep copy of entities
-
deepCloneWithMapping
public EdgeSegmentsImpl deepCloneWithMapping(BiConsumer<EdgeSegment,EdgeSegment> mapper)
Deep clone implementation with mapping retained between original and copies created- Specified by:
deepCloneWithMappingin interfaceGraphEntities<EdgeSegment>- Specified by:
deepCloneWithMappingin classGraphEntitiesImpl<EdgeSegment>- Parameters:
mapper- that is applied to each deep copy entity mapping pair of origin and copy- Returns:
- pair with deep copy of entities and mapping from original entities to deep copies of these entities
-
-