test_class.file: core/src/test/java/org/carrot2/text/suffixtree/SuffixTreeTest.java
test_class.identifier: SuffixTreeTest
test_class.superclass: extends TestBase
test_case.body: @Test
    public void checkRandomSymbols() {
      final int[] input = new int[scaledRandomIntBetween(1, 25000)];
      for (int i = 0; i < input.length; i++) {
        input[i] = randomIntBetween(0, 100);
      }
      input[input.length - 1] = Integer.MAX_VALUE;
  
      final SuffixTree stree =
          SuffixTreeBuilder.from(
                  new Sequence() {
                    public int objectAt(int i) {
                      return input[i];
                    }
  
                    public int size() {
                      return input.length;
                    }
                  })
              .build();
  
      for (int i = 0; i < Math.min(5000, input.length); i++) {
        stree.containsSuffix(new IntegerSequence(input, i, input.length - i));
      }
    }
test_case.class_method_signature: SuffixTreeTest.checkRandomSymbols()
test_case.full_signature: @Test public void checkRandomSymbols()
test_case.identifier: checkRandomSymbols
test_case.invocations: scaledRandomIntBetween randomIntBetween build from min containsSuffix
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void checkRandomSymbols()
focal_class.declarator: NO_SUFFIX_LINK = Integer.MIN_VALUE
focal_class.modifier: private static final
focal_class.original_string: private static final int NO_SUFFIX_LINK = Integer.MIN_VALUE;
focal_class.type: int
focal_class.var_name: NO_SUFFIX_LINK
focal_class.declarator: LEAF_STATE = -1
focal_class.modifier: private static final
focal_class.original_string: private static final int LEAF_STATE = -1;
focal_class.type: int
focal_class.var_name: LEAF_STATE
focal_class.declarator: NO_EDGE = -1
focal_class.modifier: public static final
focal_class.original_string: public static final int NO_EDGE = -1;
focal_class.type: int
focal_class.var_name: NO_EDGE
focal_class.declarator: ROOT_STATE = 1
focal_class.modifier: private static final
focal_class.original_string: private static final int ROOT_STATE = 1;
focal_class.type: int
focal_class.var_name: ROOT_STATE
focal_class.declarator: sequence
focal_class.modifier: final
focal_class.original_string: final Sequence sequence;
focal_class.type: Sequence
focal_class.var_name: sequence
focal_class.declarator: inputSize
focal_class.modifier: private final
focal_class.original_string: private final int inputSize;
focal_class.type: int
focal_class.var_name: inputSize
focal_class.declarator: states = new IntArrayList()
focal_class.modifier: private
focal_class.original_string: private IntArrayList states = new IntArrayList();
focal_class.type: IntArrayList
focal_class.var_name: states
focal_class.declarator: transitions_map = new LongIntScatterMap()
focal_class.modifier: private final
focal_class.original_string: private final LongIntScatterMap transitions_map = new LongIntScatterMap();
focal_class.type: LongIntScatterMap
focal_class.var_name: transitions_map
focal_class.declarator: transitions = new IntArrayList()
focal_class.modifier: private final
focal_class.original_string: private final IntArrayList transitions = new IntArrayList();
focal_class.type: IntArrayList
focal_class.var_name: transitions
focal_class.declarator: s
focal_class.modifier: private
focal_class.original_string: private int s, k, i;
focal_class.type: int
focal_class.var_name: s
focal_class.declarator: end_point
focal_class.modifier: private
focal_class.original_string: private boolean end_point;
focal_class.type: boolean
focal_class.var_name: end_point
focal_class.declarator: head
focal_class.modifier: private final
focal_class.original_string: private final int head, root;
focal_class.type: int
focal_class.var_name: head
focal_class.declarator: root_transition
focal_class.modifier: private final
focal_class.original_string: private final int root_transition;
focal_class.type: int
focal_class.var_name: root_transition
focal_class.declarator: slots_per_transition
focal_class.modifier: private final
focal_class.original_string: private final int slots_per_transition;
focal_class.type: int
focal_class.var_name: slots_per_transition
focal_class.declarator: newStateCallback
focal_class.modifier: private final
focal_class.original_string: private final IStateCallback newStateCallback;
focal_class.type: IStateCallback
focal_class.var_name: newStateCallback
focal_class.file: core/src/main/java/org/carrot2/text/suffixtree/SuffixTree.java
focal_class.identifier: SuffixTree
focal_class.class_method_signature: SuffixTree.SuffixTree(
        Sequence sequence,
        IStateCallback newStateCallback,
        final IProgressCallback progressCallback)
