generated from Nekojimi/JavaMavenTemplate
Result: add source name, abbreviation, and score.
This commit is contained in:
parent
95f2db1926
commit
7e41eb1105
|
@ -11,13 +11,18 @@ import java.net.URL;
|
|||
*
|
||||
* @author jim
|
||||
*/
|
||||
public class Result
|
||||
public class Result implements Comparable<Result>
|
||||
{
|
||||
private URL link;
|
||||
private String artist;
|
||||
private String album;
|
||||
private String title;
|
||||
|
||||
private String sourceName;
|
||||
private String sourceAbbr;
|
||||
|
||||
private double score;
|
||||
|
||||
public URL getLink() {
|
||||
return link;
|
||||
}
|
||||
|
@ -50,9 +55,36 @@ public class Result
|
|||
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
|
||||
public String toString() {
|
||||
return "Result{" + "link=" + link + ", artist=" + artist + ", album=" + album + ", title=" + title + '}';
|
||||
public String toString()
|
||||
{
|
||||
return "Result{" + "artist=" + artist + ", album=" + album + ", title=" + title + ", sourceAbbr=" + sourceAbbr + ", score=" + score + '}';
|
||||
}
|
||||
|
||||
public void setAlbumArtist(String field)
|
||||
|
@ -78,9 +110,17 @@ public class Result
|
|||
else
|
||||
album += word + " ";
|
||||
}
|
||||
|
||||
}
|
||||
artist = artist.trim();
|
||||
album = album.trim();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Result t)
|
||||
{
|
||||
return (int) Math.signum(score - t.score);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue