example.pushpuzzle
Class Score

java.lang.Object
  extended by example.pushpuzzle.Score

 class Score
extends java.lang.Object

Keep track of the last level played. For each level keep track of the number of moves.

The scores are kept in a RecordStore named PushPuzzleScores. There are two types of records: - Last level - Level history Name of level (either resource name "/..." or...)


Constructor Summary
Score()
           
 
Method Summary
(package private)  void close()
          Close the store.
(package private)  int getLevel()
          Retrieve the level from the level record.
(package private)  int getMoves()
          Get the number of moved on the current level.
(package private)  int getPushes()
          Get the number of pushes on the current level.
(package private)  int getTheme()
          Get the current Theme number.
(package private)  boolean open()
          Open the record store and locate the record with the level number in it.
(package private)  boolean readScore(int level)
          Read the score for the current level.
(package private)  boolean setLevel(int level, int theme)
          Set the level and theme into the RecordStore.
(package private)  boolean setLevelScore(int pushes, int moves)
          Set the updated score to the RecordStore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Score

Score()
Method Detail

open

boolean open()
Open the record store and locate the record with the level number in it.


getTheme

int getTheme()
Get the current Theme number.


getLevel

int getLevel()
Retrieve the level from the level record. It should have already been read from the store or created. The first byte is a tag, the second byte the level.


setLevel

boolean setLevel(int level,
                 int theme)
Set the level and theme into the RecordStore.

Parameters:
level - the current level
theme - the current theme

getPushes

int getPushes()
Get the number of pushes on the current level.


getMoves

int getMoves()
Get the number of moved on the current level.


readScore

boolean readScore(int level)
Read the score for the current level. Read through the records looking for the one for this level.


setLevelScore

boolean setLevelScore(int pushes,
                      int moves)
Set the updated score to the RecordStore.


close

void close()
Close the store.