bbn
Class Node

java.lang.Object
  |
  +--bbn.Node

public class Node
extends java.lang.Object

Title: Node.java Description: Core Bayesian Network class Copyright: Copyright (c) 2001 Company: KSU / KDD


Field Summary
 int pathLength
           
 
Constructor Summary
Node(BBN newNetwork)
          Node constructs the node and initializes the values.
 
Method Summary
 void addChild(Node child)
          addChild adds a child to the node.
 void addParent(Node parent)
          addParent adds a parent to the node.
 void addProbability(java.lang.Double newProbability)
          addProbability adds a new probability to the probability vector.
 void addValue(java.lang.String value)
          addValue adds a new value to the set of values the node can have.
 Node copy(BBN newNetwork)
          Creates a copy of the node.
 void empty_parentlist()
           
 int getArity()
          getArity returns the arity (number of possible values) of the node.
 Node getChild(int index)
          getChild returns the child at location index.
 java.util.Vector getChildren()
          getChildren returns the vector of Node objects containing the node's children
 java.util.Vector getChildrenNames()
          getChildrenNames returns the vector of Strings containing the node's children's names.
 java.lang.String getInstant()
          Deprecated. The whole point of NodeManager is to handle instantiations. It handles it with integers rather than strings, which makes projects run much faster.
 java.lang.String getName()
          getName returns the name of the node.
 BBN getNetwork()
          getNetwork returns the host bayesian network.
 Node getParent(int index)
          getParent returns the parent at location index.
 java.lang.String getParentName(int index)
           
 java.util.Vector getParentNames()
           
 java.util.Vector getParents()
          getParents returns the vector of Node objects containing the node's parents
 java.util.Vector getProbabilities()
          getProbabilities returns the vector of Node objects containing the node's probabilities
 double getProbability(int index)
          getProbability returns the probability at location index.
 double getProbability(int column, int row)
           
 int getStateIndex(java.lang.String string)
          getStateIndex matches a given string to the location in the possible value list.
 java.lang.String getStateName(int index)
          getStateName will return the requested state index's name that was given in the network file.
 java.util.Vector getStateNames()
          getStateNames will return all possible state names.
 java.util.Vector getTable(int splitTableIndex, BBN nodesGroup)
           
 java.lang.Double getValue(int index)
           
 java.util.Vector getValues()
          getValues returns the vector of all possible instantiations of the node
 double getX()
          getX returns the X coordinate.
 double getY()
          getY returns the Y coordinate.
 boolean isProcessed()
           
 void labelProcessed()
           
 int numChildren()
          numChildren returns the number of children this node has
 int numParents()
          numParents returns the number of parents this node has.
 void print()
          print prints the name of the node.
 void printStateNames()
           
 void printVerbose()
           
 void setChildrenList(java.util.Vector children)
           
 void setInstant(java.lang.String instant)
          Deprecated. The whole point of NodeManager is to handle instantiations. It handles it with integers rather than strings, which makes projects run much faster.
 void setName(java.lang.String name)
          setName sets the name of the node.
 void setParentList(java.util.Vector parents)
           
 void setParentNames(java.util.Vector names)
           
 void setPossibleValues(java.util.Vector values)
           
 void setProbabilities(java.util.Vector newProbabilities)
          setProbabilities will set the probability vector to the passed vector.
 void setProbability(int index, java.lang.Double value)
           
 void setValue(int index, java.lang.Double value)
           
 void setX(double x)
          setX sets the X coordinate
 void setY(double y)
          setY sets the Y coordinate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathLength

public int pathLength
Constructor Detail

Node

public Node(BBN newNetwork)
Node constructs the node and initializes the values.
Parameters:
newNetwork - - the node's parent Bayesian Network.
Method Detail

copy

public Node copy(BBN newNetwork)
Creates a copy of the node. Note that the parents and children are not cloned; they are simply re-referenced. If you want a distinct set, you will need to copy all of the parents and all of the children. Lucky for you, BBN.copy() does this for you; the Node.copy(BBN) should only be called if you intend to manipulate the probability table. Note that neither the parents nor the children know about this copy. It is recommended to use BBN.copy over Node.copy.
Parameters:
newNetwork - - the network this copy will belong to
Returns:
Node - the new copy.
See Also:
BBN.copy

getArity

public int getArity()
getArity returns the arity (number of possible values) of the node.
Returns:
int - the arity of the network

setPossibleValues

public void setPossibleValues(java.util.Vector values)

setChildrenList

public void setChildrenList(java.util.Vector children)

setParentList

public void setParentList(java.util.Vector parents)

setParentNames

public void setParentNames(java.util.Vector names)

setProbability

public void setProbability(int index,
                           java.lang.Double value)

setValue

public void setValue(int index,
                     java.lang.Double value)

getValue

public java.lang.Double getValue(int index)

addProbability

public void addProbability(java.lang.Double newProbability)
addProbability adds a new probability to the probability vector.
Parameters:
newProbability - - the new probability to add.

getStateIndex

public int getStateIndex(java.lang.String string)
getStateIndex matches a given string to the location in the possible value list.
Parameters:
string - - the string being matched
Returns:
int - the index of the string.

printStateNames

public void printStateNames()

print

public void print()
print prints the name of the node.

setInstant

public void setInstant(java.lang.String instant)
Deprecated. The whole point of NodeManager is to handle instantiations. It handles it with integers rather than strings, which makes projects run much faster.

setInstant will set the current instantiation to the passed string.
Parameters:
instant - - the new instantiation

getInstant

public java.lang.String getInstant()
Deprecated. The whole point of NodeManager is to handle instantiations. It handles it with integers rather than strings, which makes projects run much faster.

getInstant will return the current instantiation of the node
Returns:
String - the current instantiation

setProbabilities

public void setProbabilities(java.util.Vector newProbabilities)
setProbabilities will set the probability vector to the passed vector.
Parameters:
newProbabilities - - the new probabilities vector

getStateName

public java.lang.String getStateName(int index)
getStateName will return the requested state index's name that was given in the network file.
Parameters:
index - - the index of the state being requested.
Returns:
String - the name of the state

getStateNames

public java.util.Vector getStateNames()
getStateNames will return all possible state names.
Returns:
Vector - the vector of strings pertaining to the possible values.

getNetwork

public BBN getNetwork()
getNetwork returns the host bayesian network.
Returns:
BBN - the network.

getParent

public Node getParent(int index)
getParent returns the parent at location index. Throws BBNE_OutOfBounds exception if index is out of bounds.
Parameters:
index - - the requested parent index
Returns:
Node - the parent corresponding to the index

getParentName

public java.lang.String getParentName(int index)

getParents

public java.util.Vector getParents()
getParents returns the vector of Node objects containing the node's parents
Returns:
Vector - the parent vector

getParentNames

public java.util.Vector getParentNames()

empty_parentlist

public void empty_parentlist()

getChild

public Node getChild(int index)
getChild returns the child at location index. Throws BBNE_OutOfBounds exception if index is out of bounds.
Parameters:
index - - the requested child index
Returns:
Node - the child corresponding to the index

getChildren

public java.util.Vector getChildren()
getChildren returns the vector of Node objects containing the node's children
Returns:
Vector - the children vector

getChildrenNames

public java.util.Vector getChildrenNames()
getChildrenNames returns the vector of Strings containing the node's children's names. Please be aware that getChildren() is much more useful.
Returns:
Vector - the vector of all children names

getProbability

public double getProbability(int index)
getProbability returns the probability at location index. Throws BBNE_OutOfBounds exception if index is out of bounds.
Parameters:
index - - the requested probability index
Returns:
double - the probability corresponding to the index

getProbability

public double getProbability(int column,
                             int row)

getProbabilities

public java.util.Vector getProbabilities()
getProbabilities returns the vector of Node objects containing the node's probabilities
Returns:
Vector - the probabilities vector

getValues

public java.util.Vector getValues()
getValues returns the vector of all possible instantiations of the node
Returns:
Vector - the vector of all instantiations

getName

public java.lang.String getName()
getName returns the name of the node.
Returns:
String - the name of the node.

setName

public void setName(java.lang.String name)
setName sets the name of the node.
Parameters:
name - - the new name.

setX

public void setX(double x)
setX sets the X coordinate
Parameters:
x - - the X coordinate

getX

public double getX()
getX returns the X coordinate.
Returns:
x - the x coordinate.

addValue

public void addValue(java.lang.String value)
addValue adds a new value to the set of values the node can have.
Parameters:
value - - the new value

addChild

public void addChild(Node child)
addChild adds a child to the node. calls addParent on the child
Parameters:
child - - the child being added to the node.

addParent

public void addParent(Node parent)
addParent adds a parent to the node. Caution - do not use this function in conjuction with addChild because addChild does this for you automatically.

setY

public void setY(double y)
setY sets the Y coordinate.
Parameters:
y - - the y coordinate.

getY

public double getY()
getY returns the Y coordinate.
Returns:
y - the y coordinate.

numParents

public int numParents()
numParents returns the number of parents this node has.
Returns:
int - the number of parents.

numChildren

public int numChildren()
numChildren returns the number of children this node has
Returns:
int - the number of children.

labelProcessed

public void labelProcessed()

isProcessed

public boolean isProcessed()

getTable

public java.util.Vector getTable(int splitTableIndex,
                                 BBN nodesGroup)

printVerbose

public void printVerbose()