Package java.util

Examples of java.util.Comparator.compare()


         *         specified attribute object
   */
  public boolean equals(Object o) {
      if (o instanceof Name) {
    Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
    return c.compare(name, ((Name)o).name) == 0;
      } else {
    return false;
      }
  }
     
View Full Code Here


    indices = identity(n);
    time = System.currentTimeMillis();
    sort(indices, data, cmp, false);
    System.out.println(System.currentTimeMillis()-time  + "ms");
    for (int i = 1; i < n; i++)
      if (cmp.compare(data[indices[i-1]], data[indices[i]]) > 0)
        System.err.println("proplem: quickSort at " + i);

    System.out.print("quicksort stable...");
//    indices = identity(n);
    time = System.currentTimeMillis();
View Full Code Here

//    indices = identity(n);
    time = System.currentTimeMillis();
    sort(indices, data, cmp, true);
    System.out.println(System.currentTimeMillis()-time + "ms");
    for (int i = 1; i < n; i++) {
      int res = cmp.compare(data[indices[i-1]], data[indices[i]]);
      if (res > 0)
        System.err.println("proplem: quickSort stable at " + i);
      if (res == 0 && indices[i-1] > indices[i])
        System.err.println("proplem: quickSort stable (not stable) at " + i);
    }
View Full Code Here

    System.out.print("permutate copy...");
    time = System.currentTimeMillis();
    Object[] data_copy = permute(inverse(indices), data, true);
    System.out.println(System.currentTimeMillis()-time + "ms");
    for (int i = 1; i < n; i++)
      if (cmp.compare(data_copy[i-1], data_copy[i]) > 0)
        System.err.println("proplem: permute copy at " + i);

    System.out.print("permutate original...");
    time = System.currentTimeMillis();
    permute(inverse(indices), data, false);
View Full Code Here

    System.out.print("permutate original...");
    time = System.currentTimeMillis();
    permute(inverse(indices), data, false);
    System.out.println(System.currentTimeMillis()-time + "ms");
    for (int i = 1; i < n; i++)
      if (cmp.compare(data[i-1], data[i]) > 0)
        System.err.println("proplem: permute original at " + i);
  }
}
View Full Code Here

        groups.add(group);
        for (int i=0; i<resultSet.size(); i++)
        {
            if (i > 0)
            {
                if (c.compare(resultSet.get(i-1),resultSet.get(i)) != 0)
                {
                    group = new ArrayList();
                    groups.add(group);
                }
            }
View Full Code Here

            }
            for (int i = 0; i < resultSet.size(); i++)
            {
                if (i > 0)
                {
                    if (c.compare(resultSet.get(i - 1), resultSet.get(i)) != 0)
                    {
                        group = new ArrayList();
                        groups.add(group);
                    }
                }
View Full Code Here

        groups.add(group);
        for (int i=0; i<resultSet.size(); i++)
        {
            if (i > 0)
            {
                if (c.compare(resultSet.get(i-1),resultSet.get(i)) != 0)
                {
                    group = new ArrayList();
                    groups.add(group);
                }
            }
View Full Code Here

            }
            for (int i = 0; i < resultSet.size(); i++)
            {
                if (i > 0)
                {
                    if (c.compare(resultSet.get(i - 1), resultSet.get(i)) != 0)
                    {
                        group = new ArrayList();
                        groups.add(group);
                    }
                }
View Full Code Here

                    continue;
                }
                acceptedIdsBuffer.add(nextObjectId);
                if(syntheticComparator!=null && comparison_state!=COMPARISON_STATE.MIXED){
                    if(syntheticSubjectPrev!=null ){
                        int compareResult = syntheticComparator.compare(syntheticSubjectPrev._syntheticSubject, syntheticSubject._syntheticSubject);
                        if ((compareResult < 0 && comparison_state == COMPARISON_STATE.DESCENDING)
                                || (compareResult > 0 && comparison_state == COMPARISON_STATE.ASCENDING))
                        {
                            comparison_state = COMPARISON_STATE.MIXED;
                            continue;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.