blob: 0b41ae70f94797285a8b51147acc62d94ab613b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Chapter5.support;
import java.util.Comparator;
/**
*
* @author shamanth
*/
public class NodeIDComparator implements Comparator
{
public int compare(Object o1, Object o2) {
int id1 = ((NetworkNode) o1).id;
int id2 = ((NetworkNode) o2).id;
if(id1>id2)
{
return 1;
}
else
if(id1<id2)
return -1;
else
return 0;
}
}
|