edu.uci.ics.jung.graph.impl
Class AbstractArchetypeEdge
java.lang.Object
edu.uci.ics.jung.utils.UserDataDelegate
edu.uci.ics.jung.graph.impl.AbstractElement
edu.uci.ics.jung.graph.impl.AbstractArchetypeEdge
- All Implemented Interfaces:
- ArchetypeEdge, Element, UserDataContainer, Cloneable
- Direct Known Subclasses:
- AbstractHyperedge, AbstractSparseEdge
public abstract class AbstractArchetypeEdge
- extends AbstractElement
- implements ArchetypeEdge
- Author:
- Joshua O'Madadhain
AbstractArchetypeEdge
public AbstractArchetypeEdge()
getIncidentElements
public Set getIncidentElements()
- Description copied from interface:
Element
- Returns the set of elements that are incident to this element.
For a vertex this corresponds to returning the vertex's incident
edges; for an edge this corresponds to returning the edge's incident
vertices.
- Specified by:
getIncidentElements
in interface Element
getEqualEdge
public ArchetypeEdge getEqualEdge(ArchetypeGraph ag)
- Description copied from interface:
ArchetypeEdge
- Returns the edge in graph
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.
- Specified by:
getEqualEdge
in interface ArchetypeEdge
- See Also:
ArchetypeEdge.getEqualEdge(edu.uci.ics.jung.graph.ArchetypeGraph)
getEquivalentEdge
public ArchetypeEdge getEquivalentEdge(ArchetypeGraph ag)
- Deprecated. As of version 1.4, renamed to getEqualEdge(ag).
- Specified by:
getEquivalentEdge
in interface ArchetypeEdge
numVertices
public int numVertices()
- Description copied from interface:
ArchetypeEdge
- Returns the number of vertices which are incident to this edge.
- Specified by:
numVertices
in interface ArchetypeEdge
- See Also:
ArchetypeEdge.numVertices()
isIncident
public boolean isIncident(ArchetypeVertex v)
- Description copied from interface:
ArchetypeEdge
- Returns
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.
- Specified by:
isIncident
in interface ArchetypeEdge
- See Also:
ArchetypeEdge.isIncident(edu.uci.ics.jung.graph.ArchetypeVertex)
copy
public ArchetypeEdge copy(ArchetypeGraph g)
- Description copied from interface:
ArchetypeEdge
- Creates a copy of this edge in graph
g
. The edge created
will be equivalent to this edge: given e = this.copy(g)
,
then this.getEquivalentEdge(g) == e
,
and this.equals(e) == true
.
Given the set
of vertices S that are incident to this edge, the copied edge will be
made incident to the set of vertices S' in g
that are
equivalent to S. S must be copied into g
before
this edge can be copied into g
. If there is no
such set of vertices in g
,
this method throws IllegalArgumentException
.
Thus, for example, given the following code:
Graph g1 = new Graph();
Vertex v1 = g1.addVertex(new DirectedSparseVertex());
Vertex v2 = g1.addVertex(new DirectedSparseVertex());
...
Edge e = g1.addEdge(new DirectedSparseEdge(v1, v2));
Vertex v3 = v1.getEquivalentVertex(g2);
Vertex v4 = v2.getEquivalentVertex(g2);
then e.copy(g2)
will create a directed edge
connecting v3
to v4
in g2
.
- Specified by:
copy
in interface ArchetypeEdge
- Parameters:
g
- the graph in which the copied edge will be placed
- Returns:
- the edge created
- See Also:
ArchetypeEdge.copy(edu.uci.ics.jung.graph.ArchetypeGraph)
equals
public boolean equals(Object o)
- Returns
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()
.
- Overrides:
equals
in class Object
- See Also:
Object.equals(java.lang.Object)
,
ArchetypeEdge.getEqualEdge(ArchetypeGraph)
,
ArchetypeEdge.copy(edu.uci.ics.jung.graph.ArchetypeGraph)