示例#1
0
  private Stack<Cell> forwardPath(Cell lexemeCell, LexemePath option) {
    Stack conflictStack = new Stack();

    for (Cell c = lexemeCell; c != null && c.getLexeme() != null; c = c.getNext()) {
      if (!option.addNotCrossLexeme(c.getLexeme())) {
        conflictStack.push(c);
      }
    }

    return conflictStack;
  }
示例#2
0
  private LexemePath judge(Cell lexemeCell, int fullTextLength) {
    TreeSet pathOptions = new TreeSet();
    LexemePath option = new LexemePath();
    Stack lexemeStack = this.forwardPath(lexemeCell, option);
    pathOptions.add(option.copy());
    Cell c = null;

    while (!lexemeStack.isEmpty()) {
      c = (Cell) lexemeStack.pop();
      this.backPath(c.getLexeme(), option);
      this.forwardPath(c, option);
      pathOptions.add(option.copy());
    }

    return (LexemePath) pathOptions.first();
  }