Package sudoku

Class SudokuSupervisor


  • public class SudokuSupervisor
    extends akka.actor.typed.javadsl.AbstractBehavior<SudokuSupervisor.Protocol>
    Simple agent-guardian of the whole multi-agent-system solving Sudoku. Existence required by Akka. Parent of Teacher agent.
    • Field Detail

      • _sudoku

        private Sudoku _sudoku
        Sudoku riddle to be solved by the app.
      • _teacher

        private akka.actor.typed.ActorRef<Teacher.Protocol> _teacher
        Child Teacher agent.
      • _simulationParent

        private akka.actor.typed.ActorRef<String> _simulationParent
        Parent - agent for debugging when simulating Teacher's crash.
    • Constructor Detail

    • Method Detail

      • create

        public static akka.actor.typed.Behavior<SudokuSupervisor.Protocol> create()
        Public method that calls private constructor. Existence required by Akka.
        Returns:
        wrapped Behavior
      • createReceive

        public akka.actor.typed.javadsl.Receive<SudokuSupervisor.Protocol> createReceive()
        Main method controlling incoming messages. Existence required by Akka.
        Specified by:
        createReceive in class akka.actor.typed.javadsl.AbstractBehavior<SudokuSupervisor.Protocol>
        Returns:
        wrapped Behavior
      • onPostStop

        private SudokuSupervisor onPostStop()
        Handler of PostStop signal. Expected after stopping SudokuSupervisor agent.
        Returns:
        wrapped Behavior
      • onTermination

        private akka.actor.typed.Behavior<SudokuSupervisor.Protocol> onTermination​(SudokuSupervisor.TerminateMsg terminateMsg)
        Behaviour towards TerminateMsg message. Action performed on termination.
        Parameters:
        terminateMsg - termination message
        Returns:
        wrapped Behavior
      • onTeacherWillRestart

        private akka.actor.typed.Behavior<SudokuSupervisor.Protocol> onTeacherWillRestart​(SudokuSupervisor.TeacherWillRestartMsg msg)
        Behaviour towards TeacherWillRestartMsg message. The Teacher responds just before restart.
        Parameters:
        msg - respond just before restart
        Returns:
        wrapped Behavior
      • onIterationFinished

        private akka.actor.typed.Behavior<SudokuSupervisor.Protocol> onIterationFinished​(SudokuSupervisor.IterationFinishedMsg msg)
        As every iteration finishes, SudokuSupervisor saves new (iterated) solution on the hard drive.
        Parameters:
        msg - message containing new solution represented by Sudoku object
        Returns:
        wrapped Behavior
      • readSudoku

        private void readSudoku()
        Action of reading _sudoku from file.