Skip to content
Snippets Groups Projects
Commit beef4676 authored by Lennart Eichhorn's avatar Lennart Eichhorn
Browse files

Made Candidate comparable.

parent 83d880f2
Branches
Tags
No related merge requests found
...@@ -2,8 +2,9 @@ package MainClasses; ...@@ -2,8 +2,9 @@ package MainClasses;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator;
public class Candidate { public class Candidate implements Comparable<Candidate> {
private final int[] folding; // 0 = North | 1 = East | 2 = South | 3 = West private final int[] folding; // 0 = North | 1 = East | 2 = South | 3 = West
private ArrayList<Vertex> vertices; private ArrayList<Vertex> vertices;
...@@ -68,4 +69,10 @@ public class Candidate { ...@@ -68,4 +69,10 @@ public class Candidate {
return newOut; return newOut;
} }
@Override
public int compareTo(Candidate that)
{
return (int)(1000.0*(this.getFitness() - that.getFitness()));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment