Interface Animation

All Known Implementing Classes:
AnimationClass, MultipleQueueNetAnimation, SingleQueueNetAnimation

public interface Animation
Interface that must be implemented by the class that represent the Animation
Author:
Lorenzo Torri Date: 22-mar-2024 Time: 10.30
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    initGUI(JPanel container)
    Paint for the first time the model
    void
    Next event in the animation.
    void
    Paint is a method for all JComponents.
    void
    Pause the animation
    void
    Method for updating some values inside the class.
    void
    Reload the animation if it was paused
    void
    setVelocityFactor(int velocity)
    Set the velocity Factor of the animation
    void
    Start the animation
    void
    Stop the animation.
    void
    Called by the animator each time is paused.
    void
    updatePause(long pause)
    This method is important for udpdating all those components inside the Animation that are affected by a pause of the Animator.
  • Method Details

    • initGUI

      void initGUI(JPanel container)
      Paint for the first time the model
    • refresh

      void refresh()
      Method for updating some values inside the class. It is crucial since when we call the repaint() method and start the chain of calls of the paint() methods of each JComponent, those paint() method use some local variables of the clasess. If we change those variables with this method, then we can obtain some changes also in the graphics
    • paint

      void paint(Graphics g)
      Paint is a method for all JComponents. It is called when the class is istanciated, and called again when the repaint() method is invoked inside the class. Each paint of an animation recall then all the paint() of the subcomponents of an Animation. Repaint() must be called only once inside the Animation class, never on the subcomponents
      Parameters:
      g -
    • start

      void start()
      Start the animation
    • pause

      void pause()
      Pause the animation
    • reload

      void reload()
      Reload the animation if it was paused
    • stop

      void stop()
      Stop the animation. It is used when a maximum number of jobs is reached and nothing can be done
    • next

      void next()
      Next event in the animation. The simulation time is increased (whenever System.currentMillis() is used, multiply it for a factor > 1), and the simulation pauses when a new event occurs
    • setVelocityFactor

      void setVelocityFactor(int velocity)
      Set the velocity Factor of the animation
    • updatePause

      void updatePause(long pause)
      This method is important for udpdating all those components inside the Animation that are affected by a pause of the Animator. One example is the CircleStation, in which the amount of progression is computed as the difference between the current time and the time of entrance of the job in the circle. But if the animator was paused, then this amount does not have to be computed in the difference of before, so it is crucial to pass to the Circle this value and remove it from the difference
      Parameters:
      pause - the amount of time during which the animator was paused
    • updateAnimResults

      void updateAnimResults()
      Called by the animator each time is paused. Update the results in the Result table for the ANIM row.