class SuffixTree {

  public boolean containsSuffix(Sequence seq) {
    int state = root;
    int i = 0;
    while (true) {
      // Find an edge leaving the current state marked with symbol sequence[i].
      final int edge = findEdge(state, seq.objectAt(i));
      if (edge < 0) {
        // Different characters on explicit state.
        return false;
      }

      // Follow the edge, checking symbols on the way.
      int j = getStartIndex(edge);
      final int m = getEndIndex(edge) + 1;
      for (; i < seq.size() && j < m; j++, i++) {
        if (seq.objectAt(i) != this.sequence.objectAt(j)) {
          // Different characters on implicit state.
          return false;
        }
      }

      if (i == seq.size()) {
        // End of input sequence must be aligned with the tree's leaf state.
        return j == inputSize;
      }

      // Follow to the child state.
      state = getToState(edge);
    }
  }

  public  SuffixTree(
      Sequence sequence,
      IStateCallback newStateCallback,
      final IProgressCallback progressCallback);

}