|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fi.cs.helsinki.ohtur6.gamemanagement.GameEventHandler | +--fi.cs.helsinki.ohtur6.gamemanagement.bowlinggamemanagement.BowlingGameEventHandler
This class implements the event handler of Bowling Application.
Field Summary | |
private int |
CREATE_PLAYER
|
private int |
END_GAME
|
private int |
FAIL_CREATE_PLAYER
|
private int |
FAIL_MODIFY_POINTS
|
private int |
FAIL_NOT_SLASH_ADD
|
private int |
FAIL_NOT_X_ADD
|
private int |
FAIL_TO_SLASH
|
private int |
FAIL_TO_X
|
private int |
FAIL_X_ADD
|
private int |
FINAL_TO_SLASH
|
private int |
FINAL_TO_X
|
private int[][] |
finalRound
Final round tracker |
private int |
GAME_FINISHED
Indexes for events |
private int |
MODIFY_POINTS
|
private int |
NEW_GAME_CREATED
|
private int |
NOT_SLASH_ADD
|
private int |
NOT_X_ADD
Bowlingstate events: |
private int |
PLAYER_FINISHED
|
private int[] |
playerIndexes
This is used to sort who is the 1st player. |
private int |
TO_SLASH
|
private int |
TO_X
|
private int |
VIEW_REPORT
|
private int |
X_ADD
|
Constructor Summary | |
BowlingGameEventHandler()
Plain constructor of this class |
Method Summary | |
protected void |
addPoints(int playerIndex,
java.lang.String result)
Save points to player dataHolder, please note that this method does not override the addPoints(int,int) given in GameEventHandler. |
int |
haveEvent(int event,
GameEventComponent gec)
This is the main event handler. |
protected boolean |
modifyPoints(int playerIndex,
int fieldNumber,
java.lang.String result)
Save points to player dataHolder, please note that this method does not override the addPoints(int,int) given in GameEventHandler. |
private int |
parseScoreToInt(java.lang.String scoreString)
This method tries to parse the string given to it as a scorevalue. |
private int |
playerResolve(int playerToBeSolved)
This maps the player index to range 0-3, regardless of what the player index might be. |
Methods inherited from class fi.cs.helsinki.ohtur6.gamemanagement.GameEventHandler |
addPoints |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final int GAME_FINISHED
private final int MODIFY_POINTS
private final int CREATE_PLAYER
private final int FAIL_CREATE_PLAYER
private final int FAIL_MODIFY_POINTS
private final int VIEW_REPORT
private final int END_GAME
private final int NEW_GAME_CREATED
private final int NOT_X_ADD
private final int NOT_SLASH_ADD
private final int X_ADD
private final int TO_SLASH
private final int TO_X
private final int FINAL_TO_SLASH
private final int FINAL_TO_X
private final int PLAYER_FINISHED
private final int FAIL_NOT_X_ADD
private final int FAIL_NOT_SLASH_ADD
private final int FAIL_X_ADD
private final int FAIL_TO_SLASH
private final int FAIL_TO_X
private int[][] finalRound
private int[] playerIndexes
Constructor Detail |
public BowlingGameEventHandler()
Method Detail |
public int haveEvent(int event, GameEventComponent gec)
GameEventHandler
haveEvent
in class GameEventHandler
event
- defines the event number to be given.gec
- is a reference to EventComponent where the event originated from.
GameEventHandler.haveEvent(int, fi.cs.helsinki.ohtur6.gui.GameEventComponent)
protected void addPoints(int playerIndex, java.lang.String result)
playerIndex
- Index of the player to the points are addedprotected boolean modifyPoints(int playerIndex, int fieldNumber, java.lang.String result)
playerIndex
- Index of the player to the points are addedfieldNumber
- number of the field to be modifiedresult
- String result to be added.private int parseScoreToInt(java.lang.String scoreString)
private int playerResolve(int playerToBeSolved)
playerToBeSolved
- the playerindex to be used later
|
(c) ohtuR6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |