Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo.layout
Class JGoTreeNetwork

    java.lang.Object
      com.nwoods.jgo.layout.JGoTreeNetwork

public class JGoTreeNetwork
extends java.lang.Object

This provides an abstract view of a JGoObjectSimpleCollection as a network (graph) of nodes and directed links. These nodes and links correspond to JGoObjects provided in the collection. This class provides a framework for manipulating the state of nodes and links without modifying the structure of the original document.

Constructor Summary
`JGoTreeNetwork()` Constructs an empty network.
`JGoTreeNetwork(JGoObjectSimpleCollection collection)` Constructs a network from a collection of JGoObjects, by also calling AddNodesAndLinksFromCollection(collection, ture).

Method Summary
`JGoTreeNetworkLink` | `AddLink(JGoLink ilink)` This convenience method takes a JGoLink and returns a JGoTreeNetworkLink that has been added to this network.
`void` | `AddLink(JGoTreeNetworkLink link)` Adds a JGoTreeNetworkLink to the JGoTreeNetwork.
`JGoTreeNetworkNode` | `AddNode(JGoObject node)` This convenience method makes sure there is a JGoTreeNetworkNode in this network corresponding to a JGoObject
`void` | `AddNode(JGoTreeNetworkNode node)` Adds a JGoTreeNetworkNode to the JGoTreeNetwork
`void` | `AddNodesAndLinksFromCollection(JGoObjectSimpleCollection collection, boolean onlytruenodes)` Adds the objects in a JGoObjectSimpleCollection to the network.
`JGoTreeNetworkLink` | `CreateNetworkLink()` Allocate a new instance of JGoTreeNetworkLink
`JGoTreeNetworkNode` | `CreateNetworkNode()` Allocate a new instance of JGoTreeNetworkNode
`void` | `DeleteArtificialNodes()` Delete all nodes and links that have no JGoObject associated with them.
`void` | `DeleteLink(JGoLink ilink)` This convenience method makes sure a JGoLink does not have a JGoTreeNetworkLink in this network.
`void` | `DeleteLink(JGoTreeNetworkLink link)` Deletes the input link from the network.
`void` | `DeleteNode(JGoObject node)` This convenience method removes any JGoTreeNetworkNode corresponding to a JGoObject
`void` | `DeleteNode(JGoTreeNetworkNode node)` Deletes the input node from the network.
`void` | `DeleteSelfLinks()` Deletes all links whose "to node" and "from node" are the same node.
`JGoTreeNetworkLink` | `FindLink(JGoObject obj)` Returns the JGoTreeNetworkLink which was constructed for the JGoObject.
`JGoTreeNetworkNode` | `FindNode(JGoObject obj)` Returns the JGoTreeNetworkNode which was constructed for the JGoObject.
`JGoTreeAutoLayout` | `getLayout()` Gets the JGoTreeAutoLayout in which this network is being used.
`int` | `getLinkCount()` Gets the number of Links in the Network.
`JGoLinkArrayList` | `getLinks()` Get a JGoLinkArrayList of JGoTreeNetworkLinks
`int` | `getNodeCount()` Gets the number of Nodes in the Network.
`JGoNodeArrayList` | `getNodes()` Get a JGoNodeArrayList of JGoTreeNetworkNodes
`JGoObjectCollection` | `GetNodesAndLinks(JGoObjectCollection coll)` Retrieve all the JGoObject nodes and links from the JGoTreeNetworkNodes and JGoTreeNetworkLinks that are in this network, but adding them to given coll.
`JGoTreeNetworkLink` | `LinkNodes(JGoTreeNetworkNode fromNode, JGoTreeNetworkNode toNode, JGoObject obj)` 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(JGoTreeNetworkLink link)` Reverses the direction of a link in the network.
`void` | `setLayout(JGoTreeAutoLayout value)` Sets the JGoTreeAutoLayout in which this network is being used.
`java.util.ArrayList` | `SplitIntoSubNetworks()` Modify this network by splitting i up into separate subnetworks.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JGoTreeNetwork

    public JGoTreeNetwork()

  Constructs an empty network. Use this default constructor to create an empty network. Call AddNodesAndLinksFromCollection to automatically add network nodes and links, or call AddNode(JGoObject) and LinkNodes explicitly to have more detailed control over the exact graph that is laid out.

### JGoTreeNetwork

    public JGoTreeNetwork(JGoObjectSimpleCollection collection)

  Constructs a network from a collection of JGoObjects, by also calling AddNodesAndLinksFromCollection(collection, ture). If you want an automatic layout of all the objects in a collection (not just JGoNodes), you'll need to create a JGoTreeNetwork and call AddNodesAndLinksFromCollection(...collection..., false);

Parameters:
  `collection` - the collection containing the JGoNodes to add to the network.

Method Detail

### CreateNetworkNode

    public JGoTreeNetworkNode CreateNetworkNode()

  Allocate a new instance of JGoTreeNetworkNode

  Returns:

### CreateNetworkLink

    public JGoTreeNetworkLink CreateNetworkLink()

  Allocate a new instance of JGoTreeNetworkLink

  Returns:

### AddNodesAndLinksFromCollection

    public void AddNodesAndLinksFromCollection(JGoObjectSimpleCollection collection,
                                               boolean onlytruenodes)

  Adds the objects in a JGoObjectSimpleCollection to the network.

  Parameters:
    `collection` -
    `onlytruenodes` - if true, only those objects that are JGoNodes will have JGoTreeNetworkNodes created.

### RemoveAllNodesAndLinks

    public void RemoveAllNodesAndLinks()

  Removes all nodes and links from the network, resulting in an empty network.

### AddNode

    public void AddNode(JGoTreeNetworkNode node)

  Adds a JGoTreeNetworkNode to the JGoTreeNetwork

  Parameters:
    `node` -

### AddNode

    public JGoTreeNetworkNode AddNode(JGoObject node)

  This convenience method makes sure there is a JGoTreeNetworkNode in this network corresponding to a JGoObject

  Returns:
    a JGoTreeNetworkNode in this network

### DeleteNode

    public void DeleteNode(JGoTreeNetworkNode node)

  Deletes the input node from the network. This function also deletes all links to or from the node. Performs a no-op if the node is not in the network.

  Parameters:
    `node` -

### DeleteNode

    public void DeleteNode(JGoObject node)

  This convenience method removes any JGoTreeNetworkNode corresponding to a JGoObject

  Parameters:
    `node` -

### FindNode

    public JGoTreeNetworkNode FindNode(JGoObject obj)

  Returns the JGoTreeNetworkNode which was constructed for the JGoObject.

  Parameters:
    `obj` -
  Returns:
    the JGoTreeNetworkNode associated with the JGoObject or null if no such node exists.

### AddLink

    public void AddLink(JGoTreeNetworkLink link)

  Adds a JGoTreeNetworkLink to the JGoTreeNetwork. Although this method is provided for completeness, LinkNodes provides a more efficient manner of linking nodes already in the network. This adds the link to its JGoTreeNetworkLink ToNode's source links list, and to its JGoTreeNetworkLink FromNode's destination links list.

  Parameters:
    `link` -

### AddLink

    public JGoTreeNetworkLink AddLink(JGoLink ilink)

  This convenience method takes a JGoLink and returns a JGoTreeNetworkLink that has been added to this network. If FindLink returns null, this method creates a new JGoTreeNetworkLink, makes sure the JGoLink FromNode and ToNode have corresponding JGoTreeNetworkNodes in the network, and adds the link itself to the network.

  Parameters:
    `ilink` -
  Returns:

### DeleteLink

    public void DeleteLink(JGoTreeNetworkLink link)

  Deletes the input link from the network. Also removes the link from its to node's predecessor list and from its from node's successor list. Performs a no-op if the link is not in the network.

  Parameters:
    `link` -

### DeleteLink

    public void DeleteLink(JGoLink ilink)

  This convenience method makes sure a JGoLink does not have a JGoTreeNetworkLink in this network. This just calls DeleteLink(JGoTreeNetworkLink) if FindLink finds a JGoTreeNetworkLink.

  Parameters:
    `ilink` -

### FindLink

    public JGoTreeNetworkLink FindLink(JGoObject obj)

  Returns the JGoTreeNetworkLink which was constructed for the JGoObject.

  Parameters:
    `obj` -
  Returns:
    the JGoTreeNetworkLink that was constructed with the obj or null if no such link exists

### LinkNodes

    public JGoTreeNetworkLink LinkNodes(JGoTreeNetworkNode fromNode,
                                        JGoTreeNetworkNode toNode,
                                        JGoObject obj)

  Links two nodes already in the network and returns the created link.

  Parameters:
    `fromNode` -
    `toNode` -
    `obj` -
  Returns:
    the link created when fromNode and tolNode are linked.

### ReverseLink

    public void ReverseLink(JGoTreeNetworkLink link)

  Reverses the direction of a link in the network. This calls JGoTreeNetworkLink.ReverseLink and also adjusts the source links and destination links of both connected nodes. If either JGoTreeNetworkLink FromNode or ToNode are null, this method does nothing.

  Parameters:
    `link` -

### DeleteSelfLinks

    public void DeleteSelfLinks()

  Deletes all links whose "to node" and "from node" are the same node.

### DeleteArtificialNodes

    public void DeleteArtificialNodes()

  Delete all nodes and links that have no JGoObject associated with them.

### SplitIntoSubNetworks

    public java.util.ArrayList SplitIntoSubNetworks()

  Modify this network by splitting i up into separate subnetworks. Each subnetwrok has all of its nodes connected to each other, but not to any nodes in any other subnetworks. This method will first delete from this network all artificial nodes and all links that do not connect who different nodes. Afterwards, this original network may be empty or may contain all of the singleton JGoTreeNetworkNodes, each of which had no JGoTreeNetworkLinks connecting it to any other nodes.

  Returns:
    an ArrayList of networks, sorted in order of decreasing NodeCount.

### GetNodesAndLinks

    public JGoObjectCollection GetNodesAndLinks(JGoObjectCollection coll)

  Retrieve all the JGoObject nodes and links from the JGoTreeNetworkNodes and JGoTreeNetworkLinks that are in this network, but adding them to given coll.

  Parameters:
    `coll` - a JGoObjectCollection; if null, the method allocates one.
  Returns:
    a JGoObjectCollection of all the JGoObjects that correspond to JGoTreeNetworkNodes and JGoTreeNetworkLinks

### getNodeCount

    public int getNodeCount()

  Gets the number of Nodes in the Network.

  Returns:

### getLinkCount

    public int getLinkCount()

  Gets the number of Links in the Network.

  Returns:

### getLayout

    public JGoTreeAutoLayout getLayout()

  Gets the JGoTreeAutoLayout in which this network is being used.

  Returns:

### getNodes

    public JGoNodeArrayList getNodes()

  Get a JGoNodeArrayList of JGoTreeNetworkNodes

  Returns:

### getLinks

    public JGoLinkArrayList getLinks()

  Get a JGoLinkArrayList of JGoTreeNetworkLinks

  Returns:

### setLayout

    public void setLayout(JGoTreeAutoLayout value)

  Sets the JGoTreeAutoLayout in which this network is being used.

  Parameters:
    `value` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD