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 package org.utgenome.gwt.utgb.client.track;
26
27 import java.util.Comparator;
28
29
30
31
32
33 public class TrackComparator implements Comparator<TrackEntry> {
34
35 private static final TrackComparator _comparator = new TrackComparator();
36
37 public static TrackComparator getComparator() {
38 return _comparator;
39 }
40
41 public int compare(TrackEntry arg0, TrackEntry arg1) {
42 if (arg0 instanceof TrackGroup) {
43 final TrackGroup trackGroup0 = (TrackGroup) arg0;
44
45 if (arg1 instanceof TrackGroup) {
46 final TrackGroup trackGroup1 = (TrackGroup) arg1;
47
48 return trackGroup0.compareTo(trackGroup1);
49 }
50 else if (arg1 instanceof Track) {
51 return 1;
52 }
53 }
54 else if (arg0 instanceof Track) {
55 final Track track0 = (Track) arg0;
56
57 if (arg1 instanceof TrackGroup) {
58 return -1;
59 }
60 else if (arg1 instanceof Track) {
61 final Track track1 = (Track) arg1;
62
63 final TrackInfo trackInfo0 = track0.getTrackInfo();
64 final TrackInfo trackInfo1 = track1.getTrackInfo();
65
66 final String trackName0 = trackInfo0.getTrackName();
67 final String trackName1 = trackInfo1.getTrackName();
68
69 return trackName0.compareTo(trackName1);
70 }
71 }
72
73 throw new ClassCastException();
74 }
75
76 }