Package org.planit.utils.graph
Interface Edges<E extends Edge>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description E
get(long id)
Get edge by idboolean
isEmpty()
Check if is emptydefault E
registerNew(Vertex vertexA, Vertex vertexB, double length)
Create new edge to graph identified via its id, (not registered on vertices)E
registerNew(Vertex vertexA, Vertex vertexB, double length, boolean registerOnVertices)
Create new edge to network identified via its id, allow to be registered on vertices if indicated)E
registerUniqueCopyOf(E edgeToCopy)
copy the passed in edge and register itvoid
remove(long edgeId)
remove an edge.void
remove(E edge)
remove an edge.int
size()
Get the number of edges in the graph-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
remove
void remove(E edge)
remove an edge.- Parameters:
edge
- to remove
-
remove
void remove(long edgeId)
remove an edge.- Parameters:
edgeId
- of the edge to remove
-
registerNew
default E registerNew(Vertex vertexA, Vertex vertexB, double length) throws PlanItException
Create new edge to graph identified via its id, (not registered on vertices)- Parameters:
vertexA
- the first vertex of this edgevertexB
- the second vertex of this edgelength
- the length (in km)- Returns:
- the created edge
- Throws:
PlanItException
- thrown if there is an error
-
registerNew
E registerNew(Vertex vertexA, Vertex vertexB, double length, boolean registerOnVertices) throws PlanItException
Create new edge to network identified via its id, allow to be registered on vertices if indicated)- Parameters:
vertexA
- the first vertex in this edgevertexB
- the second certex in this edgelength
- the length of this edgeregisterOnVertices
- choice to register new edge on the vertices or not- Returns:
- the created edge
- Throws:
PlanItException
- thrown if there is an error
-
registerUniqueCopyOf
E registerUniqueCopyOf(E edgeToCopy)
copy the passed in edge and register it- Parameters:
edgeToCopy
- as is except for its ids which will be updated to makeit uniquely identifiable- Returns:
- copy of edge now registered
-
get
E get(long id)
Get edge by id- Parameters:
id
- the id of the edge- Returns:
- the retrieved edge, null if not present
-
size
int size()
Get the number of edges in the graph- Returns:
- the number of edges in the graph
-
isEmpty
boolean isEmpty()
Check if is empty- Returns:
- true when no edges, false otherwise
-
-