Last change
on this file was 127, checked in by Wouter Pasman, 6 years ago |
#41 ROLL BACK of rev.126 . So this version is equal to rev. 125
|
File size:
372 bytes
|
Line | |
---|
1 | package agents.anac.y2014.kGA_gent.library_genetic;
|
---|
2 |
|
---|
3 |
|
---|
4 | public class CompGene implements java.util.Comparator<Gene> {
|
---|
5 |
|
---|
6 | // + (x > y)
|
---|
7 | // compare x y = 0 (x = y)
|
---|
8 | // - (x < y)
|
---|
9 | public int compare(Gene s, Gene t) {
|
---|
10 | double x = s.GetValue() - t.GetValue();
|
---|
11 | if(x>0){
|
---|
12 | return 1;
|
---|
13 | }
|
---|
14 | if(x<0){
|
---|
15 | return -1;
|
---|
16 | }
|
---|
17 | return 0;
|
---|
18 | }
|
---|
19 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.