package gdi1sokoban.highscores;
/**
* HighscoreEntry class
*
* represents one highscore entry
*/
public class HighscoreEntry {
private String playerName =
""; // player name
private int steps = 0; // steps count
private int time = 0; // time needed
/**
* gets the value of playerName
* @return playerName
*/
protected String getPlayerName
() {
return playerName;
}
/**
* gets the value of steps
* @return steps
*/
protected int getSteps() {
return steps;
}
/**
* gets the value of time
* @return time
*/
protected int getTime() {
return time;
}
/**
* HighscoreEntry constructor
*
* @param myLevel game level no.
* @param myPlayerName player name
* @param mySteps steps count
* @param myTime time needed
* @throws NumberFormatException
*/
playerName = myPlayerName;
steps =
Integer.
valueOf(mySteps
).
intValue();
time =
Integer.
valueOf(myTime
).
intValue();
}
/**
* transforms the highscore entry into string format
* @return formatted string
*/
// calculate the length of the new string
final int strLen = playerName.length() + hSteps.length() + hTime.length() + 2;
// construct the highscore row string
myBuf.append(playerName).append("\t").append(hSteps).append("\t").append(hTime);
// return
return myBuf.toString();
}
}