1 | package org.apollo.agents;
|
---|
2 |
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * An immutable search result for melody searches.
|
---|
6 | *
|
---|
7 | * @author Brook Novak
|
---|
8 | *
|
---|
9 | */
|
---|
10 | public class MelodySearchResult implements Comparable<MelodySearchResult> {
|
---|
11 |
|
---|
12 | private String parentFrame;
|
---|
13 | private float score;
|
---|
14 | private String trackName ;
|
---|
15 | private String trackLocalFileName;
|
---|
16 |
|
---|
17 | public MelodySearchResult(String parentFrame, float score, String trackName, String trackLocalFileName) {
|
---|
18 | assert(parentFrame != null);
|
---|
19 | assert(trackLocalFileName != null);
|
---|
20 | assert(score >= 0);
|
---|
21 |
|
---|
22 | this.parentFrame = parentFrame;
|
---|
23 | this.score = score;
|
---|
24 | this.trackName = trackName;
|
---|
25 | this.trackLocalFileName = trackLocalFileName;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public String getParentFrame() {
|
---|
29 | return parentFrame;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public float getScore() {
|
---|
33 | return score;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public String getTrackLocalFileName() {
|
---|
37 | return trackLocalFileName;
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Can be null.
|
---|
42 | * @return
|
---|
43 | */
|
---|
44 | public String getTrackName() {
|
---|
45 | return trackName;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public int compareTo(MelodySearchResult o) {
|
---|
49 | return Float.compare(score, o.score);
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*public int compareTo(Object o) {
|
---|
53 |
|
---|
54 | if (o != null && o instanceof MelodySearchResult) {
|
---|
55 | return Float.compare(score, ((MelodySearchResult)o).score);
|
---|
56 | }
|
---|
57 | throw new ClassCastException();
|
---|
58 | }*/
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | }
|
---|
66 |
|
---|