org.musicontroller.dao
Class PlaylistKey

java.lang.Object
  extended by org.musicontroller.dao.PlaylistKey

public class PlaylistKey
extends java.lang.Object

A PlaylistKey is a helperclass to extract information from real id's of Playlists. PlaylistID's have the following meaning: - Positive long's point to a record in the database. - Negative long's have the following form yyyymmddkkkk where kkkk is the kind of the special item to load dd is the day of the month (1..28,29,30 or 31) mm is The month (1...12) yyyy is The year (0...9999) If yyyy and mm are 0, then there is no date-part present.

Version:
$Id: PlaylistKey.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
Author:
Varienaja

Constructor Summary
PlaylistKey(int kind, java.util.Date date)
          Constructs a PlaylistKey from a kind and a Date.
PlaylistKey(long id)
           
 
Method Summary
 void addMonth()
          Adds one month to the date-part of this PlaylistKey.
 java.util.Date getFilter()
           
 long getId()
           
 int getKind()
           
 boolean isSpecial()
           
 void substractMonth()
          Subtracts one month to the date-part of this PlaylistKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlaylistKey

public PlaylistKey(long id)

PlaylistKey

public PlaylistKey(int kind,
                   java.util.Date date)
Constructs a PlaylistKey from a kind and a Date. The resulting PlaylistKey

Parameters:
kind - The kind (-9999...0)
date - a Date
Method Detail

isSpecial

public boolean isSpecial()
Returns:
whether this PlaylistKey points to an ordinary recordid (not special), or to some special id.

getId

public long getId()
Returns:
The id of this PlaylistKey. Special id's are negative.

getKind

public int getKind()
Returns:
The kkkk-part from the id. If this PlaylistKey is not special, garbage is returned.

getFilter

public java.util.Date getFilter()
Returns:
The date-part from the id. If this PlaylistKey is not special, null is returned.

addMonth

public void addMonth()
Adds one month to the date-part of this PlaylistKey.


substractMonth

public void substractMonth()
Subtracts one month to the date-part of this PlaylistKey



Copyright © 2010 A.J.V.. All Rights Reserved.