Class EarleyChart

java.lang.Object
org.nineml.coffeegrinder.parser.EarleyChart

public class EarleyChart extends Object
The chart used for Earley parsing.
  • Method Details

    • size

      public int size()
      How big is the chart?
      Returns:
      the number of rows in the chart.
    • get

      public List<EarleyItem> get(int row)
      Get a row from the chart.

      The chart will be enlarged if necessary.

      Parameters:
      row - the row number (0-indexed).
      Returns:
      the contents of the row.
    • contains

      public boolean contains(int row, EarleyItem item)
      Determine if an item is in the chart.

      This method will be faster than a linear search of the row.

      Parameters:
      row - the row to search
      item - the item to search form
      Returns:
      true if the row contains the item