01: /*
02: * Created on 15-Aug-2003
03: */
04: package uk.org.ponder.intutil;
05:
06: import java.util.Comparator;
07:
08: /**
09: * @author Bosmon
10: *
11: * The class intPair represents a pair of integers.
12: */
13: public class intPair {
14: public int first;
15: public int second;
16: public static Comparator compare_second = new Comparator() {
17: public int compare(Object o1, Object o2) {
18: return ((intPair) o1).second - ((intPair) o2).second;
19: }
20: };
21:
22: public intPair(int first, int second) {
23: this .first = first;
24: this .second = second;
25: }
26:
27: public void sortAscending() {
28: if (first > second) {
29: int temp = first;
30: first = second;
31: second = temp;
32: }
33: }
34: }
|