test_class.file: core/src/test/java/org/carrot2/text/preprocessing/SubstringComparatorTest.java
test_class.identifier: SubstringComparatorTest
test_class.superclass: extends TestBase
test_case.body: @Test
    public void testComparatorContract() {
      int[] tokensWordIndex = new int[2];
      int[] wordsStemIndex = new int[1];
      Substring a = new Substring(0, 0, 1, 0);
  
      Assert.assertEquals(0, new SubstringComparator(tokensWordIndex, wordsStemIndex).compare(a, a));
    }
test_case.class_method_signature: SubstringComparatorTest.testComparatorContract()
test_case.full_signature: @Test public void testComparatorContract()
test_case.identifier: testComparatorContract
test_case.invocations: assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testComparatorContract()
focal_class.declarator: serialVersionUID = 1L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = 1L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: tokensWordIndex
focal_class.modifier: private final
focal_class.original_string: private final int[] tokensWordIndex;
focal_class.type: int[]
focal_class.var_name: tokensWordIndex
focal_class.declarator: wordsStemIndex
focal_class.modifier: private final
focal_class.original_string: private final int[] wordsStemIndex;
focal_class.type: int[]
focal_class.var_name: wordsStemIndex
focal_class.file: core/src/main/java/org/carrot2/text/preprocessing/SubstringComparator.java
focal_class.identifier: SubstringComparator
focal_class.interfaces: implements Comparator<Substring>, Serializable
focal_class.class_method_signature: SubstringComparator.SubstringComparator(int[] tokensWordIndex, int[] wordsStemIndex)
focal_class.full_signature: public  SubstringComparator(int[] tokensWordIndex, int[] wordsStemIndex)
focal_class.identifier: SubstringComparator
focal_class.modifiers: public
focal_class.parameters: (int[] tokensWordIndex, int[] wordsStemIndex)
focal_class.signature:  SubstringComparator(int[] tokensWordIndex, int[] wordsStemIndex)
focal_class.class_method_signature: SubstringComparator.compare(Substring s1, Substring s2)
focal_class.full_signature: public int compare(Substring s1, Substring s2)
focal_class.identifier: compare
focal_class.modifiers: public
focal_class.parameters: (Substring s1, Substring s2)
focal_class.return: int
focal_class.signature: int compare(Substring s1, Substring s2)
focal_method.body: public int compare(Substring s1, Substring s2) {
      final int s1From = s1.from;
      final int s1To = s1.to;
      final int s2From = s2.from;
      final int s2To = s2.to;
  
      final int s2Length = s2To - s2From;
      final int s1Length = s1To - s1From;
      if (s1Length != s2Length) {
        return s1Length - s2Length;
      }
  
      assert s1Length == s2Length;
      for (int i = 0; i < s1Length; i++) {
        final int stemIndex1 = wordsStemIndex[tokensWordIndex[s1From + i]];
        final int stemIndex2 = wordsStemIndex[tokensWordIndex[s2From + i]];
        if (stemIndex1 != stemIndex2) {
          return stemIndex1 - stemIndex2;
        }
      }
  
      // If the substrings are equal in the inflection-insensitive way, return 0 (equivalence class).
      return 0;
    }
focal_method.class_method_signature: SubstringComparator.compare(Substring s1, Substring s2)
focal_method.full_signature: public int compare(Substring s1, Substring s2)
focal_method.identifier: compare
focal_method.modifiers: public
focal_method.parameters: (Substring s1, Substring s2)
focal_method.return: int
focal_method.signature: int compare(Substring s1, Substring s2)