org.mymedialite.data
Class KDDCupItems

java.lang.Object
  extended by org.mymedialite.data.KDDCupItems

public final class KDDCupItems
extends java.lang.Object

Represents KDD Cup 2011 items like album, track, artist, or genre.


Constructor Summary
KDDCupItems(int size)
          Create item information object.
 
Method Summary
 int getAlbum(int item_id)
          Get the album for a given item.
 int getArtist(int item_id)
          Get the artist for a given item.
 int[] getGenres(int item_id)
          Get a list of genres for a given item.
 KDDCupItemType getType(int item_id)
          Get the type of a given item.
 boolean hasAlbum(int item_id)
          Check whether the given item is associated with an album.
 boolean hasArtist(int item_id)
          Check whether the given item is associated with an artist.
 boolean hasGenres(int item_id)
          Check whether the given item is associated with one or more genres.
 void insert(int item_id, KDDCupItemType type, int album, int artist, int[] genres)
          Insert information about an entry to the data structure.
 java.lang.String toString()
          Gives a textual summary of the item data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KDDCupItems

public KDDCupItems(int size)
Create item information object.

Parameters:
size - the number of items
Method Detail

insert

public void insert(int item_id,
                   KDDCupItemType type,
                   int album,
                   int artist,
                   int[] genres)
Insert information about an entry to the data structure.

Parameters:
item_id - the item ID
type - the KDDCupItemType of the item
album - the album ID if the item is a track or album, -1 otherwise
artist - the artist ID if the item is a track, an album, or an artist, -1 otherwise
genres - a (possibly empty or null) list of genre IDs

getType

public KDDCupItemType getType(int item_id)
Get the type of a given item.

Parameters:
item_id - the item ID
Returns:
the KDDCupItemType of the given item

getGenres

public int[] getGenres(int item_id)
Get a list of genres for a given item.

Parameters:
item_id - the item ID
Returns:
a list of genres

getArtist

public int getArtist(int item_id)
Get the artist for a given item.

Parameters:
item_id - the item ID
Returns:
the artist ID

getAlbum

public int getAlbum(int item_id)
Get the album for a given item.

Parameters:
item_id - the item ID
Returns:
the album ID

hasAlbum

public boolean hasAlbum(int item_id)
Check whether the given item is associated with an album.

Parameters:
item_id - the item ID
Returns:
true if it is associated with an album, false otherwise

hasArtist

public boolean hasArtist(int item_id)
Check whether the given item is associated with an artist.

Parameters:
item_id - the item ID
Returns:
true if it is associated with an artist, false otherwise

hasGenres

public boolean hasGenres(int item_id)
Check whether the given item is associated with one or more genres.

Parameters:
item_id - the item ID
Returns:
true if it is associated with at least one genre, false otherwise

toString

public java.lang.String toString()
Gives a textual summary of the item data.

Overrides:
toString in class java.lang.Object