|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.palmmedia.yahtzee.data.DataRepository
public class DataRepository
Repository encapsulating a SQLite database. Used to store player names and highscores.
Nested Class Summary | |
---|---|
private static class |
DataRepository.DataOpenHelper
SQLiteOpenHelper to create the database. |
Field Summary | |
---|---|
private DataRepository.DataOpenHelper |
dataOpenHelper
The DataRepository.DataOpenHelper . |
private static String |
HIGHSCORES_COLUMN_NAME
The name of the name column. |
private static String |
HIGHSCORES_COLUMN_SCORE
The name of the score column. |
private static String |
HIGHSCORES_TABLE_NAME
The name of the highscores table. |
private static String |
PLAYER_COLUMN_ACTIVE
The name of the active column. |
private static String |
PLAYER_COLUMN_NAME
The name of the name column. |
private static String |
PLAYER_TABLE_NAME
The name of the players table. |
Constructor Summary | |
---|---|
DataRepository(Context context)
Constructor. |
Method Summary | |
---|---|
void |
addHighscores(List<Result> highscores)
Saves the highscores. |
List<Result> |
getHighscores()
Get the highscores. |
List<Player> |
getPlayers()
Get the saved players. |
void |
savePlayers(List<Player> players)
Save the players. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String PLAYER_TABLE_NAME
private static final String PLAYER_COLUMN_NAME
private static final String PLAYER_COLUMN_ACTIVE
private static final String HIGHSCORES_TABLE_NAME
private static final String HIGHSCORES_COLUMN_NAME
private static final String HIGHSCORES_COLUMN_SCORE
private DataRepository.DataOpenHelper dataOpenHelper
DataRepository.DataOpenHelper
.
Constructor Detail |
---|
public DataRepository(Context context)
context
- The context.Method Detail |
---|
public List<Player> getPlayers()
public void savePlayers(List<Player> players)
players
- The players.public List<Result> getHighscores()
public void addHighscores(List<Result> highscores)
highscores
- The highscores.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |