Class Utilities

java.lang.Object
  |
  +--Utilities

public class Utilities
extends java.lang.Object

Utilites.java contains several static methods that are used throughout the system


Constructor Summary
Utilities()
          Creates new Utilities
 
Method Summary
protected static boolean apply(java.util.LinkedList deck, DeckEntry[] current_nodes, int start_node, RuleEntryLHS rule, TripleStack ttable, boolean[] implied, boolean[] anti_implied, Table2 features, java.lang.String mode, java.util.Vector parsed_decks)
          This method reverses the application of the generation rule
static boolean check(java.util.BitSet toclear, java.lang.String item, Table2 features)
          Checks to see if a feature vector has a particular feature
static boolean checkNclear(java.util.BitSet toclear, java.lang.String item, Table2 features)
          Checks to see if a feature vector had a particluar feature, and if so removes it
static java.util.LinkedList clone_deck(java.util.LinkedList deck)
          Clone a deck.
static void deckDisplay(java.util.LinkedList deck, Table2 features)
           
static Triplepair parse(RuleEntryLHS[] rules, java.util.LinkedList deck, DeckEntry[] nodes, int i, java.lang.Integer rule_start_point, Table2 features, TripleStack ttable, boolean application, java.lang.String mode, java.util.Vector parsed_decks)
          parses the deck with the rules given
static int subscriptEval(java.lang.String left_node, java.lang.String right_node)
          This will compare the value of the subscript of the two passed types
static boolean typeEval(java.lang.String left_node, java.lang.String right_node)
          This will compare the types
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Creates new Utilities
Method Detail

subscriptEval

public static int subscriptEval(java.lang.String left_node,
                                java.lang.String right_node)
This will compare the value of the subscript of the two passed types
Parameters:
left_node - a type that is to be compared
right_node - the other type that is to be compared
Returns:
an int that tells the relation between left and right. returns 1 if left has a higher subscript than the right, returns 0 if left has a equal subscript to right, returns -1 if left has a lower subscript than the right

typeEval

public static boolean typeEval(java.lang.String left_node,
                               java.lang.String right_node)
This will compare the types
Parameters:
left_node - one of the nodes that are to be compared
right_node - the other node that is to be compared
Returns:
boolean, true if the two nodes are of the same type

apply

protected static boolean apply(java.util.LinkedList deck,
                               DeckEntry[] current_nodes,
                               int start_node,
                               RuleEntryLHS rule,
                               TripleStack ttable,
                               boolean[] implied,
                               boolean[] anti_implied,
                               Table2 features,
                               java.lang.String mode,
                               java.util.Vector parsed_decks)
This method reverses the application of the generation rule
Parameters:
deck - the current deck being modified
rule - the rule that is being undone
ttable - the object that the reconstructed objects go back into
implied - an array that reflects if the starred object should have a feature that one of the other object has.
anti-implied - an array that reflects if the starred object should have a feature that was taken away from an other object.

checkNclear

public static boolean checkNclear(java.util.BitSet toclear,
                                  java.lang.String item,
                                  Table2 features)
Checks to see if a feature vector had a particluar feature, and if so removes it
Parameters:
toclear - the feature vector that might have a particular feature
item - the feature of interest
features - the feature table needed for consistancy of the feature system
Returns:
if the feature of interest was set in the original vector.

check

public static boolean check(java.util.BitSet toclear,
                            java.lang.String item,
                            Table2 features)
Checks to see if a feature vector has a particular feature
Parameters:
featurevector - the featurevector to check
the - feature table needed for consistancy of the feature system
Returns:
if the feature of interest is set

parse

public static Triplepair parse(RuleEntryLHS[] rules,
                               java.util.LinkedList deck,
                               DeckEntry[] nodes,
                               int i,
                               java.lang.Integer rule_start_point,
                               Table2 features,
                               TripleStack ttable,
                               boolean application,
                               java.lang.String mode,
                               java.util.Vector parsed_decks)
parses the deck with the rules given
Parameters:
rules - the possible rules to check in array form
deck - the deck in LinkedList form
nodes - the deck in array form
i - the index for the node that is being examined
rule_start_point - the point in the rule array to start the for loop
features - the feature table, needed for consistancy
ttable - the triple structure that the found doublets are stored in
application - used as a flag in the calling method to determine if a rule was applied
mode - needed to know if a NP is to be added to the produced triple
Returns:
a pair containing both the rule used and application flag

deckDisplay

public static void deckDisplay(java.util.LinkedList deck,
                               Table2 features)

clone_deck

public static java.util.LinkedList clone_deck(java.util.LinkedList deck)
Clone a deck.
Parameters:
deck - Deck to clone.