Package dev.roanh.gmark.util
Class SimpleGraph.SimpleEdge<T extends IDable,M>
java.lang.Object
dev.roanh.gmark.util.SimpleGraph.SimpleEdge<T,M>
- Type Parameters:
T
- The graph data type.M
- The metadata data type.
- Enclosing class:
- SimpleGraph<T extends IDable,
M>
Represents a single undirected edge between two nodes in the graph.
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
The cached hashcode for this edge.private M
The metadata stored at this edge.private final SimpleGraph.SimpleVertex<T,
M> The first end point of this edge.private final SimpleGraph.SimpleVertex<T,
M> The second end point of this edge. -
Constructor Summary
ModifierConstructorDescriptionprivate
SimpleEdge
(SimpleGraph.SimpleVertex<T, M> v1, SimpleGraph.SimpleVertex<T, M> v2) Constructs a new edge between the given two vertices. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the first end point vertex for this end.Gets the metadata stored at this edge.Gets the second end point vertex for this end.getTarget
(SimpleGraph.SimpleVertex<T, M> source) Gets the target vertex for this edge given the source vertex.int
hashCode()
void
setMetadata
(M meta) Sets the metadata stored at this edge.
-
Field Details
-
v1
The first end point of this edge. -
v2
The second end point of this edge. -
metadata
The metadata stored at this edge. -
hashcode
private int hashcodeThe cached hashcode for this edge.
-
-
Constructor Details
-
SimpleEdge
Constructs a new edge between the given two vertices.- Parameters:
v1
- The first end point of the edge.v2
- The second end point of the edge.
-
-
Method Details
-
getMetadata
Gets the metadata stored at this edge.- Returns:
- The metadata stored at this edge.
-
setMetadata
Sets the metadata stored at this edge.- Parameters:
meta
- The new metadata to store at this edge.
-
getFirstVertex
Gets the first end point vertex for this end.- Returns:
- The first vertex for this edge.
-
getSecondVertex
Gets the second end point vertex for this end.- Returns:
- The second vertex for this edge.
-
getTarget
Gets the target vertex for this edge given the source vertex. The given vertex is assumed to be one of the end point vertices of this edge and the returned vertex will be the other end point vertex of this edge.- Parameters:
source
- The source vertex to use to determine the target vertex.- Returns:
- The target vertex of this edge from the point of view of the source vertex.
-
equals
-
hashCode
public int hashCode()
-