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 TypeMethodDescriptionvoid
static boolean
allTerminalsConnected
(Edge[] activatedEdges, Node[] terminals) void
checkScore
(int score) This method checks the score for the correct solution.void
This method computes the tipp edge.void
edgePressed
(Edge edge) This method is called byGamePUI
every time an edge is pressed.void
void
static boolean
This method checks if the edge array has a cycle.void
This method starts the game again.void
quitGame()
void
removeHint
(Hint hint) void
This method remove this tip edge.void
This setter method declares the attribute isCountdownFinished to true.void
setEndTime
(String endTime) void
setGameStarted
(boolean state) This method initialize the attribute gameStarted to the param.void
This method is a setter for the gamePUI.void
setSolution
(Edge[] edges) This method sets the attribute solution.void
setTerminals
(Node[] terms) This method sets the attribute terminals.void
setTippEdge
(Edge edge) void
This method is the entry point for the state machine (for the game) It starts a new round.static int
sumEdgeCost
(Edge[] arr) static int
sumEdgeCost
(ObservableArray<Edge> arr) void
void
updateScore
(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 byGamePUI
every 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()
-