enumeration
Class MyEnumerator

java.lang.Object
  extended by enumeration.MyEnumerator
Direct Known Subclasses:
BIEnumerator, SEnumerator

public abstract class MyEnumerator
extends java.lang.Object

Abstract enumerator, enumerating the sentences or parse trees of a general context-free grammar in hierarchical lexicographic order.

Author:
XZW

Field Summary
 ResultType resultType
          The result type of the output
 
Constructor Summary
MyEnumerator()
           
 
Method Summary
 java.lang.String firstHierarchy(int n)
          Returns the first concise parse tree of hierarchy[n]
 java.lang.String getCurrentTree()
          Returns the current concise tree
 MyGrammar getGrammar()
          Returns the grammar
 java.lang.String getParseTree()
          Returns the current parse tree.
 MySentence getSentence()
          Returns the current sentence
 int getStartIndex()
          Returns the start index of the grammar
 java.lang.String lastHierarchy(int n)
          Returns the last concise parse tree of hierarchy[n]
 java.lang.String next()
          Generates the next element.
 java.lang.String next(java.lang.String ctree)
          Returns the next concise tree of a given concise tree
 java.lang.String previous()
          Generates the previous element
 java.lang.String previous(java.lang.String ctree)
          Returns the previous concise tree of a given concise tree
abstract  void setGrammar(MyGrammar grammar)
          Sets the grammar
 void setSentence(java.lang.String sentence)
          Sets the current sentence.
 void setStartIndex(int i)
          Sets the start index to i
 java.lang.String start()
          Returns the first element of L[start]
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultType

public ResultType resultType
The result type of the output

Constructor Detail

MyEnumerator

public MyEnumerator()
Method Detail

start

public java.lang.String start()
Returns the first element of L[start]

Returns:
the first element of L[start]

next

public java.lang.String next()
Generates the next element.

Returns:
the next element.

next

public java.lang.String next(java.lang.String ctree)
Returns the next concise tree of a given concise tree

Parameters:
ctree - the given concise tree
Returns:
the next concise tree

previous

public java.lang.String previous()
Generates the previous element

Returns:
the previous element

previous

public java.lang.String previous(java.lang.String ctree)
Returns the previous concise tree of a given concise tree

Parameters:
ctree - the given concise tree
Returns:
the previous concise tree

getGrammar

public MyGrammar getGrammar()
Returns the grammar

Returns:
the grammar

setGrammar

public abstract void setGrammar(MyGrammar grammar)
Sets the grammar

Parameters:
grammar - the grammar to set
Throws:
java.lang.IllegalArgumentException - if the grammar has useless nonterminals

setStartIndex

public void setStartIndex(int i)
Sets the start index to i

Parameters:
i - the start index to set

getStartIndex

public int getStartIndex()
Returns the start index of the grammar

Returns:
the start index of the grammar

getCurrentTree

public java.lang.String getCurrentTree()
Returns the current concise tree

Returns:
the current concise tree

getParseTree

public java.lang.String getParseTree()
Returns the current parse tree.

Returns:
the current parse tree.

getSentence

public MySentence getSentence()
Returns the current sentence

Returns:
the current sentence

setSentence

public void setSentence(java.lang.String sentence)
Sets the current sentence.

Parameters:
sentence - the sentence to set
Throws:
java.lang.IllegalArgumentException - if the sentence does not belong to the grammar

firstHierarchy

public java.lang.String firstHierarchy(int n)
Returns the first concise parse tree of hierarchy[n]

Parameters:
n - the hierarchy index
Returns:
the first element of hierarchy[n]

lastHierarchy

public java.lang.String lastHierarchy(int n)
Returns the last concise parse tree of hierarchy[n]

Parameters:
n - the hierarchy index
Returns:
the last element of hierarchy[n]