Class Generator

java.lang.Object
  |
  +--Generator

public class Generator
extends java.lang.Object

Generator.java generates sentances based on TripleStacks. At this point the module will not produce random placement of the sentances within a paragraph due to its tight intergration with the VR system & parser


Constructor Summary
Generator(DATA info, java.util.Random rand_in, double threashold)
          Default Constructor
 
Method Summary
protected  sets generate(java.util.LinkedList gstack, int index, TripleEntry triple, int side_a, int side_b, int local_out)
          internal method used for the recursive calls
 java.util.LinkedList generate(TripleStack ttable)
          This is the public call to a recursive routine that generates sentances based on a Triplestack provided
protected  int hasOther(TripleEntry triple, TripleEntry secondary_triple, java.lang.String type)
          Checks if there is an unused Threaded or Secondary link to one of the components in triple
protected  int hasSecondary(TripleEntry triple, TripleEntry secondary_triple)
          Interface to hasOther to check if there is an unused Secondary link to one of the components in triple
protected  int hasThreaded(TripleEntry triple, TripleEntry secondary_triple)
          Interface to hasOther to check if there is an unused Threaded link to one of the components in triple
protected  boolean lhs_filter(RuleEntryLHS rule, DeckEntry workingnode)
           
protected  boolean or_features(RuleEntryLHS rule, TripleEntry triple, int side_a)
           
protected  boolean or_Order(RuleEntryLHS rule, TripleEntry triple, int side)
          Checks to see if the order of the OR in the triple match that in the rule
 void positions(RuleEntryLHS rule, int i, int side, int rule_position, int triple_position, java.lang.String rule_type)
          get the position of where the mapped object should go in the rule
protected  boolean rule_choice(Triplepair toprule, Triplepair bottomrule, DeckEntry[] ready_nodes, RuleEntryLHS rule)
          This choices a rule to check to see if it can be applied
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generator

public Generator(DATA info,
                 java.util.Random rand_in,
                 double threashold)
Default Constructor
Parameters:
info - the DATA node with all the table needed to maintain consistancy
rand_in - the random generator used so that the stream is the same throughout
threashold - the threashold for determining if a threaded link should be followed or not
Method Detail

generate

public java.util.LinkedList generate(TripleStack ttable)
This is the public call to a recursive routine that generates sentances based on a Triplestack provided
Parameters:
ttable - the Triple stack that will be the source of triples
Returns:
a deck that represents a valid sentance

generate

protected sets generate(java.util.LinkedList gstack,
                        int index,
                        TripleEntry triple,
                        int side_a,
                        int side_b,
                        int local_out)
internal method used for the recursive calls
Parameters:
gstack - the stack that is correct at this point
index - the point in the deck that is being worked on
triple - the triple that is to be incorperated in to the sentance
side_a - the left index of the part of the triple that is to be incorperated
sied_b - the right index of the part of the triple that is to be incorperated
Returns:
if half of a triple was successfully intergrated

rule_choice

protected boolean rule_choice(Triplepair toprule,
                              Triplepair bottomrule,
                              DeckEntry[] ready_nodes,
                              RuleEntryLHS rule)
This choices a rule to check to see if it can be applied
Parameters:
toprule - contains the index of the rule with the correct type and highest subscript
bottomrule - contains the index of the rule with the correct type and lowest subscript
ready_nodes - creates a new array for temperary storage of the product of the rule's application
rule - the rule that is choosen
Returns:
If a rule was found that can do the job

lhs_filter

protected boolean lhs_filter(RuleEntryLHS rule,
                             DeckEntry workingnode)

or_Order

protected boolean or_Order(RuleEntryLHS rule,
                           TripleEntry triple,
                           int side)
Checks to see if the order of the OR in the triple match that in the rule
Parameters:
rule - the rule of interst
triple - the triple of interst
side - the index into the triple of interest
Returns:
if the ordering of the triple and the rule match

or_features

protected boolean or_features(RuleEntryLHS rule,
                              TripleEntry triple,
                              int side_a)

hasSecondary

protected int hasSecondary(TripleEntry triple,
                           TripleEntry secondary_triple)
Interface to hasOther to check if there is an unused Secondary link to one of the components in triple
Parameters:
triple - the Triple that is currently being worked on
secondary_triple - the Triple that is a secondary link to one of the components in triple
Returns:
the element number if a there is an element that has a secondary, -1 if none

hasThreaded

protected int hasThreaded(TripleEntry triple,
                          TripleEntry secondary_triple)
Interface to hasOther to check if there is an unused Threaded link to one of the components in triple
Parameters:
triple - the Triple that is currently being worked on
secondary_triple - the Triple that is a threaded link to one of the components in triple
Returns:
the element number if a there is an element that has a threaded, -1 if none

hasOther

protected int hasOther(TripleEntry triple,
                       TripleEntry secondary_triple,
                       java.lang.String type)
Checks if there is an unused Threaded or Secondary link to one of the components in triple
Parameters:
triple - the Triple that is currently being worked on
secondary_triple - the Triple that is a threaded or secondary link to one of the components in triple
Returns:
the element number if a there is an element that has a threaded, -1 if none

positions

public void positions(RuleEntryLHS rule,
                      int i,
                      int side,
                      int rule_position,
                      int triple_position,
                      java.lang.String rule_type)
get the position of where the mapped object should go in the rule
Parameters:
rule - the rule that might be used, if it passes its tests
i - the element in the mapping vector of the rule
side - the element in the triple
rule_position - the location that the object should take in the rule. This is the output of the function
triple_position - the location that the object has in the triple. This is the output of the function
rule_type - the type the rule has. This is the output of the function