de.umass.lastfm
Class Tag

java.lang.Object
  extended by de.umass.lastfm.Tag
All Implemented Interfaces:
Comparable<Tag>

public class Tag
extends Object
implements Comparable<Tag>

Bean for Tag data and provides methods for global tags.

Author:
Janni Kovacs

Method Summary
 int compareTo(Tag o)
           
static List<Tag> filter(Collection<Tag> tags, double percentage)
          Filters tags from the given list; retains only those tags with a count higher than the given percentage of the total sum as from getTagCountSum(Collection).
 int getCount()
           
static Tag getInfo(String tag, Locale locale, String apiKey)
          Gets the metadata for a tag.
static Tag getInfo(String tag, String apiKey)
          Gets the metadata for a tag.
 String getName()
           
 int getReach()
           
static Collection<Tag> getSimilar(String tag, String apiKey)
          Search for tags similar to this one.
static long getTagCountSum(Collection<Tag> tags)
          Returns the sum of all count elements in the results.
 int getTaggings()
          Returns the number of taggings of this specific tag.
static Collection<Album> getTopAlbums(String tag, String apiKey)
           
static Collection<Artist> getTopArtists(String tag, String apiKey)
           
static Collection<Tag> getTopTags(String apiKey)
           
static Collection<Track> getTopTracks(String tag, String apiKey)
           
 String getUrl()
           
static Chart<Artist> getWeeklyArtistChart(String tag, int limit, String apiKey)
           
static Chart<Artist> getWeeklyArtistChart(String tag, String apiKey)
           
static Chart<Artist> getWeeklyArtistChart(String tag, String from, String to, int limit, String apiKey)
           
static LinkedHashMap<String,String> getWeeklyChartList(String tag, String apiKey)
           
static Collection<Chart> getWeeklyChartListAsCharts(String tag, String apiKey)
           
 Date getWikiLastChanged()
           
 String getWikiSummary()
           
 String getWikiText()
           
 boolean isStreamable()
           
static Collection<Tag> search(String tag, int limit, String apiKey)
           
static Collection<Tag> search(String tag, String apiKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCount

public int getCount()

getTaggings

public int getTaggings()
Returns the number of taggings of this specific tag. Alias for getCount().

Returns:
Number of Taggings
See Also:
getInfo(String, String)

getName

public String getName()

getUrl

public String getUrl()

isStreamable

public boolean isStreamable()

getReach

public int getReach()

getWikiLastChanged

public Date getWikiLastChanged()

getWikiSummary

public String getWikiSummary()

getWikiText

public String getWikiText()

getTagCountSum

public static long getTagCountSum(Collection<Tag> tags)
Returns the sum of all count elements in the results.

Parameters:
tags - a list of tags
Returns:
the total count of all tags

filter

public static List<Tag> filter(Collection<Tag> tags,
                               double percentage)
Filters tags from the given list; retains only those tags with a count higher than the given percentage of the total sum as from getTagCountSum(Collection).

Parameters:
tags - list of tags
percentage - cut off percentage
Returns:
the filtered list of tags

getSimilar

public static Collection<Tag> getSimilar(String tag,
                                         String apiKey)
Search for tags similar to this one. Returns tags ranked by similarity, based on listening data.

Parameters:
tag - The tag name
apiKey - A Last.fm API key
Returns:
a List of Tags

getTopTags

public static Collection<Tag> getTopTags(String apiKey)

getTopAlbums

public static Collection<Album> getTopAlbums(String tag,
                                             String apiKey)

getTopTracks

public static Collection<Track> getTopTracks(String tag,
                                             String apiKey)

getTopArtists

public static Collection<Artist> getTopArtists(String tag,
                                               String apiKey)

search

public static Collection<Tag> search(String tag,
                                     String apiKey)

search

public static Collection<Tag> search(String tag,
                                     int limit,
                                     String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String tag,
                                                 String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String tag,
                                                 int limit,
                                                 String apiKey)

getWeeklyArtistChart

public static Chart<Artist> getWeeklyArtistChart(String tag,
                                                 String from,
                                                 String to,
                                                 int limit,
                                                 String apiKey)

getWeeklyChartList

public static LinkedHashMap<String,String> getWeeklyChartList(String tag,
                                                              String apiKey)

getWeeklyChartListAsCharts

public static Collection<Chart> getWeeklyChartListAsCharts(String tag,
                                                           String apiKey)

getInfo

public static Tag getInfo(String tag,
                          String apiKey)
Gets the metadata for a tag.

Parameters:
tag - The tag name
apiKey - A Last.fm API key
Returns:
Tag metdata such as Wiki Text, reach and tag count

getInfo

public static Tag getInfo(String tag,
                          Locale locale,
                          String apiKey)
Gets the metadata for a tag.

Parameters:
tag - The tag name
locale - The language to fetch info in, or null
apiKey - A Last.fm API key
Returns:
Tag metdata such as Wiki Text, reach and tag count

compareTo

public int compareTo(Tag o)
Specified by:
compareTo in interface Comparable<Tag>