Package org.planit.utils.graph
Interface EdgeSegments<ES extends EdgeSegment>
-
- All Superinterfaces:
Iterable<ES>
- All Known Subinterfaces:
LinkSegments<LS>
- All Known Implementing Classes:
EdgeSegmentsImpl
,LinkSegmentsImpl
public interface EdgeSegments<ES extends EdgeSegment> extends Iterable<ES>
Container and factory class for edge segments in a graph, also to be used to create and register edge segments of any (derived) type- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ES
create(DirectedEdge parentEdge, boolean directionAB)
Create edge segmentES
get(long id)
Get edge segment by idES
getByXmlId(String xmlId)
Return an edge segment by its Xml iddefault boolean
isEmpty()
check if size is zerovoid
register(DirectedEdge parentEdge, ES edgeSegment, boolean directionAB)
Register a edge segment (not registered on nodes and edge)ES
registerNew(DirectedEdge parentEdge, boolean directionAb, boolean registerOnVertexAndEdge)
Create directional edge segment and register itES
registerUniqueCopyOf(ES edgeSegmentToCopy, DirectedEdge newParent)
copy the passed in edge segment and register it.void
remove(long edgeSegmentId)
Remove an edge segment by idvoid
remove(ES edgeSegment)
Remove an edges segmentlong
size()
Return number of registered edge segments-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
remove
void remove(ES edgeSegment)
Remove an edges segment- Parameters:
edgeSegment
- to remove
-
remove
void remove(long edgeSegmentId)
Remove an edge segment by id- Parameters:
edgeSegmentId
- to remove by id
-
create
ES create(DirectedEdge parentEdge, boolean directionAB) throws PlanItException
Create edge segment- Parameters:
parentEdge
- the parent edge of this edge segmentdirectionAB
- direction of travel- Returns:
- the created edge segment
- Throws:
PlanItException
- thrown if there is an error
-
register
void register(DirectedEdge parentEdge, ES edgeSegment, boolean directionAB) throws PlanItException
Register a edge segment (not registered on nodes and edge)- 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
-
registerNew
ES registerNew(DirectedEdge parentEdge, boolean directionAb, boolean registerOnVertexAndEdge) throws PlanItException
Create directional edge segment and register it- Parameters:
parentEdge
- the parent edge of this edge segmentdirectionAb
- direction of travelregisterOnVertexAndEdge
- option to register the new edge segment on the underlying edge and its vertices- Returns:
- the created edge segment
- Throws:
PlanItException
- thrown if there is an error
-
get
ES get(long id)
Get edge segment by id- Parameters:
id
- id of the edge segment- Returns:
- retrieved edge Segment
-
getByXmlId
ES getByXmlId(String xmlId)
Return an edge segment by its Xml id- Parameters:
xmlId
- the XML id of the edge segment- Returns:
- the specified edge segment instance
-
size
long size()
Return number of registered edge segments- Returns:
- number of registered edge segments
-
registerUniqueCopyOf
ES registerUniqueCopyOf(ES edgeSegmentToCopy, DirectedEdge newParent)
copy the passed in edge segment and register it.- Parameters:
edgeSegmentToCopy
- as is except for its ids which will be updated to make it uniquely identifiablenewParent
- update the parent edge to passed in edge- Returns:
- copy of edge segment now registered
-
isEmpty
default boolean isEmpty()
check if size is zero- Returns:
- true when empty, false otherwise
-
-