Package java.util

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


    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

      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

      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

    type.setIdentifier(UIConstants.SEARCH_FILE_TYPE_COLUMN_ID);
    type.setModelIndex(SearchResultTableModel.TYPE);
    type.setVisible(_pref.isColumnVisible(UIConstants.SEARCH_FILE_TYPE_COLUMN_ID));
    type.setHeaderValue(_._("mainwindow.searchtab.column.filetype"));
    type.setCellRenderer(new TypeTableCellRenderer());
    type.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        String file_type1 = FileFormatter.formatMimeType(((SearchResultItem)o1).getMimeType());
        String file_type2 = FileFormatter.formatMimeType(((SearchResultItem)o2).getMimeType());
        return Misc.compareAllObjects(file_type1, file_type2, "toString", true);
      }     
View Full Code Here

    upload_speed.setIdentifier(UIConstants.DOWNLOAD_LIST_UPLOAD_SPEED_COLUMN_ID);
    upload_speed.setModelIndex(DownloadTableModel.UPLOAD_SPEED);
    upload_speed.setVisible(_pref.isColumnVisible(UIConstants.DOWNLOAD_LIST_UPLOAD_SPEED_COLUMN_ID));
    upload_speed.setHeaderValue("Up speed");
    upload_speed.setCellRenderer(new UploadSpeedTableCellRenderer());
    upload_speed.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        Float u_speed1 = null;
        Float u_speed2 = null;
        try {
          DownloadSession d_session1 = (DownloadSession)o1;
View Full Code Here

    file_type.setIdentifier(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID);
    file_type.setModelIndex(SharedFilesTableModel.TYPE);
    file_type.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID));
    file_type.setHeaderValue("Type");
    file_type.setCellRenderer(new FileTypeTableCellRenderer());
    file_type.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        String file_type1 = FileFormatter.formatMimeType(((SharedFile)o1).getMimeType());
        String file_type2 = FileFormatter.formatMimeType(((SharedFile)o2).getMimeType());
        return Misc.compareAllObjects(file_type1, file_type2, "toString", true);
      }     
    });
   
    table_columns.add(file_type);
   
    JMTableColumn file_hash = new JMTableColumn();
    file_hash.setIdentifier(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID);
    file_hash.setModelIndex(SharedFilesTableModel.HASH);
    file_hash.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID));
    file_hash.setHeaderValue("Hash");
    file_hash.setCellRenderer(new FileHashTableCellRenderer());
    file_hash.setComparator(new GeneralComparator("getFileHash"));
   
    table_columns.add(file_hash);
   
    JMTableColumn completed = new JMTableColumn();
    completed.setIdentifier(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID);
    completed.setModelIndex(SharedFilesTableModel.COMPLETED);
    completed.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID));
    completed.setHeaderValue("Completed");
    completed.setCellRenderer(new CompletedTableCellRenderer());
    completed.setComparator(new GeneralComparator("getPercentCompleted"));
    completed.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        double completed1 = 100;
        double completed2 = 100;
        SharedFile shared_file1 = (SharedFile)o1;
        SharedFile shared_file2 = (SharedFile)o2;
View Full Code Here

  private BucketDefinition createServiceBucket(JRCrosstabGroup group, byte evaluation) throws JRException
  {
    JRCrosstabBucket bucket = group.getBucket();

    Comparator comparator = null;
    JRExpression comparatorExpression = bucket.getComparatorExpression();
    if (comparatorExpression != null)
    {
      comparator = (Comparator) evaluateExpression(comparatorExpression, evaluation);
    }
View Full Code Here

   private List sortDelegatesOnServerID(Collection delegates)
   {
      List localDels = new ArrayList(delegates);

      Collections.sort(localDels,
         new Comparator()
         {
            public int compare(Object obj1, Object obj2)
            {
               ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)obj1;
               ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)obj2;
View Full Code Here

     
      List entries = new ArrayList(deliveries.entrySet());
     
      //Sort them in reverse delivery id order
      Collections.sort(entries,
                       new Comparator()
                       {
                           public int compare(Object obj1, Object obj2)
                           {
                              Map.Entry entry1 = (Map.Entry)obj1;
                              Map.Entry entry2 = (Map.Entry)obj2;
View Full Code Here

TOP

Related Classes of java.util.Comparator

Copyright © 2018 www.massapicom. 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.