<commit_before>package me.prettyprint.cassandra.connection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import me.prettyprint.cassandra.service.CassandraHost;

public class LeastActiveBalancingPolicy implements LoadBalancingPolicy {

  @Override
  public ConcurrentHClientPool getPool(Collection<ConcurrentHClientPool> pools, Set<CassandraHost> excludeHosts) {
    List<ConcurrentHClientPool> vals = new ArrayList<ConcurrentHClientPool>(pools); 
      Collections.sort(vals, new Comparator<ConcurrentHClientPool>() {      
        public int compare(ConcurrentHClientPool o1, ConcurrentHClientPool o2) {
        return 0;
      }            
    });
    ConcurrentHClientPool concurrentHClientPool = null;
    for (Iterator iterator = vals.iterator(); iterator.hasNext();) {
      concurrentHClientPool = (ConcurrentHClientPool) iterator.next();
      if ( !excludeHosts.contains(concurrentHClientPool.getCassandraHost()) ) {
        break;
      }
    }
    return concurrentHClientPool;
  }

}

/*

@Override
public int compareTo(ConcurrentHClientPool o) {    
  if ( getNumBeforeExhausted() > o.getNumBeforeExhausted() ) {
    return 1;
  } else if ( getNumBeforeExhausted() < o.getNumBeforeExhausted() ) {
    return -1;
  }
  return 0;
}

*/<commit_msg>least active works<commit_after>package me.prettyprint.cassandra.connection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import me.prettyprint.cassandra.service.CassandraHost;

public class LeastActiveBalancingPolicy implements LoadBalancingPolicy {

  @Override
  public ConcurrentHClientPool getPool(Collection<ConcurrentHClientPool> pools, Set<CassandraHost> excludeHosts) {
    List<ConcurrentHClientPool> vals = new ArrayList<ConcurrentHClientPool>(pools); 
      Collections.sort(vals, new Comparator<ConcurrentHClientPool>() {      
        public int compare(ConcurrentHClientPool o1, ConcurrentHClientPool o2) {
        return 0;
      }            
    });
    Iterator<ConcurrentHClientPool> iterator = vals.iterator();
    ConcurrentHClientPool concurrentHClientPool = iterator.next();
    if ( excludeHosts != null && excludeHosts.size() > 0 ) {          
      while (iterator.hasNext()) {
        concurrentHClientPool = (ConcurrentHClientPool) iterator.next();
        if ( !excludeHosts.contains(concurrentHClientPool.getCassandraHost()) ) {
          break;
        }
      }
    }
    return concurrentHClientPool;
  }

}

/*

@Override
public int compareTo(ConcurrentHClientPool o) {    
  if ( getNumBeforeExhausted() > o.getNumBeforeExhausted() ) {
    return 1;
  } else if ( getNumBeforeExhausted() < o.getNumBeforeExhausted() ) {
    return -1;
  }
  return 0;
}

*/
{'fraction_non_alphanumeric': 0.09928595715742945, 'fraction_numerical': 0.004420265215912955, 'mean_word_length': 3.9279731993299833, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3024227', 'n_tokens_mistral': 906, 'n_tokens_neox': 876, 'n_words': 165}