package experimentalcode.students.andor;

import java.util.Collections;

import de.lmu.ifi.dbs.elki.data.Cluster;
import de.lmu.ifi.dbs.elki.data.type.SimpleTypeInformation;
import de.lmu.ifi.dbs.elki.database.Database;
import de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs;
import de.lmu.ifi.dbs.elki.database.ids.DBID;
import de.lmu.ifi.dbs.elki.database.ids.DBIDUtil;
import de.lmu.ifi.dbs.elki.distance.distancevalue.IntegerDistance;
import de.lmu.ifi.dbs.elki.distance.similarityfunction.AbstractPrimitiveSimilarityFunction;

public class ClusterSimilarityFunction<C extends Cluster<?>> extends AbstractPrimitiveSimilarityFunction<C, IntegerDistance> {
  /**
   * @param rep
   */
  public ClusterSimilarityFunction(Database database) {
    super();
  }

  @Override
  public IntegerDistance similarity(C o1, C o2) {
    ArrayModifiableDBIDs data1 = DBIDUtil.newArray(o1.getIDs());
    ArrayModifiableDBIDs data2 = DBIDUtil.newArray(o2.getIDs());
    Collections.sort(data1);
    Collections.sort(data2);
    int intersection = 0;
    for(DBID id: data1){
      if(Collections.binarySearch(data2, id)>=0){
        intersection++;
      }
    }
    return new IntegerDistance(intersection);
  }

  @Override
  public SimpleTypeInformation<? super Cluster<?>> getInputTypeRestriction() {
    return new SimpleTypeInformation<Cluster<?>>(Cluster.class);
  }

  @Override
  public IntegerDistance getDistanceFactory() {
    return IntegerDistance.FACTORY;
  }
}
@@ -41,41 +41,8 @@
 %0D%0A%0D%0A
-import java.util.Collections;%0D%0A%0D%0A
 impo
@@ -952,38 +952,33 @@
     
-Collections
+%0D%0A    data1
 .sort(
-data1
 );%0D%0A    
 Coll
@@ -977,30 +977,19 @@
     
-Collections
+data2
 .sort(
-data2
 );%0D%0A
@@ -1054,19 +1054,13 @@
  if(
-Collections
+data2
 .bin
@@ -1073,15 +1073,8 @@
 rch(
-data2, 
 id)%3E

Fix some API change related compile errors.