|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.graphs.Node
A single Node in a Graph, as well as the adjacency list of inlinks (what other Nodes are connected to this Node) and outlinks (what other Nodes can we get to from this Node).
The inlink weight is the negative of the actual outlink weight. For example, if the weight from A to B were 1, then from B to A is -1.
Assumes a simple Graph (one that does not have multiple edges between two nodes).
Also assumes that no two Nodes will have the same name.
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Nov 24 1997, JH Created class - GUIRLib-v1.0-1.1.0, Feb 24 2000, JH Updated for JDK1.3RC1 to use the Collections - GUIRLib-v1.2-1.1.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.1.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.1.0, Aug 31 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.1.1, Oct 07 2000, JH Changed addInLink() and addOutLink() from package to protected
Fields inherited from interface edu.berkeley.guir.lib.graphs.GraphConst |
DEFAULT_NUMBER_EDGES, DEFAULT_NUMBER_NODES, DEFAULT_PATH_SIZE, DEFAULT_WEIGHT, ERROR, TRUE |
Constructor Summary | |
protected |
Node()
Creates a new and empty Node. |
|
Node(String strName)
Create a new Node with the specified name. |
Method Summary | |
protected void |
addInlink(String strNodeToName)
Add a Node connected to this Node by an in link. |
protected void |
addInlink(String strNodeToName,
float weight)
Add a Node connected to this Node by an in link. |
protected void |
addOutlink(String strNodeToName)
Add a Node connected to this Node by an out link. |
protected void |
addOutlink(String strNodeToName,
float weight)
Add a Node connected to this Node by an out link. |
Object |
clone()
Clones this Node. |
boolean |
equals(Object obj)
|
int |
getInDegree()
Get the number of edges that come into this Node. |
Iterator |
getInlinks()
Get an Iteration of the names of the Nodes that can get to this Node (that is, the Nodes connected by inlinks into this Node). |
float |
getInlinkWeight(String strName)
Return the weight of a Node connected by an in link. |
String |
getName()
Get the name of the source node. |
int |
getOutDegree()
Get the number of edges that come out of this Node. |
Iterator |
getOutlinks()
Get an Iteration of the names of the Nodes you can get to from this Node (that is, the Nodes connected by outlinks from this Node). |
float |
getOutlinkWeight(String strName)
Return the weight of a Node connected by an out link. |
boolean |
hasInlinkFrom(String strName)
See if the given node is adjacent to the source Node by an out link. |
boolean |
hasOutlinkTo(String strName)
See if the given node is adjacent to the source Node by an out link. |
static void |
setDefaultNumberEdges(int edges)
Sets the default number of edges in the Adjacency List of each Node. |
void |
setName(String strName)
Set the name for this Node. |
static void |
setPrintLinks(boolean flag)
Set the flag for whether or not method toString() should print out the inlinks and outlinks for this Node. |
String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Node()
public Node(String strName)
strName
- is the name of the Node to create an Adjacency list.Method Detail |
public static void setDefaultNumberEdges(int edges)
iNumEdges
- is the number of edges, and must be greater than the
default number of edges. If it is less, then it will revert to
the default number of edges. Ignores negative values.public static void setPrintLinks(boolean flag)
flag
- is true if the links should be printed, false otherwise.public String getName()
public Iterator getOutlinks()
public Iterator getInlinks()
public int getInDegree()
public int getOutDegree()
public boolean hasOutlinkTo(String strName)
strName
- is the name of the Node to check if it is connected.public boolean hasInlinkFrom(String strName)
strName
- is the name of the Node to check if it is connected.public float getOutlinkWeight(String strName)
strName
- is the name of the Node to check for adjacency.public float getInlinkWeight(String strName)
The inlink weight is the negative of the actual outlink weight. For example, if the weight from A to B were 1, then from B to A is -1.
strName
- is the name of the Node to check for adjacency.public void setName(String strName)
strName
- is the name of the Node to set to.protected void addOutlink(String strNodeToName)
The weight of the edge is defaulted to GraphConst.DEFAULT_WEIGHT. Use this method if you don't really care about the weight of the edge.
strToNodeName
- is the name of the adjacent Node.GraphConst
protected void addOutlink(String strNodeToName, float weight)
nodeTo
- is the adjacent Node to add.weight
- is the weight of this edge. weight can be negative.protected void addInlink(String strNodeToName)
The weight of the edge is defaulted to GraphConst.DEFAULT_WEIGHT. Use this method if you don't really care about the weight of the edge.
strToNodeName
- is the name of the adjacent Node.GraphConst
protected void addInlink(String strNodeToName, float weight)
The weight of this inlink should be the negative of the outlink. For example, if the weight from A to B were 1, then from B to A is -1.
nodeTo
- is the adjacent Node to add.weight
- is the weight of this edge. weight can be negative.public String toString()
toString
in class Object
public Object clone()
clone
in class Object
public boolean equals(Object obj)
equals
in class Object
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |