|
|
@ -11,13 +11,18 @@ import java.net.URL; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author jim |
|
|
|
* @author jim |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class Result |
|
|
|
public class Result implements Comparable<Result> |
|
|
|
{ |
|
|
|
{ |
|
|
|
private URL link; |
|
|
|
private URL link; |
|
|
|
private String artist; |
|
|
|
private String artist; |
|
|
|
private String album; |
|
|
|
private String album; |
|
|
|
private String title; |
|
|
|
private String title; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String sourceName; |
|
|
|
|
|
|
|
private String sourceAbbr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private double score; |
|
|
|
|
|
|
|
|
|
|
|
public URL getLink() { |
|
|
|
public URL getLink() { |
|
|
|
return link; |
|
|
|
return link; |
|
|
|
} |
|
|
|
} |
|
|
@ -50,12 +55,39 @@ public class Result |
|
|
|
this.title = title; |
|
|
|
this.title = title; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getSourceName() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return sourceName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSource(String name, String abbr) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
sourceName = name; |
|
|
|
|
|
|
|
sourceAbbr = abbr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getSourceAbbr() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return sourceAbbr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public double getScore() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return score; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setScore(double score) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.score = score; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String toString() { |
|
|
|
public String toString() |
|
|
|
return "Result{" + "link=" + link + ", artist=" + artist + ", album=" + album + ", title=" + title + '}'; |
|
|
|
{ |
|
|
|
|
|
|
|
return "Result{" + "artist=" + artist + ", album=" + album + ", title=" + title + ", sourceAbbr=" + sourceAbbr + ", score=" + score + '}'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setAlbumArtist(String field) |
|
|
|
public void setAlbumArtist(String field) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// System.out.println("Parsing album-artist: " + field);
|
|
|
|
// System.out.println("Parsing album-artist: " + field);
|
|
|
|
String fieldLower = field.toLowerCase(); |
|
|
|
String fieldLower = field.toLowerCase(); |
|
|
@ -78,9 +110,17 @@ public class Result |
|
|
|
else |
|
|
|
else |
|
|
|
album += word + " "; |
|
|
|
album += word + " "; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
artist = artist.trim(); |
|
|
|
|
|
|
|
album = album.trim(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compareTo(Result t) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return (int) Math.signum(score - t.score); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|