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 TypeMethodDescriptionvoidPaint for the first time the modelvoidnext()Next event in the animation.voidPaint is a method for all JComponents.voidpause()Pause the animationvoidrefresh()Method for updating some values inside the class.voidreload()Reload the animation if it was pausedvoidsetVelocityFactor(int velocity) Set the velocity Factor of the animationvoidstart()Start the animationvoidstop()Stop the animation.voidCalled by the animator each time is paused.voidupdatePause(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
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
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.
-