|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.utils.UserData
edu.uci.ics.jung.graph.impl.AbstractSparseEdge
This class provides a skeletal implementation of the Edge
interface to minimize the effort required to implement this interface.
It is appropriate for sparse graphs (those in which each vertex
is connected to only a few other vertices); for dense graphs (those in
which each vertex is connected to most other vertices), another
implementation might be more appropriate.
This class extends UserData
, which provides storage and
retrieval mechanisms for user-defined data for each edge instance.
This allows users to attach data to edges without having to extend
this class.
AbstractSparseGraph
,
AbstractSparseVertex
Nested Class Summary |
Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer |
UserDataContainer.CopyAction |
Field Summary |
Fields inherited from class edu.uci.ics.jung.utils.UserData |
CLONE, REMOVE, SHARED |
Constructor Summary | |
AbstractSparseEdge(Vertex from,
Vertex to)
Creates an edge connecting vertices from and
to . |
Method Summary | |
ArchetypeEdge |
copy(ArchetypeGraph newGraph)
Creates a copy of this edge in the specified graph nGraph ,
and copies this edge's user data to the new edge. |
boolean |
equals(java.lang.Object o)
Returns true if o is an instance of
ArchetypeEdge that is equivalent to this edge.
|
Pair |
getEndpoints()
Returns a pair consisting of both incident vertices. |
ArchetypeEdge |
getEqualEdge(ArchetypeGraph ag)
Returns the edge in graph g , if any,
that is equivalent to this edge.
|
ArchetypeEdge |
getEquivalentEdge(ArchetypeGraph ag)
Deprecated. As of version 1.4, renamed to getEqualEdge(ag). |
ArchetypeGraph |
getGraph()
Returns a reference to the graph that contains this edge. |
java.util.Set |
getIncidentVertices()
Returns the set of vertices which are incident to this edge. |
Vertex |
getOpposite(Vertex vertex)
Returns the vertex at the opposite end of this edge from the specified vertex v . |
int |
hashCode()
|
boolean |
isIncident(ArchetypeVertex v)
Returns true if the specified vertex v
is incident to this edge, and false otherwise.
|
int |
numVertices()
Returns the number of vertices which are incident to this edge. |
java.lang.String |
toString()
Returns a human-readable representation of this edge. |
Methods inherited from class edu.uci.ics.jung.utils.UserData |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
Constructor Detail |
public AbstractSparseEdge(Vertex from, Vertex to)
from
and
to
. The order of the arguments is significant for
implementations of
DirectedEdge
which extend this class, and is not
significant for implementations of UndirectedEdge
which extend this class.
Disallows the following:
from to
vertex to
)
IllegalArgumentException
to
be thrown.
from
- one incident vertex (if edge is directed, the source)to
- the other incident vertex (if edge is directed, the destination)
java.lang.IllegalArgumentException
Method Detail |
public java.lang.String toString()
toString
in class UserData
Object.toString()
public ArchetypeGraph getGraph()
ArchetypeEdge
getGraph
in interface ArchetypeEdge
ArchetypeEdge.getGraph()
public java.util.Set getIncidentVertices()
ArchetypeEdge
ArchetypeVertex
.
For example, returns the source and destination vertices of a
directed edge.
getIncidentVertices
in interface ArchetypeEdge
ArchetypeEdge.getIncidentVertices()
public Vertex getOpposite(Vertex vertex)
Edge
v
. Throws
IllegalArgumentException
if v
is
not incident to this edge.
For example, if this edge connects vertices a
and
b
, this.getOpposite(a)
returns
b
.
getOpposite
in interface Edge
Edge.getOpposite(Vertex)
public ArchetypeEdge getEqualEdge(ArchetypeGraph ag)
ArchetypeEdge
g
, if any,
that is equivalent to this edge.
Two edges are equivalent if one of them is an ancestor
(via copy()
) of the other.
getEqualEdge
in interface ArchetypeEdge
ArchetypeEdge.getEqualEdge(edu.uci.ics.jung.graph.ArchetypeGraph)
public ArchetypeEdge getEquivalentEdge(ArchetypeGraph ag)
getEquivalentEdge
in interface ArchetypeEdge
public int hashCode()
Object.hashCode()
public boolean equals(java.lang.Object o)
true
if o
is an instance of
ArchetypeEdge
that is equivalent to this edge.
Respects the edge
equivalences which are established by copy()
and
referenced by getEquivalentEdge()
.
Object.equals(java.lang.Object)
,
ArchetypeEdge.getEqualEdge(ArchetypeGraph)
,
ArchetypeEdge.copy(edu.uci.ics.jung.graph.ArchetypeGraph)
public int numVertices()
ArchetypeEdge
numVertices
in interface ArchetypeEdge
ArchetypeEdge.numVertices()
public boolean isIncident(ArchetypeVertex v)
ArchetypeEdge
true
if the specified vertex v
is incident to this edge, and false
otherwise.
The behavior of this method is undefined if v
is not
an element of this edge's graph.
isIncident
in interface ArchetypeEdge
ArchetypeEdge.isIncident(ArchetypeVertex)
public ArchetypeEdge copy(ArchetypeGraph newGraph)
nGraph
,
and copies this edge's user data to the new edge.
copy
in interface ArchetypeEdge
newGraph
- the graph in which the copied edge will be placed
ArchetypeEdge.copy(edu.uci.ics.jung.graph.ArchetypeGraph)
public Pair getEndpoints()
Edge
getEndpoints
in interface Edge
Edge.getEndpoints()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |