Class ApplicationController
java.lang.Object
ch.ladestation.connectncharge.util.mvcbase.ControllerBase<Game>
ch.ladestation.connectncharge.controller.ApplicationController
This Class is the controller of the element with the components.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.ladestation.connectncharge.util.mvcbase.ControllerBase
ControllerBase.ArraySetter<V>, ControllerBase.Setter<V>, ControllerBase.SetterInterface -
Field Summary
Fields inherited from class ch.ladestation.connectncharge.util.mvcbase.ControllerBase
log, model -
Constructor Summary
ConstructorsConstructorDescriptionApplicationController(Game model) This is the constructor of the ApplicationController -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic booleanallTerminalsConnected(Edge[] activatedEdges, Node[] terminals) voidcheckScore(int score) This method checks the score for the correct solution.voidThis method computes the tipp edge.voidedgePressed(Edge edge) This method is called byGamePUIevery time an edge is pressed.voidvoidstatic booleanThis method checks if the edge array has a cycle.voidThis method starts the game again.voidquitGame()voidremoveHint(Hint hint) voidThis method remove this tip edge.voidThis setter method declares the attribute isCountdownFinished to true.voidsetEndTime(String endTime) voidsetGameStarted(boolean state) This method initialize the attribute gameStarted to the param.voidThis method is a setter for the gamePUI.voidsetSolution(Edge[] edges) This method sets the attribute solution.voidsetTerminals(Node[] terms) This method sets the attribute terminals.voidsetTippEdge(Edge edge) voidThis method is the entry point for the state machine (for the game) It starts a new round.static intsumEdgeCost(Edge[] arr) static intsumEdgeCost(ObservableArray<Edge> arr) voidvoidupdateScore(int score) This method updates the attribute currentScore.Methods inherited from class ch.ladestation.connectncharge.util.mvcbase.ControllerBase
add, addUnique, arrayAdd, arrayRemove, async, async, awaitCompletion, decrease, decrease, decreaseValue, get, get, get, getModel, increase, increase, increaseValue, pauseExecution, remove, runLater, set, set, setValue, setValue, setValues, shutdown, startUp, syncAdd, syncAddUnique, syncRemove, syncSet, syncSet, toggle, toggle, toggleValue, updateModel
-
Constructor Details
-
ApplicationController
This is the constructor of the ApplicationController- Parameters:
model-
-
-
Method Details
-
sumEdgeCost
-
sumEdgeCost
-
hasCycle
This method checks if the edge array has a cycle.- Parameters:
edgeArray-- Returns:
- boolean
-
allTerminalsConnected
-
startRound
public void startRound()This method is the entry point for the state machine (for the game) It starts a new round. -
setGPUI
This method is a setter for the gamePUI.- Parameters:
gamePUI-
-
setCountdownFinished
public void setCountdownFinished()This setter method declares the attribute isCountdownFinished to true. -
edgePressed
This method is called byGamePUIevery time an edge is pressed.It is arguably the most important method because it triggers all logic calculations.
- Parameters:
edge-
-
setGameStarted
public void setGameStarted(boolean state) This method initialize the attribute gameStarted to the param.- Parameters:
state-
-
updateScore
public void updateScore(int score) This method updates the attribute currentScore.- Parameters:
score-
-
checkScore
public void checkScore(int score) This method checks the score for the correct solution.- Parameters:
score-
-
setTerminals
This method sets the attribute terminals.- Parameters:
terms-
-
setSolution
This method sets the attribute solution.- Parameters:
edges-
-
handleTipp
public void handleTipp() -
computeTippEdge
public void computeTippEdge()This method computes the tipp edge. -
setTippEdge
-
removeTippEdge
public void removeTippEdge()This method remove this tip edge. -
finishGame
public void finishGame() -
playAgain
public void playAgain()This method starts the game again. -
quitGame
public void quitGame() -
setEndTime
-
addHint
-
removeHint
-
toggleMute
public void toggleMute()
-