Provides classes and interfaces that perform functions for the analysis package that are required by multiple subpackages and which do not logically belong to any specific subpackage.


Tree Data Structure

The tree structure consists of four principle parts. First, there is a Tree object, which holds the base of the data tree as well as several other important functions. There is also a Node object, which serves as a branching place for the tree or a place where a Leaf can attach. No node may hold both Leaves and Branches, nor may a Node hold a Leaf at the same level that another Node holds one or more Branches. A Branch object holds a Node object and also contains a branch mean and two branch range values. It also returns a Hashtable key to address itself from its parent Node. Finally, the Leaf object holds and returns data stored at a particular terminal point in the branching heirarchy.

This structure means that any given object needs only a reference to the object(s) directly above it, but the Tree object may yet hold the entire structure.

Branch Methods

public Branch(double branchMean, double plus, double minus, boolean hasLeaf)
This constructor creates a branch with the given mean as well as a maximum included value of plus and a minimum included value of minus. Whether these maxima and minima are inclusive or exclusive depends on the implementation, but should be consistent throughout the application.
public Branch()
Initializes the Branch without any information, allowing the Branch to hold non-numeric information. However, this means that the Branch will not have any associated parameter range, but merely a key.
public double getBranchMean()
public Node getNode()
Returns the Node that is directly above this Branch in the heirarchy.
public double getRangeMax()
Returns the value established by plus in the constructor.
public double getRangeMin()
Returns the value established by minus in the constructor.
public void setKey(String value)
Sets the key of this Branch to value. Should only be used when the default constructor for Branch has been used.

Leaf Methods

public Leaf()
This constructor initializes the Leaf's data holders and prepares it to accept data.
public void addContent(String name, Object content)
This method adds the Object content to the Leaf's data structure. content will be stored under name. To recover the stored Object, use getContent(String name) below.
public void addJasData(Object dataObject)
This method will attempt to add the data held in dataObject to the contents of the Leaf. This method should only be invoked if all objects in the Leaf are JAS Histogram objects.
public Object getContent(String name)
This method returns the Object stored in the Leaf with the given name. If name is not the key for any object in the Leaf, the JVM will throw an Exception.
public Object[] getFullContents()
Returns an array containing all the Objects stored in this Leaf, in the order in which they were added.

Node Methods

public Node()
This constructor initializes the Node's data holders and prepares it to accept data.
public void addBranch(Branch item) throws NodeException
This method adds a Branch object to the Node's data structure.
public Hashtable getBranches() throws NodeException
This method returns a Hashtable with the Branch objects held by the Node. However, this method does not do much good unless either the key for the desired Branch is already known, or the getKeyList() method is invoked.
public List getKeyList()
This method is designed for use the getBranches() method, allowing implementing software to loop over the Branch objects held by the Node.
public Leaf getLeaf() throws NodeException
Returns the Leaf object held by this Node. If this is not a Leaf Node, however, the object returned will be null.
public String getBranchParameterName() throws NodeException
Returns the name of the parameter varied by the child Branches of this node. For example, the BranchParameterName of the first node might be "DomId".
public boolean isLeafNode()
Tests whether the given Node is a Leaf Node.
public boolean isRootNode()
Tests whether the given Node is a Root Node.
public void setLeaf(Leaf contents) throws NodeException
Used at initialization time to set the Leaf of this Leaf Node to contents.
public void setLeafNode()
Sets the boolean that determines whether this is a Leaf Node to true.
public void setParameterName(String name) throws NodeException
Sets the name of the parameter varied by the Node's child Branches to name.
public void setRootNode()
Sets the boolean that determines whether this is a Root Node to true.

Tree Methods

public Tree(int numLevels)
Initializes a Tree object with a number of levels equal to numLevels.
public void buildAddressList()
Invoked after all levels of the Tree have been filled, this method parses the tree and fills a list of Strings that contain the addresses of the Leaf Nodes. Once this method has been invoked, the Tree holds a List of Strings that can be used to uniquely identify each of the Leaf Nodes in the tree for finalization purposes.
public Leaf getLeaf(String address)
Returns the Leaf specified by the given address. The address is a String that contains Branch key values separated by dashes. For example, "af9163-917.989-3.0" would represent a key for a tree with the first Branches holding DOM IDs and the second and third Branches holding double values.
public Leaf[] getLeaves()
Returns all the Leaves specified in this Tree.
public Node getRootNode()
Returns the Node at the base of the Tree, allowing access to all of the contents that follow using the methods defined in Node and Branch.

TreeFactory

The TreeFactory object is a convenience object that implements a complex recursive structure in order to build up a Tree object. The factory requires input from the calling HitAnalysis at start-up, but once it has started working, it runs independently until the Tree has been generated.

Methods

public TreeFactory(IntervalGroupList intervals, String[] hierarchy, HitAnalysis parent)
The input parameters specified in the constructor allow the factory to create and return an object of the Tree class.
public Tree growTree() throws ClassNotFoundException
This method is invoked to create a Tree object from the specifications listed in the constructor. The Tree returned uses the IntervalGroupList and the String[] passed to the constructor to create a branching structure. The hierarchy represents the order of branchings in the tree, and for each branching the IntervalGroupList is used to determined the values of the branches that are found at that node.
public static RootType convertToXML(Tree input,String rootName,ITree handler) throws JAXBException
This method is a convenience method that allows hit analysis classes to convert their Tree data structures to XML in a transparent way. This makes it easier for hit analysis to produce XML output, and does so in a way that is transparent to anyone who wishes to upgrade the abstract HitAnalysis class.
public static Tree convertFromXML(RootType input, String baseDirectory) throws NodeException
The purpose of this method is similar to that of convertToXML() in that it is a convenience class. However, it is used to convert an XML tree back into a workable Tree data structure for a Judgement to parse.