edu.umd.cs.fuzzyTree
Class ScoreGenerator

java.lang.Object
  |
  +--edu.umd.cs.fuzzyTree.ScoreGenerator

public class ScoreGenerator
extends java.lang.Object

Creates scores from an tree of DataNodes. Nodes are assigned scores based on how desirable they are to be displayed. A node's score is the product of the size of the subtree of which it is the root and the number of subtrees isomorphic to it, plus some additional parameters. A list that is sorted based on these scores is the final product.


Field Summary
private  DataGraph _dataGraph
          Reference to the XML data graph
private  int _maxInitialScore
          Used in preprocessing; the highest score value.
private  int _minInitialScore
          Used in preprocessing; the lowest score value.
private  java.util.ArrayList _sortedNodeList
          A sorted list of all of the DataNodes in the DataGraph.
private  java.util.ArrayList _tempNodeList
          An ArrayList of ArrayList of DataNodes.
 java.util.Comparator descendingScoreComparator
          Comparator for sorting on descending order of score
static int MIN_NODE_SCORE
          The minimum score value that a node may have.
 
Constructor Summary
ScoreGenerator(DataGraph dataGraph)
          Creates a score processor using dataGraph, performs all processing and creates a sorted node list, which can be retrieved using getSortedNodeList().
 
Method Summary
private  void addToList(DataNode node, int i)
          Inserts node into the height-i list
private  int calculateHeightAndCreateLists(DataNode root)
          Calculates the height of each node, puts nodes in lists based on height.
private  void createEquivalenceClasses()
          Creates equivalance classes for nodes based on an isomormphism index ordering.
 java.util.ArrayList getSortedNodeList()
          Returns an ArrayList of DataNodes that are sorted in descending order of score
 void printLists(java.io.PrintWriter out)
          For debugging.
private  void setInitialScores(int startIndex, int onePastEndIndex)
          Sets the initial scores of nodes in _sortedNodeIndex from startIndex to onePastEndIndex, which mark the start and end of one equivalence class in _sortedNodeList.
private  void setRankNodeScores()
          Changes initial scores in the list so that the first element of each equivalence class has the highest score, and the next element's score is less than the score of any first element in equivalance class, and so on.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_dataGraph

private DataGraph _dataGraph
Reference to the XML data graph

_tempNodeList

private java.util.ArrayList _tempNodeList
An ArrayList of ArrayList of DataNodes. _tempNodeList[i] contains nodes which have height i.

_maxInitialScore

private int _maxInitialScore
Used in preprocessing; the highest score value.

_minInitialScore

private int _minInitialScore
Used in preprocessing; the lowest score value. Used to ensure all scores are positive.

MIN_NODE_SCORE

public static final int MIN_NODE_SCORE
The minimum score value that a node may have.

_sortedNodeList

private java.util.ArrayList _sortedNodeList
A sorted list of all of the DataNodes in the DataGraph. Nodes are sorted based on the score field.

descendingScoreComparator

public java.util.Comparator descendingScoreComparator
Comparator for sorting on descending order of score
Constructor Detail

ScoreGenerator

public ScoreGenerator(DataGraph dataGraph)
Creates a score processor using dataGraph, performs all processing and creates a sorted node list, which can be retrieved using getSortedNodeList().
Method Detail

getSortedNodeList

public java.util.ArrayList getSortedNodeList()
Returns an ArrayList of DataNodes that are sorted in descending order of score

createEquivalenceClasses

private void createEquivalenceClasses()
Creates equivalance classes for nodes based on an isomormphism index ordering. IsomorphicNodeComparator is used for the ordering.
See Also:
IsomorphicDataNodeComparator

setInitialScores

private void setInitialScores(int startIndex,
                              int onePastEndIndex)
Sets the initial scores of nodes in _sortedNodeIndex from startIndex to onePastEndIndex, which mark the start and end of one equivalence class in _sortedNodeList.

Initial score is the product of the equivlance class size and the tree size corresponding to the class.

Parameters:
startIndex - starting index of a new equivalence class
onePastEndIndex - 1 + the index of the last member of the equivalence class

setRankNodeScores

private void setRankNodeScores()
Changes initial scores in the list so that the first element of each equivalence class has the highest score, and the next element's score is less than the score of any first element in equivalance class, and so on. So the ordering is something like this:
(equivlance class number, rank in equivalance class) (1, 1) (2, 1) (3, 1) (1, 2) (2, 2) (3, 2)

calculateHeightAndCreateLists

private int calculateHeightAndCreateLists(DataNode root)
Calculates the height of each node, puts nodes in lists based on height.

Function is called recursively.

Parameters:
root - the root of the subtree
Returns:
the height of the subtree

addToList

private void addToList(DataNode node,
                       int i)
Inserts node into the height-i list
Parameters:
node - the node to insert into a height list
i - the height of node

printLists

public void printLists(java.io.PrintWriter out)
For debugging. Prints to out only if FuzzyTreeModel.debugLevel < 5.


Web Accessibility