Class RandomManager

  • All Implemented Interfaces:
    java.lang.Runnable

    public class RandomManager
    extends java.lang.Object
    implements java.lang.Runnable
    • Constructor Detail

      • RandomManager

        public RandomManager​(java.lang.Thread scriptThread,
                             AbstractScript script)
    • Method Detail

      • getSolver

        public RandomSolver getSolver​(java.lang.String eventName)
        Gets a random solver where the random solver's RandomSolver.getEventString() matches the given eventName. Note: When building a random solver with a RandomEvent it uses the RandomEvent.toString() to generate event string.

        This method is not case-sensitive.

        Parameters:
        eventName - String of the random solver's event
        Returns:
        Random solver matching given event or null if not found.
      • clearRegisteredSolvers

        public void clearRegisteredSolvers()
      • registerSolver

        public void registerSolver​(RandomSolver solver)
        Registers a random solver with priority higher than default. If two or more random solvers are registered, the one registered last will have priority
        Parameters:
        solver - Random solver to register
      • unregisterSolver

        public void unregisterSolver​(RandomEvent event)
        Removes a random solver. If there are more than one, the one with highest priority is removed (script registered ones, then default)

        Built in solvers cannot be unregistered, any attempt to do so will result in the solver being disabled.

        Parameters:
        event - Event of random solver to be removed
      • unregisterSolver

        public void unregisterSolver​(java.lang.String event)
        Removes a random solvers with a given event string. If based on a RandomEvent it uses the RandomEvent.toString() Built in solvers cannot be unregistered, any attempt to do so will result in the solver being disabled. This matches against RandomSolver.getEventString()
        Parameters:
        event - Event string of random solver to be removed.
      • onLoop

        public int onLoop()
        Does the login for checking and running a random solver
        Returns:
        -1 if no random solvers running, otherwise delay time
      • isSolving

        public boolean isSolving()
      • isUsingCustomBreakSolver

        public boolean isUsingCustomBreakSolver()
      • disableSolver

        public void disableSolver​(java.lang.String event)
      • disableSolver

        public void disableSolver​(RandomEvent event)
      • enableSolver

        public void enableSolver​(java.lang.String event)
      • enableSolver

        public void enableSolver​(RandomEvent event)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • runRandomManager

        public void runRandomManager()
      • kill

        public void kill()
      • getRandomThread

        public java.lang.Thread getRandomThread()
      • setRandomThread

        public void setRandomThread​(java.lang.Thread randomThread)