Code example for MatchResult

Methods: end, start

0
  //    length (longest first), 
  public final static Comparator<MatchResult> LENGTH_COMPARATOR =
    new Comparator<MatchResult>() { 
      public int compare(MatchResult e1, MatchResult e2) { 
        int len1 = e1.end() - e1.start(); 
        int len2 = e2.end() - e2.start(); 
        if (len1 == len2) { 
          return 0; 
        } else { 
          return (len1 > len2)? -1:1; 
        } 
      } 
    }; 
 
  public final static Comparator<MatchResult> OFFSET_COMPARATOR =
    new Comparator<MatchResult>() { 
      public int compare(MatchResult e1, MatchResult e2) { 
        if (e1.start() == e2.start()) { 
          if (e1.end() == e2.end()) { 
            return 0; 
          } else {