story.dbcore.links
Class LinkSet

java.lang.Object
  extended by story.dbcore.links.LinkSet
Direct Known Subclasses:
WritableLinkSet

public class LinkSet
extends java.lang.Object

A flat (non-hierarchical) container for nodes and link metadata. More specifically, it is in instances of this class that RelatedNodes compiles lists of nodes to answer "what nodes are related" queries. Instances of this class may be passed around as results to searches or whenever a node's related nodes must be communicated. Thus it is read-only.

It holds a set of NodeAddresses, which semantically represent the nodes to which some other node (unknown by this class) links according to some query. For each node, the LinkSet also holds one or more Via objects. Each Via object represents one "route" to the GenericNode: what the relevant label is, and what nodes the link involves. (The link may not be between the unseen origin node and the GenericNode; there may have been inference.)

Unlike RelatedNodes, instances of this class are static, and will not change as the underlying data does. Always query a RelatedNodes or Document for a fresh LinkSet whenever current query results are needed.


Constructor Summary
LinkSet()
           
 
Method Summary
 boolean contains(NodeAddress node)
          Determines whether the LinkSet contains a particular node (regardless of the number of Vias it is linked by) .
 ViaSet getAllVias()
          Get a ViaSet of all the Vias for all linked nodes.
 ViaSet getAllVias(NodeAddress node)
          Get a ViaSet of all the Vias for a particular node.
 NodeAddress getFirstLinkedNode()
          Get the first linked node.
 Via getFirstVia()
          Get the first Via of the first linked node.
 Via getFirstVia(NodeAddress node)
          Get the first Via for a particular node
 java.util.Enumeration getImmutableLinkedNodes()
          Get an Enumeration of NodeAddresses of linked nodes by first copying the list.
 java.util.Enumeration getLinkedNodes()
          Get an Enumeration of NodeAddresses of linked nodes.
 int numberOfLinks()
          Gives the number of links among all linked nodes
 int numLinkedNodes()
          Gives the number of linked nodes in the LinkSet
 java.lang.StringBuffer render()
          Render the LinkSet to a StringBuffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkSet

public LinkSet()
Method Detail

render

public java.lang.StringBuffer render()
                              throws Scheherexception
Render the LinkSet to a StringBuffer. Note: For humans only (not reinterpretable by command interpreter)

Throws:
Scheherexception

contains

public boolean contains(NodeAddress node)
Determines whether the LinkSet contains a particular node (regardless of the number of Vias it is linked by) .

Parameters:
node - The node you'd like to know about.

getLinkedNodes

public java.util.Enumeration getLinkedNodes()
Get an Enumeration of NodeAddresses of linked nodes.


getImmutableLinkedNodes

public java.util.Enumeration getImmutableLinkedNodes()
Get an Enumeration of NodeAddresses of linked nodes by first copying the list. This is slower than getLinkedNodes(), but the it will not change if the LinkSet does.


numberOfLinks

public int numberOfLinks()
Gives the number of links among all linked nodes


numLinkedNodes

public int numLinkedNodes()
Gives the number of linked nodes in the LinkSet


getFirstLinkedNode

public NodeAddress getFirstLinkedNode()
                               throws Scheherexception
Get the first linked node.

Throws:
Scheherexception

getFirstVia

public Via getFirstVia()
Get the first Via of the first linked node.


getFirstVia

public Via getFirstVia(NodeAddress node)
Get the first Via for a particular node


getAllVias

public ViaSet getAllVias(NodeAddress node)
                  throws Scheherexception
Get a ViaSet of all the Vias for a particular node. Returns an empty set if the node is not connected in any way.

Throws:
Scheherexception

getAllVias

public ViaSet getAllVias()
                  throws Scheherexception
Get a ViaSet of all the Vias for all linked nodes.

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.