blob: 71c43b2374b1b8120d1ec1e6e6ab3d45028cce39 (
plain) (
blame)
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
33
34
|
package scalac.transformer.matching ;
import java.util.* ;
class StateSetComparator implements Comparator {
// use lexicographic order
public int compare( Object o1, Object o2 ) {
/*
System.out.print("lexi" );
System.out.print( o1 +" ");
System.out.println( o2 );
*/
Iterator it1 = ((TreeSet) o1).iterator();
Iterator it2 = ((TreeSet) o2).iterator();
while( it1.hasNext() ) {
while( it2.hasNext() ) {
if( !it1.hasNext() )
return -1;
int i1 = ((Integer) it1.next()).intValue();
int i2 = ((Integer) it2.next()).intValue();
if( i1 < i2 )
return -1;
else if ( i1 > i2 )
return 1;
}
if( it1.hasNext() )
return 1;
}
if( it2.hasNext() )
return -1;
return 0;
}
}
|