enumeration.biginteger
Class BIEnumerator

java.lang.Object
  extended by enumeration.MyEnumerator
      extended by enumeration.biginteger.BIEnumerator

public class BIEnumerator
extends MyEnumerator

Enumerator, using big integer as the type of volume data to compute and store the specific volume data.

Author:
XZW

Field Summary
 NextMode nextMode
          Next mode : bottom up or top down
 
Fields inherited from class enumeration.MyEnumerator
resultType
 
Constructor Summary
BIEnumerator(MyGrammar grammar)
          Creates an instance of enumerator.
 
Method Summary
 java.math.BigInteger getClusterData(int n, int pi)
          Returns the volume data cluster[n][pi].
 java.math.BigInteger getCubeData(int n, int pi, int k)
          Returns the volume data cube[n][pi][k].
 java.math.BigInteger getCurrentSequence()
          Returns the current sequence.
 java.math.BigInteger getHeapData(int n, int i)
          Returns the volume data heap[n][i].
 java.math.BigInteger getHierarchyData(int n, int i)
          Returns the volume data hierarchy[n][i].
 java.math.BigInteger L2N(java.lang.String sentence)
          Returns the sequence number of a given element (sentence represent) if the sentence does not belong to the grammar, return -1;
 java.lang.String N2L(java.math.BigInteger q)
          Returns the q-th element
 java.lang.String next()
          Generates the next element.
 java.lang.String next(java.lang.String ctree, java.math.BigInteger q)
          Returns the next concise tree of a given concise tree whose sequence number is q.
 java.lang.String previous()
          Generates the previous element
 void setGrammar(MyGrammar grammar)
          Sets the grammar
 void setSentence(java.lang.String sentence)
          Sets the current sentence.
 void setSequence(java.math.BigInteger q)
          Sets the current sequence to q.
 java.lang.String start()
          Returns the first element of L[start]
 
Methods inherited from class enumeration.MyEnumerator
firstHierarchy, getCurrentTree, getGrammar, getParseTree, getSentence, getStartIndex, lastHierarchy, next, previous, setStartIndex
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextMode

public NextMode nextMode
Next mode : bottom up or top down

Constructor Detail

BIEnumerator

public BIEnumerator(MyGrammar grammar)
Creates an instance of enumerator.

Parameters:
grammar - the grammar for enumeration
Method Detail

setGrammar

public void setGrammar(MyGrammar grammar)
Description copied from class: MyEnumerator
Sets the grammar

Specified by:
setGrammar in class MyEnumerator
Parameters:
grammar - the grammar to set

start

public java.lang.String start()
Description copied from class: MyEnumerator
Returns the first element of L[start]

Overrides:
start in class MyEnumerator
Returns:
the first element of L[start]

next

public java.lang.String next()
Description copied from class: MyEnumerator
Generates the next element.

Overrides:
next in class MyEnumerator
Returns:
the next element.

next

public java.lang.String next(java.lang.String ctree,
                             java.math.BigInteger q)
Returns the next concise tree of a given concise tree whose sequence number is q.

Parameters:
ctree - the given concise tree
q - the given sequence number
Returns:
the next concise tree

previous

public java.lang.String previous()
Description copied from class: MyEnumerator
Generates the previous element

Overrides:
previous in class MyEnumerator
Returns:
the previous element

getHierarchyData

public java.math.BigInteger getHierarchyData(int n,
                                             int i)
Returns the volume data hierarchy[n][i].

Parameters:
n - the hierarchy index
i - the variable index
Returns:
the volume data hierarchy[n][i].
Throws:
java.lang.IllegalArgumentException - if n < 0 or i < 0 or i >= variable number

getHeapData

public java.math.BigInteger getHeapData(int n,
                                        int i)
Returns the volume data heap[n][i].

Parameters:
n - the hierarchy index
i - the variable index
Returns:
the volume data heap[n][i].
Throws:
java.lang.IllegalArgumentException - if n < 0 or i < 0 or i >= variable number

getClusterData

public java.math.BigInteger getClusterData(int n,
                                           int pi)
Returns the volume data cluster[n][pi].

Parameters:
n - the hierarchy index
pi - the production index
Returns:
the volume data cluster[n][pi].
Throws:
java.lang.IllegalArgumentException - if n < 0 or pi is terminal

getCubeData

public java.math.BigInteger getCubeData(int n,
                                        int pi,
                                        int k)
Returns the volume data cube[n][pi][k].

Parameters:
n - the hierarchy index
pi - the production index
k - the cube index (the variable index in the RHS)
Returns:
the volume data cube[n][pi][k].
Throws:
java.lang.IllegalArgumentException - if n < 0 or pi is terminal or k < 0 or k >= the variable number at pi's RHS

getCurrentSequence

public java.math.BigInteger getCurrentSequence()
Returns the current sequence.

Returns:
the current sequence.

setSequence

public void setSequence(java.math.BigInteger q)
Sets the current sequence to q.

Parameters:
q - the sequence

setSentence

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

Overrides:
setSentence in class MyEnumerator
Parameters:
sentence - the sentence to set

N2L

public java.lang.String N2L(java.math.BigInteger q)
Returns the q-th element

Parameters:
q - the sequence number
Returns:
the q-th element

L2N

public java.math.BigInteger L2N(java.lang.String sentence)
Returns the sequence number of a given element (sentence represent) if the sentence does not belong to the grammar, return -1;

Parameters:
sentence - the given element (sentence represent)
Returns:
the sequence number