|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.graph.Edge
public class Edge
A graph edge. Includes the from and to nodes, an arbitrary user object, and a weight. Edges can be either directed or undirected.
Field Summary | |
---|---|
static int |
TYPE_BACK
An edge (u, v) is a back edge if it creates a cycle back to an ancestor in the graph. |
static int |
TYPE_FORWARD
An edge (u, v) is a forward edge if it is not a tree or back edge. |
static int |
TYPE_TREE
An edge (u, v) is a tree edge if node v was first discovered by traversing the edge. |
Constructor Summary | |
---|---|
Edge(Object from,
Object to,
boolean directed)
Constructor. |
|
Edge(Object from,
Object to,
boolean directed,
Object userObject)
Constructor. |
Method Summary | |
---|---|
void |
clearTraversal()
Clear traversal info. |
List<Edge> |
getCycle()
List of edges forming a cycle. |
Object |
getFrom()
Return the node the edge links from. |
Object |
getOther(Object node)
Return the node on the opposite end of the given one, or null if the given node is not part of this edge. |
Object |
getTo()
Return the node the edge links to. |
int |
getType()
Traversal bookkeeping info. |
Object |
getUserObject()
Arbitrary user object associated with the edge. |
double |
getWeight()
Return the weight of the edge. |
boolean |
isDirected()
Return whether the edge is directed. |
boolean |
isFrom(Object node)
Return true if this edge links from the given node. |
boolean |
isRemovedFromGraph()
Returns if this edge is (still) part of the graph. |
boolean |
isTo(Object node)
Return true if this edge links to the given node. |
void |
setCycle(List<Edge> cycle)
List of edges forming a cycle. |
void |
setRemovedFromGraph()
Mark this edge as removed from the graph. |
void |
setType(int type)
Traversal bookkeeping info. |
void |
setUserObject(Object obj)
Arbitrary user object associated with the edge. |
void |
setWeight(double weight)
Set the weight of the edge. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_TREE
public static final int TYPE_BACK
public static final int TYPE_FORWARD
Constructor Detail |
---|
public Edge(Object from, Object to, boolean directed)
from
- the node the edge comes fromto
- the node the edge goes todirected
- whether the edge is directedpublic Edge(Object from, Object to, boolean directed, Object userObject)
from
- the node the edge comes fromto
- the node the edge goes todirected
- whether the edge is directeduserObject
- an associated objectMethod Detail |
---|
public Object getFrom()
public Object getTo()
public Object getOther(Object node)
public boolean isTo(Object node)
public boolean isFrom(Object node)
public boolean isDirected()
public double getWeight()
public void setWeight(double weight)
public Object getUserObject()
public void setUserObject(Object obj)
public int getType()
public void setType(int type)
public List<Edge> getCycle()
public void setCycle(List<Edge> cycle)
public boolean isRemovedFromGraph()
public void setRemovedFromGraph()
public void clearTraversal()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |