Class ApplicationController

java.lang.Object
ch.ladestation.connectncharge.util.mvcbase.ControllerBase<Game>
ch.ladestation.connectncharge.controller.ApplicationController

public class ApplicationController extends ControllerBase<Game>
This Class is the controller of the element with the components.
  • Constructor Details

    • ApplicationController

      public ApplicationController(Game model)
      This is the constructor of the ApplicationController
      Parameters:
      model -
  • Method Details

    • sumEdgeCost

      public static int sumEdgeCost(Edge[] arr)
    • sumEdgeCost

      public static int sumEdgeCost(ObservableArray<Edge> arr)
    • hasCycle

      public static boolean hasCycle(Edge[] edgeArray)
      This method checks if the edge array has a cycle.
      Parameters:
      edgeArray -
      Returns:
      boolean
    • allTerminalsConnected

      public static boolean allTerminalsConnected(Edge[] activatedEdges, Node[] terminals)
    • startRound

      public void startRound()
      This method is the entry point for the state machine (for the game) It starts a new round.
    • setGPUI

      public void setGPUI(GamePUI gamePUI)
      This method is a setter for the gamePUI.
      Parameters:
      gamePUI -
    • setCountdownFinished

      public void setCountdownFinished()
      This setter method declares the attribute isCountdownFinished to true.
    • edgePressed

      public void edgePressed(Edge edge)
      This method is called by GamePUI 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

      public void setTerminals(Node[] terms)
      This method sets the attribute terminals.
      Parameters:
      terms -
    • setSolution

      public void setSolution(Edge[] edges)
      This method sets the attribute solution.
      Parameters:
      edges -
    • handleTipp

      public void handleTipp()
    • computeTippEdge

      public void computeTippEdge()
      This method computes the tipp edge.
    • setTippEdge

      public void setTippEdge(Edge edge)
    • 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

      public void setEndTime(String endTime)
    • addHint

      public void addHint(Hint hint)
    • removeHint

      public void removeHint(Hint hint)
    • toggleMute

      public void toggleMute()