|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.DefaultNode
public class DefaultNode
A simple graph node that is a default implementation of Node.
Node,
Edge| Nested Class Summary | |
|---|---|
protected static class |
DefaultNode.OrderedHashMap
HashMap that keeps an ordered list of its keys. |
| Field Summary | |
|---|---|
protected java.util.ArrayList |
inEdges
A list of the edges into this Node. |
protected DefaultNode.OrderedHashMap |
inMap
A Map of nodes whose edges are into this Node. |
protected java.lang.String |
label
|
protected java.util.ArrayList |
outEdges
A list of the edges out of this Node. |
protected DefaultNode.OrderedHashMap |
outMap
A Map of nodes whose edges are out of this Node. |
| Constructor Summary | |
|---|---|
DefaultNode()
Creates a DefaultNode with a blank label. |
|
DefaultNode(java.lang.String label)
Creates a DefaultNode with the specified string as its label. |
|
| Method Summary | |
|---|---|
void |
addInEdge(Edge edge)
Adds an in Edge to this DefaultNode. |
void |
addInEdges(java.util.Collection edges)
Adds in edges. |
void |
addOutEdge(Edge edge)
Adds an out Edge to this DefaultNode |
void |
addOutEdges(java.util.Collection edges)
Adds out edges. |
void |
clearInEdges()
Clears (removes) all the in edges. |
void |
clearOutEdges()
Clears (removes) all the out edges. |
java.util.HashSet |
getEdgesFrom(Node node)
Returns the Edges from the specified Node to this Node. |
java.util.HashSet |
getEdgesTo(Node node)
Returns the Edges from this Node to the specified Node. |
java.util.ArrayList |
getFromNodes()
Gets all of the Nodes that this DefaultNode has an edge from. |
java.lang.Object |
getId()
Gets a unique id for this node. |
int |
getInDegree()
Gets the in degree of this DefaultNode. |
java.util.ArrayList |
getInEdges()
Gets the ArrayList of edges into this node. |
java.util.ArrayList |
getInNodes()
Gets all of the Nodes that this DefaultNode has an edge from. |
Node |
getNode()
Deprecated. No longer part of the Node interface so not necessary |
java.lang.String |
getNodeLabel()
Gets the label for this node. |
int |
getNumInEdges()
Returns the number of in edges contained by the Node. |
int |
getNumOutEdges()
Returns the number of out edges contained by the Node. |
int |
getOutDegree()
Gets the out degree of this DefaultNode. |
java.util.ArrayList |
getOutEdges()
Gets the ArrayList of Edge out of this node. |
java.util.ArrayList |
getOutNodes()
Gets all of the Nodes that this DefaultNode has an edge to. |
Node |
getRandomFromNode()
Gets a node at random from the list of nodes that this node has an edge from. |
Node |
getRandomNodeIn()
Gets a node at random from the list of in edges. |
Node |
getRandomNodeOut()
Gets a node at random from the list of out edges. |
Node |
getRandomToNode()
Gets a node at random from the list of nodes that this node has an edge to. |
java.util.ArrayList |
getToNodes()
Gets all of the Nodes that this DefaultNode has an edge to. |
boolean |
hasEdgeFrom(Node node)
Returns true if this DefaultNode has an Edge from the specified Node, otherwise false. |
boolean |
hasEdgeTo(Node node)
Returns true if this DefaultNode has an Edge to the specified Node, otherwise false. |
boolean |
hasEdgeToOrFrom(Node node)
Does this Node have an edge to or from the specified node. |
Edge |
makeRandomInEdge(java.util.List list,
Edge edge,
boolean allowSelfLoops)
Creates an in edge to this node from a randomly chosen node in the specified list using the specified edge. |
Edge |
makeRandomOutEdge(java.util.List list,
Edge edge,
boolean allowSelfLoops)
Creates an out edge from this node to a randomly chosen node in the specified list using the specified edge. |
void |
removeEdgesFrom(Node node)
Removes all the edges that link to this Node from the specified node. |
void |
removeEdgesTo(Node node)
Removes all the edges that link from this Node to the specified node. |
void |
removeInEdge(Edge edge)
Removes the specified edge from the list of "in" edges. |
void |
removeOutEdge(Edge edge)
Removes the specified edge from the list of "out" edges. |
void |
setNodeLabel(java.lang.String label)
Sets the label for this node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.ArrayList inEdges
protected DefaultNode.OrderedHashMap inMap
protected java.util.ArrayList outEdges
protected DefaultNode.OrderedHashMap outMap
protected java.lang.String label
| Constructor Detail |
|---|
public DefaultNode()
public DefaultNode(java.lang.String label)
label - the label for this node| Method Detail |
|---|
public java.lang.Object getId()
getId in interface Nodepublic java.lang.String getNodeLabel()
getNodeLabel in interface Nodepublic void setNodeLabel(java.lang.String label)
setNodeLabel in interface Nodepublic java.util.ArrayList getInEdges()
getInEdges in interface Nodepublic java.util.ArrayList getOutEdges()
getOutEdges in interface Nodepublic java.util.ArrayList getFromNodes()
public java.util.ArrayList getToNodes()
public java.util.ArrayList getOutNodes()
public java.util.ArrayList getInNodes()
public boolean hasEdgeToOrFrom(Node node)
node - the node to check if this DefaultNode contains an edge to.public void addInEdge(Edge edge)
addInEdge in interface Nodeedge - the "in" edge to addpublic void addOutEdge(Edge edge)
addOutEdge in interface Nodeedge - the "out" edge to addpublic void addOutEdges(java.util.Collection edges)
public void addInEdges(java.util.Collection edges)
public void clearInEdges()
clearInEdges in interface Nodepublic void clearOutEdges()
clearOutEdges in interface Nodepublic void removeInEdge(Edge edge)
removeInEdge in interface Nodeedge - the edge to removepublic void removeOutEdge(Edge edge)
removeOutEdge in interface Nodeedge - the edge to removepublic Node getNode()
public Node getRandomNodeOut()
public Node getRandomNodeIn()
public Node getRandomFromNode()
public Node getRandomToNode()
public void removeEdgesTo(Node node)
public void removeEdgesFrom(Node node)
public Edge makeRandomOutEdge(java.util.List list,
Edge edge,
boolean allowSelfLoops)
list - the list of nodes to create the Edge to.edge - the edge to use as the linkallowSelfLoops - if true then self loops are allowed. If not the
self loops are disallowed.
public Edge makeRandomInEdge(java.util.List list,
Edge edge,
boolean allowSelfLoops)
list - the list of nodes to create the Edge from.edge - the edge to use as the linkallowSelfLoops - if true then self loops are allowed. If not the
self loops are disallowed.public int getNumOutEdges()
public int getNumInEdges()
public boolean hasEdgeTo(Node node)
hasEdgeTo in interface Nodepublic boolean hasEdgeFrom(Node node)
hasEdgeFrom in interface Nodepublic int getOutDegree()
public int getInDegree()
public java.util.HashSet getEdgesTo(Node node)
public java.util.HashSet getEdgesFrom(Node node)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||