focal_class.full_signature: public  SuffixTree(
        Sequence sequence,
        IStateCallback newStateCallback,
        final IProgressCallback progressCallback)
focal_class.identifier: SuffixTree
focal_class.modifiers: public
focal_class.parameters: (
        Sequence sequence,
        IStateCallback newStateCallback,
        final IProgressCallback progressCallback)
focal_class.signature:  SuffixTree(
        Sequence sequence,
        IStateCallback newStateCallback,
        final IProgressCallback progressCallback)
focal_class.class_method_signature: SuffixTree.update()
focal_class.full_signature: private final void update()
focal_class.identifier: update
focal_class.modifiers: private final
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void update()
focal_class.class_method_signature: SuffixTree.testAndSplit(int p, int ti)
focal_class.full_signature: private final int testAndSplit(int p, int ti)
focal_class.identifier: testAndSplit
focal_class.modifiers: private final
focal_class.parameters: (int p, int ti)
focal_class.return: int
focal_class.signature: int testAndSplit(int p, int ti)
focal_class.class_method_signature: SuffixTree.canonize(int s, int k, int p)
focal_class.full_signature: private void canonize(int s, int k, int p)
focal_class.identifier: canonize
focal_class.modifiers: private
focal_class.parameters: (int s, int k, int p)
focal_class.return: void
focal_class.signature: void canonize(int s, int k, int p)
focal_class.class_method_signature: SuffixTree.setSuffixLink(int fromState, int toState)
focal_class.full_signature: private void setSuffixLink(int fromState, int toState)
focal_class.identifier: setSuffixLink
focal_class.modifiers: private
focal_class.parameters: (int fromState, int toState)
focal_class.return: void
focal_class.signature: void setSuffixLink(int fromState, int toState)
focal_class.class_method_signature: SuffixTree.getSuffixLink(int s)
focal_class.full_signature: private int getSuffixLink(int s)
focal_class.identifier: getSuffixLink
focal_class.modifiers: private
focal_class.parameters: (int s)
focal_class.return: int
focal_class.signature: int getSuffixLink(int s)
focal_class.class_method_signature: SuffixTree.createNewState(int position)
focal_class.full_signature: private final int createNewState(int position)
focal_class.identifier: createNewState
focal_class.modifiers: private final
focal_class.parameters: (int position)
focal_class.return: int
focal_class.signature: int createNewState(int position)
focal_class.class_method_signature: SuffixTree.createState()
focal_class.full_signature: private final int createState()
focal_class.identifier: createState
focal_class.modifiers: private final
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int createState()
focal_class.class_method_signature: SuffixTree.createTransition(int s, int k, int p, int ts)
focal_class.full_signature: private final void createTransition(int s, int k, int p, int ts)
focal_class.identifier: createTransition
focal_class.modifiers: private final
focal_class.parameters: (int s, int k, int p, int ts)
focal_class.return: void
focal_class.signature: void createTransition(int s, int k, int p, int ts)
focal_class.class_method_signature: SuffixTree.reuseTransition(int transition, int s, int k, int p, int ts)
focal_class.full_signature: private final void reuseTransition(int transition, int s, int k, int p, int ts)
focal_class.identifier: reuseTransition
focal_class.modifiers: private final
focal_class.parameters: (int transition, int s, int k, int p, int ts)
focal_class.return: void
focal_class.signature: void reuseTransition(int transition, int s, int k, int p, int ts)
focal_class.class_method_signature: SuffixTree.addTransition(int ts, int k, int p)
focal_class.full_signature: private final int addTransition(int ts, int k, int p)
focal_class.identifier: addTransition
focal_class.modifiers: private final
focal_class.parameters: (int ts, int k, int p)
focal_class.return: int
focal_class.signature: int addTransition(int ts, int k, int p)
focal_class.class_method_signature: SuffixTree.findTransition(int s, int k)
focal_class.full_signature: private final int findTransition(int s, int k)
focal_class.identifier: findTransition
focal_class.modifiers: private final
focal_class.parameters: (int s, int k)
focal_class.return: int
focal_class.signature: int findTransition(int s, int k)
focal_class.class_method_signature: SuffixTree.removeTransition(int s, int k)
focal_class.full_signature: private int removeTransition(int s, int k)
focal_class.identifier: removeTransition
focal_class.modifiers: private
focal_class.parameters: (int s, int k)
focal_class.return: int
focal_class.signature: int removeTransition(int s, int k)
focal_class.class_method_signature: SuffixTree.asLong(int i1, int i2)
focal_class.full_signature: private static final long asLong(int i1, int i2)
focal_class.identifier: asLong
focal_class.modifiers: private static final
focal_class.parameters: (int i1, int i2)
focal_class.return: long
focal_class.signature: long asLong(int i1, int i2)
focal_class.class_method_signature: SuffixTree.getTransitionsCount()
focal_class.full_signature: public final int getTransitionsCount()
focal_class.identifier: getTransitionsCount
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getTransitionsCount()
focal_class.class_method_signature: SuffixTree.getStatesCount()
focal_class.full_signature: public final int getStatesCount()
focal_class.identifier: getStatesCount
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getStatesCount()
focal_class.class_method_signature: SuffixTree.containsSuffix(Sequence seq)
focal_class.full_signature: public boolean containsSuffix(Sequence seq)
focal_class.identifier: containsSuffix
focal_class.modifiers: public
focal_class.parameters: (Sequence seq)
focal_class.return: boolean
focal_class.signature: boolean containsSuffix(Sequence seq)
focal_class.class_method_signature: SuffixTree.visit(final IVisitor visitor)
focal_class.full_signature: public final void visit(final IVisitor visitor)
focal_class.identifier: visit
focal_class.modifiers: public final
focal_class.parameters: (final IVisitor visitor)
focal_class.return: void
focal_class.signature: void visit(final IVisitor visitor)
focal_class.class_method_signature: SuffixTree.visitState(final int state, final IVisitor visitor)
focal_class.full_signature: public final void visitState(final int state, final IVisitor visitor)
focal_class.identifier: visitState
focal_class.modifiers: public final
focal_class.parameters: (final int state, final IVisitor visitor)
focal_class.return: void
focal_class.signature: void visitState(final int state, final IVisitor visitor)
focal_class.class_method_signature: SuffixTree.getRootState()
focal_class.full_signature: public int getRootState()
focal_class.identifier: getRootState
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getRootState()
focal_class.class_method_signature: SuffixTree.isLeaf(int state)
focal_class.full_signature: public final boolean isLeaf(int state)
focal_class.identifier: isLeaf
focal_class.modifiers: public final
focal_class.parameters: (int state)
focal_class.return: boolean
focal_class.signature: boolean isLeaf(int state)
focal_class.class_method_signature: SuffixTree.firstEdge(int state)
focal_class.full_signature: public final int firstEdge(int state)
focal_class.identifier: firstEdge
focal_class.modifiers: public final
focal_class.parameters: (int state)
focal_class.return: int
focal_class.signature: int firstEdge(int state)
focal_class.class_method_signature: SuffixTree.nextEdge(int edge)
focal_class.full_signature: public final int nextEdge(int edge)
focal_class.identifier: nextEdge
focal_class.modifiers: public final
focal_class.parameters: (int edge)
focal_class.return: int
focal_class.signature: int nextEdge(int edge)
focal_class.class_method_signature: SuffixTree.findEdge(int state, int symbol)
focal_class.full_signature: public final int findEdge(int state, int symbol)
focal_class.identifier: findEdge
focal_class.modifiers: public final
focal_class.parameters: (int state, int symbol)
focal_class.return: int
focal_class.signature: int findEdge(int state, int symbol)
focal_class.class_method_signature: SuffixTree.getToState(int edge)
focal_class.full_signature: public int getToState(int edge)
focal_class.identifier: getToState
focal_class.modifiers: public
focal_class.parameters: (int edge)
focal_class.return: int
focal_class.signature: int getToState(int edge)
focal_class.class_method_signature: SuffixTree.getStartIndex(int edge)
focal_class.full_signature: public int getStartIndex(int edge)
focal_class.identifier: getStartIndex
focal_class.modifiers: public
focal_class.parameters: (int edge)
focal_class.return: int
focal_class.signature: int getStartIndex(int edge)
focal_class.class_method_signature: SuffixTree.getEndIndex(int edge)
focal_class.full_signature: public int getEndIndex(int edge)
focal_class.identifier: getEndIndex
focal_class.modifiers: public
focal_class.parameters: (int edge)
focal_class.return: int
focal_class.signature: int getEndIndex(int edge)
focal_method.body: 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);
      }
    }
focal_method.class_method_signature: SuffixTree.containsSuffix(Sequence seq)
focal_method.full_signature: public boolean containsSuffix(Sequence seq)
focal_method.identifier: containsSuffix
focal_method.invocations: findEdge objectAt getStartIndex getEndIndex size objectAt objectAt size getToState
focal_method.modifiers: public
focal_method.parameters: (Sequence seq)
focal_method.return: boolean
focal_method.signature: boolean containsSuffix(Sequence seq)