Examples of Comparator


Examples of java.util.Comparator

   
    List b = new ArrayList( bads );
   
    Collections.sort(
      b,
      new Comparator()
      {
        public int
        compare(
          Object o1,
          Object o2 )
View Full Code Here

Examples of java.util.Comparator

      subscriptionItems[currentSelection].selected = true;
    }
   
    final int dir = subscriptionsList.getSortDirection() == SWT.DOWN ? 1 : -1;
    final boolean nameSort = subscriptionsList.getColumn(0) == subscriptionsList.getSortColumn();
    Arrays.sort(subscriptionItems,new Comparator() {
      public int compare(Object arg0, Object arg1) {
        SubscriptionItemModel item0 = (SubscriptionItemModel) arg0;
        SubscriptionItemModel item1 = (SubscriptionItemModel) arg1;
        if(nameSort) {
          return dir * item0.name.compareTo(item1.name);
 
View Full Code Here

Examples of java.util.Comparator

     *
     * @param parentList .
     * @param childList .
     */
    public static void sortMoveListByRelativeOrder(final List parentList, List childList) {
        Collections.sort(childList, new Comparator() {
            public int compare(Object o, Object o1) {
                int index = parentList.indexOf(o);
                int index1 = parentList.indexOf(o1);
                return (index < index1) ? -1 : (index > index1) ? 1 : 0;
            }
View Full Code Here

Examples of java.util.Comparator

  public EnumSet(EnumItem[] items) {
        m_items = items;
        if (items.length > 0) {
           
            // first sort items in ascending name order
            Arrays.sort(items, new Comparator() {
                public int compare(Object a, Object b) {
                    return ((EnumItem)a).m_name.compareTo(((EnumItem)b).m_name);
                }
            });
           
View Full Code Here

Examples of java.util.Comparator

      new Object[] { null, "*start", new Integer(0), "*length", null, "*comparator", null, "*data", UNDEFINED };
  public Any m_sort(Context context, int start, Any length_, Any comparator_, Any data)
  {
    int size = getSize();
    int length = (length_ != null) ? length_.toInt() : size;
    Comparator comparator = null;
    if (comparator_ != null) {
      comparator = new AnyUtils.SequenceComparator(context, comparator_, data);
    }
    long l = ArrayUtils.adjust(start, length, size);
    start  = (int)(l & 0xffffffff);
View Full Code Here

Examples of java.util.Comparator

  public Any m_search(Context context, Any element, Any comparator_, Any data)
  {
    int size = getSize();
    int start = 0;
    int length = size;
    Comparator comparator = null;
    if (comparator_ != null) {
      comparator = new AnyUtils.SequenceComparator(context, comparator_, data);
    }
    return Any.create(search(element, comparator));
 
View Full Code Here

Examples of java.util.Comparator

    List sortedControls = new ArrayList(controls.length);
    for(int i = 0 ; i < controls.length ; i++) {
      sortedControls.add(controls[i]);
    }
   
    Collections.sort(sortedControls,new Comparator() {
      public int compare(Object o1, Object o2) {
        Control c1 = (Control) o1;
        Control c2 = (Control) o2;
        Object layoutData1 = c1.getLayoutData();
        Object layoutData2 = c2.getLayoutData();
View Full Code Here

Examples of java.util.Comparator

    ArrayList list = null;
    synchronized (this.blasterInstanceMap) {
      list = new ArrayList(this.blasterInstanceMap.values());
    }
   
    Collections.sort(list, new Comparator(){
      public int compare( Object a, Object b )
            {
        BlasterInstance one = (BlasterInstance)a;
        BlasterInstance two = (BlasterInstance)b;
        if (creationTimestamp)
View Full Code Here

Examples of java.util.Comparator

      if (sort_thread.isAlive()) return ;
    sort_thread = new JMThread(new JMRunnable() {
      public void JMRun() {
        last_sort_column = columnID;
        last_sort_dir = sortOrder;
        Collections.sort(line_list, new Comparator() {
            public int compare(Object arg0, Object arg1) {
              BufferedTableRow row1 = (BufferedTableRow)arg0;
              BufferedTableRow row2 = (BufferedTableRow)arg1;
               
              T object1 = (T) row1.getData(SWTConstants.ROW_OBJECT_KEY);
View Full Code Here

Examples of java.util.Comparator

      client.setIdentifier(UIConstants.UPLOAD_PEER_LIST_SOFTWARE_COLUMN_ID);
      client.setModelIndex(UploadPeersModel.CLIENT);
      client.setVisible(_pref.isColumnVisible(UIConstants.UPLOAD_PEER_LIST_SOFTWARE_COLUMN_ID));
      client.setHeaderValue("Client");
      client.setCellRenderer(new ClientTableCellRenderer());
      client.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        String client1 = PeerInfoFormatter.formatPeerSoftware((Peer)o1);
        String client2 = PeerInfoFormatter.formatPeerSoftware((Peer)o2);
        return Misc.compareAllObjects(client1, client2, "toString", true);
      }
      });
     
      table_columns.add(client);
     
      JMTableColumn status = new JMTableColumn();
      status.setIdentifier(UIConstants.UPLOAD_PEER_LIST_STATUS_COLUMN_ID);
      status.setModelIndex(UploadPeersModel.STATUS);
      status.setVisible(_pref.isColumnVisible(UIConstants.UPLOAD_PEER_LIST_STATUS_COLUMN_ID));
      status.setHeaderValue("Status");
      status.setCellRenderer(new StatusTableCellRenderer());
      status.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        Object[] objects1 = (Object[])o1;
        Object[] objects2 = (Object[])o2;
        UploadSession session1 = (UploadSession)objects1[0];
        Peer peer1 = (Peer)objects1[1];   
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.