|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nwoods.jgo.layout.JGoNetwork
JGoNetwork provides an abstract view of a JGoObjectSimpleCollection as a network (graph) of nodes and directed links. These nodes and links correspond to top-level JGoObjects in the JGoObjectSimpleCollection. The JGoNetwork class provides a framework for manipulating the state of nodes and links without modifying the structure of the original document.
JGoNetworkNode
,
JGoNetworkLink
Constructor Summary | |
JGoNetwork()
Constructs an empty network. |
|
JGoNetwork(JGoObjectSimpleCollection collection)
Constructs a network from the JGoObjectSimpleCollection's top-level objects. |
Method Summary | |
JGoNetworkLink |
addLink(JGoLink link)
This convenience method makes sure there is a JGoNetworkLink in this network corresponding to the given JGoLink. |
void |
addLink(JGoNetworkLink pLink)
Adds a JGoNetworkLink to the JGoNetwork. |
void |
addNode(JGoNetworkNode pNode)
Adds a node to the network. |
JGoNetworkNode |
addNode(JGoObject node)
This convenience method makes sure there is a JGoNetworkNode in this network corresponding to a JGoObject. |
void |
addNodesAndLinksFromCollection(JGoObjectSimpleCollection collection)
Adds a JGoObjectSimpleCollection to the network. |
void |
commitLinks()
Commits the positions of all links in the network to their corresponding JGoObjects. |
void |
commitNodes()
Commits the positions of all nodes in the network to their corresponding JGoObjects. |
void |
commitNodesAndLinks()
Commits the positions of all nodes and links in the network to their corresponding JGoObjects. |
JGoNetworkLink |
createNetworkLink()
|
JGoNetworkNode |
createNetworkNode()
|
void |
deleteArtificialNodes()
Delete all nodes and links that have no getJGoObject() associated with them. |
void |
deleteLink(JGoLink link)
This convenience method removes any JGoNetworkLink associated with the given JGoLink. |
void |
deleteLink(JGoNetworkLink pLink)
Deletes the input link from the network. |
void |
deleteNode(JGoNetworkNode pNode)
Deletes the input node from the network. |
void |
deleteNode(JGoObject node)
This convenience method removes any JGoNetworkNode that may be associated with the given JGoObject. |
void |
deleteSelfLinks()
Deletes all links whose "to node" and "from node" are the same node. |
JGoNetworkLink |
findLink(JGoObject pGoObj)
Returns the JGoNetworkLink which was constructed with the pGoObj. |
JGoNetworkNode |
findNode(JGoObject pGoObj)
Returns the JGoNetworkNode which was constructed with the pGoObj. |
protected java.util.HashMap |
getGoObjToLinkMap()
Returns the hash table mapping JGoObjects to JGoNetworkLinks |
protected java.util.HashMap |
getGoObjToNodeMap()
Returns the hash table mapping JGoObjects to JGoNetworkNodes |
JGoNetworkLink[] |
getLinkArray()
Returns an array of the JGoNetworkLinks list. |
int |
getLinkCount()
Returns the number of links in the network. |
java.util.Iterator |
getLinkIterator()
Returns the Iterator for the first link in the network. |
java.util.Iterator |
getLinkIterator(int index)
Returns an Iterator for myNetworkLinks, which points to the item at index as the first item. |
protected java.util.LinkedList |
getNetworkLinks()
Returns the list of JGoNetworkLinks |
protected java.util.LinkedList |
getNetworkNodes()
Returns the list of JGoNetworkNodes |
JGoNetworkNode[] |
getNodeArray()
Returns an array of the JGoNetworkNodes list. |
int |
getNodeCount()
Returns the number of nodes in the network. |
java.util.Iterator |
getNodeIterator()
Returns the Iterator for the first node in the network. |
java.util.Iterator |
getNodeIterator(int index)
Returns an Iterator for myNetworkNodes, which points to the item at index as the first item. |
JGoSelection |
getNodesAndLinks(JGoSelection sel)
Retrieve all of the JGoObject nodes and links from the JGoNetworkNodes and JGoNetworkLinks that are in this network, by adding them to the given selection. |
JGoNetworkLink |
linkNodes(JGoNetworkNode pFromNode,
JGoNetworkNode pToNode,
JGoObject pGoObj)
Links two nodes already in the network and returns the created link. |
void |
removeAllNodesAndLinks()
Removes all nodes and links from the network, resulting in an empty network. |
void |
reverseLink(JGoNetworkLink pLink)
Reverses the direction of a link in the network. |
JGoNetwork[] |
splitIntoSubNetworks()
Modify this network by splitting it up into separate subnetworks, each of which has all of its nodes connected to each other, perhaps indirectly and in mixed directions, but not to any nodes in any other subnetworks. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JGoNetwork()
public JGoNetwork(JGoObjectSimpleCollection collection)
collection
- the JGoObjectSimpleCollection containing the JGoObjects to add to the network.Method Detail |
public void addNodesAndLinksFromCollection(JGoObjectSimpleCollection collection)
public void removeAllNodesAndLinks()
public JGoNetworkNode createNetworkNode()
public void addNode(JGoNetworkNode pNode)
public JGoNetworkNode addNode(JGoObject node)
public void deleteNode(JGoNetworkNode pNode)
public void deleteNode(JGoObject node)
public JGoNetworkNode findNode(JGoObject pGoObj)
public JGoNetworkLink createNetworkLink()
public void addLink(JGoNetworkLink pLink)
public JGoNetworkLink addLink(JGoLink link)
public void deleteLink(JGoNetworkLink pLink)
public void deleteLink(JGoLink link)
public JGoNetworkLink findLink(JGoObject pGoObj)
public JGoNetworkLink linkNodes(JGoNetworkNode pFromNode, JGoNetworkNode pToNode, JGoObject pGoObj)
pGoObj
- the JGoObject to which the created link should correspondpublic void reverseLink(JGoNetworkLink pLink)
public void deleteSelfLinks()
public void deleteArtificialNodes()
public JGoNetwork[] splitIntoSubNetworks()
This method will first delete from this network all artificial nodes and all links that do not connect two different nodes. Afterwards, this original network may be empty or may contain all of the singleton JGoNetworkNodes, each of which had no JGoNetworkLinks connecting it to any other nodes.
public JGoSelection getNodesAndLinks(JGoSelection sel)
You can determine the bounding rectangle for a collection of nodes and links by calling the JGoDocument.computeBounds method. You can also call JGoView.moveSelection on this result to move the subnetwork where you would like them to be.
sel
- a JGoSelection; if null, the method allocates
and returns a new JGoSelection.
public int getNodeCount()
public java.util.Iterator getNodeIterator()
public java.util.Iterator getNodeIterator(int index)
public int getLinkCount()
public java.util.Iterator getLinkIterator()
public java.util.Iterator getLinkIterator(int index)
public void commitNodes()
public void commitLinks()
public void commitNodesAndLinks()
public JGoNetworkLink[] getLinkArray()
public JGoNetworkNode[] getNodeArray()
protected java.util.LinkedList getNetworkLinks()
protected java.util.LinkedList getNetworkNodes()
protected java.util.HashMap getGoObjToNodeMap()
protected java.util.HashMap getGoObjToLinkMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |