Package java.text

Examples of java.text.Collator.compare()


           j < m; j++) {
        Object child = model.getChild(rootChild, j);
        if (j < m - 1) {
          Object nextChild = model.getChild(rootChild, j + 1);
          // Check alphatical order of furniture nodes in tree
          assertTrue("Furniture not sorted", comparator.compare(
              getNodeText(tree, child),
              getNodeText(tree, nextChild)) <= 0);
        }
        assertTrue("Piece not a leaf", model.isLeaf(child));
      }
View Full Code Here


    int order = 0;
    if (a != null && b != null) {
      final String nameA = a.getPageName();
      final String nameB = b.getPageName();
      // Compare page names with the localized comparator
      order = collator.compare(nameA, nameB);
    }
    return order;
  }

}
View Full Code Here

      List<BusinessGroup> participantGroups = course.getCourseEnvironment().getCourseGroupManager().getParticipatingLearningGroupsFromAllContexts(
          assessedIdentity);
      final Collator collator = Collator.getInstance(ureq.getLocale());
      Collections.sort(participantGroups, new Comparator<BusinessGroup>() {
        public int compare(BusinessGroup a, BusinessGroup b) {
          return collator.compare(a.getName(), b.getName());
        }
      });
      detailView.contextPut("participantGroups", participantGroups);
      detailView.contextPut("noParticipantGroups", (participantGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE));
View Full Code Here

        int index = 0;
        for (int i = 1; i < items.length; i++) {
            String value1 = items[i].getText(index);
            for (int j = 0; j < i; j++) {
                String value2 = items[j].getText(index);
                if (collator.compare(value1, value2) < 0) {
                    String[] values = { items[i].getText(0), items[i].getText(1) };
                    items[i].dispose();
                    TableItem item = new TableItem(t, SWT.NONE, j);
                    item.setText(values);
                    items = t.getItems();
View Full Code Here

    int comparison = 0// Will be -1, 0 or 1 depending on whether sLo is <, = or > than sHi
   
    // Strings are handled separately because we have to compare them in given locale.
    if (valueLo instanceof String && valueHi instanceof String) {
      Collator collator = Collator.getInstance(); // TODO: Must be locale-specific
      comparison = collator.compare((String)valueLo, (String)valueHi);
    }
    else if (valueLo instanceof Comparable && valueHi instanceof Comparable){    
      if (loExtendsHi)
        comparison = ((Comparable)valueLo).compareTo(valueHi);
      else
View Full Code Here

    }
    public int compare( String content, String facetValue ){
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( content, facetValue );
    }

    /**
   * Returns a copy of this object.
   */
 
View Full Code Here

    }

    public int compare( String content, String facetValue ){
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( content, facetValue );
    }



    /**
 
View Full Code Here

          return 0;
        if (v1==null)
          return 1;
        if(v2==null)
          return -1;
        return -collator.compare(v1,v2);
      }
    };
  }

View Full Code Here

      try{
        Collator collator = Collator.getInstance();
        String thisName = o1.getString("name");
        String compareName = o2.getString("name");
        if(!thisName.equals(compareName)){
          int retval = collator.compare(thisName, compareName);
          return retval;
        }else{
          String thisAuthorEmail = o1.getString("authorEmail");
          String compareAuthorEmail = o2.getString("authorEmail");
          int retval = collator.compare(thisAuthorEmail, compareAuthorEmail);
View Full Code Here

          int retval = collator.compare(thisName, compareName);
          return retval;
        }else{
          String thisAuthorEmail = o1.getString("authorEmail");
          String compareAuthorEmail = o2.getString("authorEmail");
          int retval = collator.compare(thisAuthorEmail, compareAuthorEmail);
          return retval;
        }
      } catch (JSONException e) {
      }
    return 0;
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.