示例#1
0
 public int compare(Object o1, Object o2) {
   if (o1 == o2) return 0;
   Collator collator = Collator.getInstance();
   if (o1 instanceof MethodElement && o2 instanceof MethodElement) {
     return collator.compare(((MethodElement) o1).getName(), ((MethodElement) o2).getName());
   }
   Object o1unwrap = TngUtil.unwrap(o1);
   Object o2unwrap = TngUtil.unwrap(o2);
   if (o1unwrap instanceof MethodElement && o2unwrap instanceof MethodElement) {
     return collator.compare(
         ((MethodElement) o1unwrap).getName(), ((MethodElement) o2unwrap).getName());
   }
   return 0;
 }
  public int findInsertionPointIndex(String token, final AtomicBoolean interrupted) {
    token = normalizeToken(token);

    int start = 0;
    int end = sortedIndexEntries.size();

    final Collator sortCollator = sortLanguage.getCollator();
    while (start < end) {
      final int mid = (start + end) / 2;
      if (interrupted.get()) {
        return -1;
      }
      final IndexEntry midEntry = sortedIndexEntries.get(mid);

      final int comp = sortCollator.compare(token, midEntry.normalizedToken());
      if (comp == 0) {
        final int result = windBackCase(token, mid, interrupted);
        return result;
      } else if (comp < 0) {
        // System.out.println("Upper bound: " + midEntry + ", norm=" +
        // midEntry.normalizedToken() + ", mid=" + mid);
        end = mid;
      } else {
        // System.out.println("Lower bound: " + midEntry + ", norm=" +
        // midEntry.normalizedToken() + ", mid=" + mid);
        start = mid + 1;
      }
    }

    // If we search for a substring of a string that's in there, return
    // that.
    int result = Math.min(start, sortedIndexEntries.size() - 1);
    result = windBackCase(sortedIndexEntries.get(result).normalizedToken(), result, interrupted);
    return result;
  }
示例#3
0
 private static int comparePresentationName(MethodElement e1, MethodElement e2) {
   Collator collator = Collator.getInstance();
   String name1 =
       e1 instanceof BreakdownElement
           ? ProcessUtil.getPresentationName((BreakdownElement) e1)
           : e1.getPresentationName();
   if (name1.length() < 1) name1 = e1.getName();
   String name2 =
       e2 instanceof BreakdownElement
           ? ProcessUtil.getPresentationName((BreakdownElement) e2)
           : e2.getPresentationName();
   if (name2.length() < 1) name2 = e2.getName();
   return collator.compare(name1, name2);
 }
示例#4
0
        public int compare(Object o1, Object o2) {
          if (o1 == o2) return 0;
          o1 = getMethodElement(o1);
          if (o1 == null) {
            return 0;
          }

          o2 = getMethodElement(o2);
          if (o2 == null) {
            return 0;
          }
          MethodElement e1 = (MethodElement) o1;
          MethodElement e2 = (MethodElement) o2;

          Collator collator = Collator.getInstance();
          ;
          return collator.compare(e1.getName() + e1.getGuid(), e2.getName() + e2.getGuid());
        }
示例#5
0
 public int compare(Object arg0, Object arg1) {
   String s1 = ((IEditorDescriptor) arg0).getLabel();
   String s2 = ((IEditorDescriptor) arg1).getLabel();
   return collator.compare(s1, s2);
 }
示例#6
0
 public int compareTo(Object o) {
   return collator.compare(label, ((ResourceDescriptor) o).label);
 }
 @Override
 public int compare(IWorkingSetConfiguration o1, IWorkingSetConfiguration o2) {
   return collator.compare(o1.getName(), o2.getName());
 }