Exemplo n.º 1
0
  /**
   * Attempt to combine an item in the dot chart with an item in the chart to create a new item in
   * the dot chart.
   *
   * <p>In other words, this method looks for (proved) theorems or axioms in the completed chart
   * that may apply and extend the dot position.
   *
   * @param i Start index of a dot chart item
   * @param k End index of a dot chart item; start index of a completed chart item
   * @param j End index of a completed chart item
   * @param startDotItems
   */
  private void extendDotItemsWithProvedItems(int i, int k, int j, boolean startDotItems) {
    if (this.dotbins[i][k] == null || this.pChart.getCell(k, j) == null) {
      return;
    }

    // complete super-items
    List<SuperNode> t_ArrayList =
        new ArrayList<SuperNode>(this.pChart.getCell(k, j).getSortedSuperItems().values());

    // dotitem in dot_bins[i][k]: looking for an item in the right to the dot
    for (DotNode dt : dotbins[i][k].dotNodes) {
      // see if it matches what the dotitem is looking for
      for (SuperNode s_t : t_ArrayList) {
        Trie child_tnode = dt.trieNode.matchOne(s_t.lhs);
        if (null != child_tnode) {
          if (true == startDotItems && !child_tnode.hasExtensions()) {
            continue; // TODO
          }
          addDotItem(
              child_tnode,
              i,
              j,
              dt.getAntSuperNodes(),
              s_t,
              dt.getSourcePath().extendNonTerminal());
        }
      }
    }
  }