formatting
This commit is contained in:
@@ -3,25 +3,26 @@ package tournament;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Game {
|
||||
private static int counter = 0;
|
||||
protected final int id;
|
||||
//null nicht notwendig
|
||||
protected String winner = null;
|
||||
|
||||
private static int counter = 0;
|
||||
protected final int id;
|
||||
//null nicht notwendig
|
||||
protected String winner = null;
|
||||
|
||||
|
||||
protected Game() {
|
||||
this.id = counter++;
|
||||
}
|
||||
protected Game() {
|
||||
this.id = counter++;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
return this.id;
|
||||
}
|
||||
public int getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getWinner(){
|
||||
return this.winner;
|
||||
}
|
||||
public String getWinner(){
|
||||
return this.winner;
|
||||
}
|
||||
|
||||
public void setWinner(String winner) {
|
||||
public void setWinner(String winner) {
|
||||
if (this.winner != null)
|
||||
throw new IllegalStateException("winner already set");
|
||||
if (getPlayer1() == null || getPlayer2() == null)
|
||||
@@ -33,19 +34,18 @@ public abstract class Game {
|
||||
}
|
||||
|
||||
|
||||
public abstract String getPlayer1();
|
||||
public abstract String getPlayer1();
|
||||
|
||||
public abstract String getPlayer2();
|
||||
public abstract String getPlayer2();
|
||||
|
||||
public abstract List<String> getAllPlayers();
|
||||
public abstract List<String> getAllPlayers();
|
||||
|
||||
public abstract List<String> getRemaningPlayers();
|
||||
|
||||
public abstract List<Game> getAllGames();
|
||||
|
||||
public String toString(){
|
||||
return "Game: " + getId() + " Player: "+ getPlayer1()+ " vs Player: " + getPlayer2() + "Winner is: "+ getWinner();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Game: " + getId() + " Player: "+ getPlayer1()+ " vs Player: " + getPlayer2() + "Winner is: "+ getWinner();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user