Class TreeNumber


  • public class TreeNumber
    extends java.lang.Object
    A numbering of potential trees.

    This object is used to keep track of what sequential parses have yet to be discovered.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      int length
      The length of the number.
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeNumber()
      Create a tree number.
      TreeNumber​(TreeNumber seed, int base)
      Create a tree number with the initial seed and base.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void advance()
      Advance to the next number.
      int digit​(int pos)
      Returns the digit at the specified position.
      boolean hasDigits​(java.lang.Integer... check)
      Check if the number has the specified digits
      boolean isMax()
      Have we reached the maximum value for this number?
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • length

        public final int length
        The length of the number.
    • Constructor Detail

      • TreeNumber

        public TreeNumber()
        Create a tree number.
      • TreeNumber

        public TreeNumber​(TreeNumber seed,
                          int base)
        Create a tree number with the initial seed and base.
        Parameters:
        seed - the seed.
        base - the base.
    • Method Detail

      • isMax

        public boolean isMax()
        Have we reached the maximum value for this number?
        Returns:
        true if we have.
      • advance

        public void advance()
        Advance to the next number.
        Throws:
        java.lang.IllegalStateException - if the maximum value has been reached.
      • digit

        public int digit​(int pos)
        Returns the digit at the specified position.
        Parameters:
        pos - the position.
        Returns:
        the digit
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if the position is out of range.
      • hasDigits

        public boolean hasDigits​(java.lang.Integer... check)
        Check if the number has the specified digits
        Parameters:
        check - the digits.
        Returns:
        true if it does.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object