|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.utils.UserDataDelegate
edu.uci.ics.jung.graph.impl.AbstractElement
edu.uci.ics.jung.graph.impl.AbstractArchetypeEdge
edu.uci.ics.jung.graph.impl.AbstractSparseEdge
public abstract class 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/interfaces inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
|---|
UserDataContainer.CopyAction |
| Field Summary | |
|---|---|
protected Vertex |
mFrom
One of the two incident vertices of this edge. |
protected Vertex |
mTo
One of the two incident vertices of this edge. |
| Fields inherited from class edu.uci.ics.jung.graph.impl.AbstractElement |
|---|
id, m_Graph |
| Fields inherited from class edu.uci.ics.jung.utils.UserDataDelegate |
|---|
factory, udc_delegate |
| 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 newGraph,
and copies this edge's user data to the new edge. |
Pair |
getEndpoints()
Returns a pair consisting of both incident vertices. |
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. |
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. |
String |
toString()
Returns a human-readable representation of this edge. |
| Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeEdge |
|---|
equals, getEqualEdge, getEquivalentEdge, getIncidentElements |
| Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractElement |
|---|
addGraph_internal, getGraph, hashCode, initialize, removeGraph_internal |
| Methods inherited from class edu.uci.ics.jung.utils.UserDataDelegate |
|---|
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDataFactory, setUserDatum |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeEdge |
|---|
getEqualEdge, getEquivalentEdge |
| Methods inherited from interface edu.uci.ics.jung.graph.Element |
|---|
getGraph, getIncidentElements |
| Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
|---|
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
| Field Detail |
|---|
protected Vertex mFrom
protected Vertex mTo
| 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)
IllegalArgumentException| Method Detail |
|---|
public String toString()
toString in class ObjectObject.toString()public Set getIncidentVertices()
ArchetypeEdgeArchetypeVertex.
For example, returns the source and destination vertices of a
directed edge.
getIncidentVertices in interface ArchetypeEdgeArchetypeEdge.getIncidentVertices()public Vertex getOpposite(Vertex vertex)
Edgev. 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 EdgeEdge.getOpposite(Vertex)public int numVertices()
ArchetypeEdge
numVertices in interface ArchetypeEdgenumVertices in class AbstractArchetypeEdgeArchetypeEdge.numVertices()public boolean isIncident(ArchetypeVertex v)
ArchetypeEdgetrue 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 ArchetypeEdgeisIncident in class AbstractArchetypeEdgeArchetypeEdge.isIncident(ArchetypeVertex)public ArchetypeEdge copy(ArchetypeGraph newGraph)
newGraph,
and copies this edge's user data to the new edge.
copy in interface ArchetypeEdgecopy in class AbstractArchetypeEdgenewGraph - 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 EdgeEdge.getEndpoints()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||