vooga.engine.resource
Class HighScoreHandler

java.lang.Object
  extended by vooga.engine.resource.HighScoreHandler

public class HighScoreHandler
extends java.lang.Object

This class handles storing and retrieving a high score list of arbitrary length in an SQLite database. It supports name, score, and time columns.


Constructor Summary
HighScoreHandler(int maxScores, java.lang.String tableName, java.io.File dbFile)
           
HighScoreHandler(int maxScores, java.lang.String tableName, java.lang.String dbFileName)
           
 
Method Summary
 java.lang.String[] getNames()
          Returns the name column of the high score list in order from highest to lowest score.
 java.lang.Long[] getScores()
          Returns the score column of the high score list in order from high to low.
 java.lang.Long[] getTimes()
          Returns the time column of the high score list in order from highest to lowest score.
 void updateScores(java.lang.Long score)
          If the input score belongs on list, adds a new score entry and drops the prior lowest score.
 void updateScores(long score, long time)
          If the input score belongs on list, adds a new score entry and drops the prior lowest score.
 void updateScores(java.lang.String name, java.lang.Long score)
          If the input score belongs on list, adds a new score entry and drops the prior lowest score.
 void updateScores(java.lang.String name, java.lang.Long score, java.lang.Long time)
          If the input score belongs on list, adds a new score entry and drops the prior lowest score.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HighScoreHandler

public HighScoreHandler(int maxScores,
                        java.lang.String tableName,
                        java.io.File dbFile)
Parameters:
maxScores - The maximum number of high scores stored.
tableName - Name of the SQLite table in which values will be stored.
dbFile - A File object of the SQLite database file.

HighScoreHandler

public HighScoreHandler(int maxScores,
                        java.lang.String tableName,
                        java.lang.String dbFileName)
Parameters:
maxScores - The maximum number of high scores stored.
tableName - Name of the SQLite table in which values will be stored.
dbFileName - The file path of the SQLite database file.
Method Detail

updateScores

public void updateScores(java.lang.String name,
                         java.lang.Long score,
                         java.lang.Long time)
                  throws SQLiteException
If the input score belongs on list, adds a new score entry and drops the prior lowest score.

Parameters:
name - Player name for high score list.
score - Long representing entry score.
time - Time at which score was set (typically milliseconds since midnight, January 1, 1970 UTC).
Throws:
SQLiteException

updateScores

public void updateScores(java.lang.String name,
                         java.lang.Long score)
                  throws SQLiteException
If the input score belongs on list, adds a new score entry and drops the prior lowest score.

Parameters:
name - Player name for high score list.
score - Long representing entry score.
Throws:
SQLiteException

updateScores

public void updateScores(java.lang.Long score)
                  throws SQLiteException
If the input score belongs on list, adds a new score entry and drops the prior lowest score.

Parameters:
score - Long representing entry score.
Throws:
SQLiteException

updateScores

public void updateScores(long score,
                         long time)
                  throws SQLiteException
If the input score belongs on list, adds a new score entry and drops the prior lowest score.

Parameters:
score - Long representing entry score.
time - Time at which score was set (typically milliseconds since midnight, January 1, 1970 UTC).
Throws:
SQLiteException

getScores

public java.lang.Long[] getScores()
Returns the score column of the high score list in order from high to low.


getNames

public java.lang.String[] getNames()
Returns the name column of the high score list in order from highest to lowest score.


getTimes

public java.lang.Long[] getTimes()
Returns the time column of the high score list in order from highest to lowest score.