Class EarleySet

java.lang.Object
org.libxmq.imp.ixml.earley.EarleySet

public final class EarleySet extends Object
The Earley set for one input position: the items that are alive there. Set k holds the items whose matched part ends at position k. The items are kept in the order they were added, so the parser can work through the set with an index while new items are appended to it. An item is only added once.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The input position of this set.
    final int
    The token read at this position (see Tokens), -1 in the last set, at the end of the input.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Item item)
    Returns true if the item is in the set.
    get(int i)
    The item at index i, in the order the items were added.
    boolean
    Returns true if there are no items: the parse died before this position.
    The items, in the order they were added.
    int
    The number of items.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • position

      public final int position
      The input position of this set.
    • token

      public final int token
      The token read at this position (see Tokens), -1 in the last set, at the end of the input.
  • Method Details

    • contains

      public boolean contains(Item item)
      Returns true if the item is in the set.
      Parameters:
      item - the item
      Returns:
      true if present
    • get

      public Item get(int i)
      The item at index i, in the order the items were added.
      Parameters:
      i - the index
      Returns:
      the item
    • size

      public int size()
      The number of items.
      Returns:
      the size
    • isEmpty

      public boolean isEmpty()
      Returns true if there are no items: the parse died before this position.
      Returns:
      true if empty
    • items

      public List<Item> items()
      The items, in the order they were added.
      Returns:
      a read only view