/**
* Copyright 1999-2009 The Pegadi Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* A score object spesific to the "tetris" domain. This object
* handles {@link #level} and number of {@link lines} in addition to
* {@link org.pegadi.games.Score}'s attributes.
*
* @author HÃ¥vard Wigtil <havardw at pvv.org>
* @version $Revision$, $Date$
*/
package org.pegadi.games.tetris;
import org.pegadi.games.Score;
import java.util.Date;
public class TetrisScore extends Score implements java.io.Serializable {
protected static String TETRIS_DOMAIN = "tetris";
/**
* Level for this score.
*/
protected int level;
/**
* Completed lines for this score.
*/
protected int lines;
/**
* Create a new Tetris score. The score will have active status. Use this
* constructor for new scores.
*
* @param ID The score's ID.
* @param userID The user's ID.
* @param userName The user's full name.
* @param level Starting level.
*/
public TetrisScore(long ID, String userID, String userName, int level) {
super(TETRIS_DOMAIN, ID, userID, userName);
this.lines = 0;
this.level = level;
}
/**
* Create a new Tetris score. The active status will be set to false,
* use this method for completet scores.
*
* @param ID The score's ID.
* @param userID The user's ID.
* @param userName The user's full name.
* @param score The score.
* @param level The level.
* @param lines Number of completed lines.
* @param date The date for this score.
*/
public TetrisScore(long ID, String userID, String userName, long rank,
long score, int level, int lines, Date date) {
super(TETRIS_DOMAIN, ID, userID, userName);
this.rank = rank;
this.score = score;
this.lines = lines;
this.level = level;
this.date = date;
this.active = false;
}
/**
* Returns the current level.
*
* @return The level.
*/
public int getLevel() {
return level;
}
/**
* Sets the level for this score.
*
* @param level The level.
*/
public void setLevel(int level) {
this.level = level;
}
/**
* Returns the number of completed lines.
*
* @return Number of completed lines.
*/
public int getLines() {
return lines;
}
/**
* Sets number of completed lines for this score.
*
* @param lines Number of lines.
*/
public void setLines(int lines) {
this.lines = lines;
}
/**
* Increases the number of completed lines.
*
* @param lines Number of lines to add.
*/
public void addLines(int lines) {
this.lines += lines;
}
}