bbn
Class BBN

java.lang.Object
  |
  +--bbn.BBN
Direct Known Subclasses:
DataGenerator, DataGenerator2

public class BBN
extends java.lang.Object

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


Constructor Summary
BBN()
          BBN creates the network and initializes the nodes.
BBN(BBN all)
           
 
Method Summary
 void addNode(Node node)
           
 BBN copy()
           
 BBN copyShell()
           
 void generateEvidenceFile(java.lang.String fileName)
           
 Node getNodeAt(int index)
          getNodeAt will return a node at the specified index.
 Node getNodeByName(java.lang.String nodeName)
          getNodeByName will return the Node object matching the specified string name.
 java.util.Vector getNodes()
          getNodes returns a vector containing all of the node objects in the network.
 int indexOf(Node node)
          indexOf will return the index of a Node.
 int indexOf(java.lang.String nodeName)
          indexOf will return the index of a Node.
 java.lang.String listHead()
          list the first(head) part of the xml file
 java.lang.String listNode()
           
 java.lang.String listPosition(int i)
           
 java.lang.String listProbability()
           
 void loadFromXML(java.lang.String xmlFileName)
          loadFromXML will open an bayesian network from an XML file.
 void loadNodeXMLBIF(java.lang.String sbuf)
          This function gets all of the information for one node and creates a new Block that is a representation of this node and adds it to the Bayesian Network.
 void loadVariablesXMLBIF(java.lang.String sbuf)
          Loads all of the nodes that are located into the file.
 java.util.Vector pred(java.lang.String nodename)
          pred will return a Vector of the string names of the nodes that are immediate predecessors (parents) to the Node object matching the specified string name.
 void removeNodeByName(java.lang.String name)
          removeNodeByName will remove the Node object matching the specified string name from the network.
 void report()
           
 void reportVerbose()
           
 void saveToXML(java.lang.String xmlFileName)
          saveToXML will reconstruct a bayesian network in an XML file.
 void setName(java.lang.String networkName)
           
 void setNetwork(BBN all)
           
 void setNodeAt(int index, Node node)
           
 void setNodeList(java.util.Vector nodeList)
           
 int size()
           
 void writeToXML(java.lang.String outputXMLFileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BBN

public BBN()
BBN creates the network and initializes the nodes.

BBN

public BBN(BBN all)
Method Detail

setNetwork

public void setNetwork(BBN all)

copy

public BBN copy()

copyShell

public BBN copyShell()

setName

public void setName(java.lang.String networkName)

setNodeAt

public void setNodeAt(int index,
                      Node node)

setNodeList

public void setNodeList(java.util.Vector nodeList)

report

public void report()

reportVerbose

public void reportVerbose()

loadFromXML

public void loadFromXML(java.lang.String xmlFileName)
loadFromXML will open an bayesian network from an XML file.
Parameters:
xmlFileName - - the name of the file being loaded

saveToXML

public void saveToXML(java.lang.String xmlFileName)
saveToXML will reconstruct a bayesian network in an XML file.
Parameters:
xmlFileName - - the file name to be written.

getNodeAt

public Node getNodeAt(int index)
getNodeAt will return a node at the specified index. Throws BBNE_OutOfBounds exception if the index is out of bounds.
Parameters:
index - - the index of the node being requested.
Returns:
Node - the node at the specified index.

getNodes

public java.util.Vector getNodes()
getNodes returns a vector containing all of the node objects in the network.
Returns:
Vector - the vector of Node objects.

getNodeByName

public Node getNodeByName(java.lang.String nodeName)
getNodeByName will return the Node object matching the specified string name. Throws BBNE_NodeNotFound exception if the node is not found.
Parameters:
nodeName - - the name of the node to be searched for
Returns:
Node - the node found

addNode

public void addNode(Node node)

removeNodeByName

public void removeNodeByName(java.lang.String name)
removeNodeByName will remove the Node object matching the specified string name from the network.
Parameters:
name - - the name of the node to be removed

pred

public java.util.Vector pred(java.lang.String nodename)
pred will return a Vector of the string names of the nodes that are immediate predecessors (parents) to the Node object matching the specified string name.
Parameters:
nodename - - the name of the node to be searched for
Returns:
Vector - the Vector of parents to the node

indexOf

public int indexOf(Node node)
indexOf will return the index of a Node. Throws BBNE_NodeNotFound exception if the node is not in the network.
Parameters:
node - - the Node object being searched for.
Returns:
int - the index of the node

indexOf

public int indexOf(java.lang.String nodeName)
indexOf will return the index of a Node. Throws BBNE_NodeNotFound exception if the node is not in the network.
Parameters:
node - - the Node object being searched for.
Returns:
int - the index of the node

size

public int size()

loadVariablesXMLBIF

public void loadVariablesXMLBIF(java.lang.String sbuf)
Loads all of the nodes that are located into the file. This function seperates all of the nodes and then calls another function that well parse each individual data stream and pull out the relevant information.
Parameters:
sbuf - a string of the entire file

loadNodeXMLBIF

public void loadNodeXMLBIF(java.lang.String sbuf)
This function gets all of the information for one node and creates a new Block that is a representation of this node and adds it to the Bayesian Network. It finds the name, type, states, and coordinates of this node.
Parameters:
sbuf - a string that contians all of the information for one node

writeToXML

public void writeToXML(java.lang.String outputXMLFileName)

listNode

public java.lang.String listNode()

listPosition

public java.lang.String listPosition(int i)

listProbability

public java.lang.String listProbability()

listHead

public java.lang.String listHead()
list the first(head) part of the xml file

generateEvidenceFile

public void generateEvidenceFile(java.lang.String fileName)