ca.uwaterloo.cs.ql.fb
Class NodeSet

java.lang.Object
  extended by ca.uwaterloo.cs.ql.fb.TupleSet
      extended by ca.uwaterloo.cs.ql.fb.NodeSet
All Implemented Interfaces:
java.lang.Cloneable

public class NodeSet
extends TupleSet


Field Summary
 
Fields inherited from class ca.uwaterloo.cs.ql.fb.TupleSet
CHAOS, HAS_DUPLICATES
 
Constructor Summary
NodeSet()
          NodeSet.
NodeSet(int capacity)
          NodeSet.
NodeSet(java.lang.String name)
          NodeSet.
 
Method Summary
 void add(int nodeID)
          Adds a node efficiently, whose ID is known.
 void add(java.lang.String node)
          Adds a node to this set.
 void appendTA(java.lang.String fileName)
          Appends all element data to the end of a file.
 boolean contain(java.lang.String node)
          Tests if this NodeSet contains node.
 Node[] getAllNodes()
           
 TupleSet newSet()
          Creates an empty NodeSet.
 java.lang.String pick()
          Picks a node randomly from this NodeSet.
 NodeSet pick(int num)
          Picks a set of nodes randomly from this NodeSet.
 Node pickNode()
          Picks a node randomly from this NodeSet.
 void prefixCat(java.lang.String s)
           
 void print(java.io.OutputStream out)
          Prints all element data to out.
 void printTA(java.io.OutputStream out)
          Prints all element data to out in the TA form.
static NodeSet singleton(int nodeID)
          Create a singleton set.
static NodeSet singleton(java.lang.String node)
          Create a singleton set.
 void suffixCat(java.lang.String s)
           
 
Methods inherited from class ca.uwaterloo.cs.ql.fb.TupleSet
add, add, appendDB, clone, columns, get, getAllTuples, getName, getTupleList, hasDuplicates, hasName, removeDuplicates, setFlag, setHasDuplicates, setName, size, unsetFlag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeSet

public NodeSet()
NodeSet.


NodeSet

public NodeSet(java.lang.String name)
NodeSet.

Parameters:
name - the name.

NodeSet

public NodeSet(int capacity)
NodeSet.

Parameters:
capacity - the capacity.
Method Detail

singleton

public static NodeSet singleton(int nodeID)
Create a singleton set.


singleton

public static NodeSet singleton(java.lang.String node)
Create a singleton set.


add

public void add(int nodeID)
Adds a node efficiently, whose ID is known.

Parameters:
nodeID - the node's ID

add

public void add(java.lang.String node)
Adds a node to this set.

Parameters:
node - the node to add.

newSet

public TupleSet newSet()
Creates an empty NodeSet.

Overrides:
newSet in class TupleSet
Returns:
a NodeSet.

contain

public boolean contain(java.lang.String node)
Tests if this NodeSet contains node.

Parameters:
node - a node to test.
Returns:
true is node belongs to this set. Otherwise, false.

pick

public java.lang.String pick()
Picks a node randomly from this NodeSet.

Returns:
a node.

pick

public NodeSet pick(int num)
Picks a set of nodes randomly from this NodeSet.

Parameters:
num - the number of nodes to pick.
Returns:
a set of nodes.

pickNode

public Node pickNode()
Picks a node randomly from this NodeSet.

Returns:
a node.

getAllNodes

public Node[] getAllNodes()

print

public void print(java.io.OutputStream out)
Description copied from class: TupleSet
Prints all element data to out.

Overrides:
print in class TupleSet
Parameters:
out - the output stream.

printTA

public void printTA(java.io.OutputStream out)
Description copied from class: TupleSet
Prints all element data to out in the TA form.

Overrides:
printTA in class TupleSet
Parameters:
out - the output stream.

appendTA

public void appendTA(java.lang.String fileName)
              throws java.io.IOException
Description copied from class: TupleSet
Appends all element data to the end of a file.

Overrides:
appendTA in class TupleSet
Parameters:
fileName - the output file name.
Throws:
java.io.IOException

prefixCat

public void prefixCat(java.lang.String s)

suffixCat

public void suffixCat(java.lang.String s)