protected boolean launchAssignToClusters(Instances insts,int[] clusterAssignments) throws Exception {
  int numPerTask=insts.numInstances() / m_executionSlots;
  List<Future<Boolean>> results=new ArrayList<Future<Boolean>>();
  for (int i=0; i < m_executionSlots; i++) {
    int start=i * numPerTask;
    int end=start + numPerTask;
    if (i == m_executionSlots - 1) {
      end=insts.numInstances();
    }
    Future<Boolean> futureKM=m_executorPool.submit(new KMeansClusterTask(insts,start,end,clusterAssignments));
    results.add(futureKM);
  }
  boolean converged=true;
  for (  Future<Boolean> f : results) {
    if (!f.get()) {
      converged=false;
    }
  }
  return converged;
}

protected boolean launchAssignToClusters ( Instances insts , int [ ] clusterAssignments ) throws Exception { int numPerTask = insts . numInstances ( ) / m_executionSlots ; List < Future < Boolean > > results = new ArrayList < Future < Boolean > > ( ) ; for ( int i = 0 ; i < m_executionSlots ; i ++ ) { int start = i * numPerTask ; int end = start + numPerTask ; if ( i == m_executionSlots - 1 ) { end = insts . numInstances ( ) ; } Future < Boolean > futureKM = m_executorPool . submit ( new KMeansClusterTask ( insts , start , end , clusterAssignments ) ) ; results . add ( futureKM ) ; } boolean converged = true ; for ( Future < Boolean > f : results ) { if ( ! f . get ( ) ) { converged = false ; } } return converged ; }
launch the tasks that assign instances to clusters
