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()
EdgegetSource in interface EdgeEdge.getSource()public java.lang.Object getTarget()
EdgegetTarget in interface EdgeEdge.getTarget()public void setWeight(double weight)
EdgeUnsupportedOperationException is thrown.setWeight in interface Edgeweight - new weight.Edge.setWeight(double)public double getWeight()
Edge1.0 is returned.getWeight in interface EdgeEdge.getWeight()public java.lang.Object clone()
Edgeclone in interface Edgeclone in class java.lang.ObjectEdge.clone()public boolean containsVertex(java.lang.Object v)
Edge
this.getSource().equals(v) || this.getTarget().equals(v)
containsVertex in interface Edgev - vertex whose presence in this edge is to be tested.Edge.containsVertex(java.lang.Object)public java.lang.Object oppositeVertex(java.lang.Object v)
EdgeoppositeVertex in interface Edgev - the vertex whose opposite is required.Edge.oppositeVertex(java.lang.Object)