org._3pq.jgrapht.edge
public class DefaultEdge extends java.lang.Object implements Edge, java.lang.Cloneable, java.io.Serializable
DEFAULT_EDGE_WEIGHT
Constructor and Description |
---|
DefaultEdge(java.lang.Object sourceVertex,
java.lang.Object targetVertex)
Constructor for DefaultEdge.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates and returns a shallow copy of this edge.
|
boolean |
containsVertex(java.lang.Object v)
Returns true if this edge contains the specified vertex.
|
java.lang.Object |
getSource()
Returns the source vertex of this edge.
|
java.lang.Object |
getTarget()
Returns the target vertex of this edge.
|
double |
getWeight()
Returns the weight of this edge.
|
java.lang.Object |
oppositeVertex(java.lang.Object v)
Returns the vertex opposite to the specified vertex.
|
void |
setWeight(double weight)
Sets the weight of this edge.
|
public DefaultEdge(java.lang.Object sourceVertex, java.lang.Object targetVertex)
sourceVertex
- source vertex of the edge.targetVertex
- target vertex of the edge.public java.lang.Object getSource()
Edge
getSource
in interface Edge
Edge.getSource()
public java.lang.Object getTarget()
Edge
getTarget
in interface Edge
Edge.getTarget()
public void setWeight(double weight)
Edge
UnsupportedOperationException
is thrown.setWeight
in interface Edge
weight
- new weight.Edge.setWeight(double)
public double getWeight()
Edge
1.0
is returned.getWeight
in interface Edge
Edge.getWeight()
public java.lang.Object clone()
Edge
clone
in interface Edge
clone
in class java.lang.Object
Edge.clone()
public boolean containsVertex(java.lang.Object v)
Edge
this.getSource().equals(v) || this.getTarget().equals(v)
containsVertex
in interface Edge
v
- vertex whose presence in this edge is to be tested.Edge.containsVertex(java.lang.Object)
public java.lang.Object oppositeVertex(java.lang.Object v)
Edge
oppositeVertex
in interface Edge
v
- the vertex whose opposite is required.Edge.oppositeVertex(java.lang.Object)