Class AnimationClass
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
jmt.jmch.animation.AnimationClass
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Animation
- Direct Known Subclasses:
MultipleQueueNetAnimation, SingleQueueNetAnimation
This class is a super class for all the animations.
- Author:
- Lorenzo Torri Date: 22-mar-2024 Time: 10.30
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Animatorprotected AnimationPanelprotected JPanelprotected Simulationprotected Sinkprotected Sourceprotected intFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionAnimationClass(AnimationPanel animPanel, JPanel container, Simulation sim, int nQueues) -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method adds a new job inside the list of jobs of the Animation.intintvoidPaint for the first time the modelbooleanisPaused()voidnext()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 pausedvoidThis method removes a job inside the list of jobs of the Animation.voidTo set all the subcomponents with nextEvent = false (because we want, after an event, the possibility to continue the simulation in normal mode or with nextEvent way)voidvoidsetVelocityFactor(int velocity) Set the velocity Factor of the animationvoidstart()Start the animationvoidstop()Stop the animation.voidCalled by the animator each time is paused.voidupdateMultiple(Simulation sim, double[] percentages, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the MultipleQueue with routing Policy = PROBABILISTICvoidupdateMultiple(Simulation sim, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the MultipleQueuevoidupdatePause(long pause) This method is important for udpdating all those components inside the Animation that are affected by a pause of the Animator.voidupdateSingle(Simulation sim, int nservers, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the SingleQueueMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
jobSet
-
anim
-
animPanel
-
parent
-
simulation
-
velocityFactor
protected int velocityFactor -
source
-
sink
-
edgeList
-
stationList
-
-
Constructor Details
-
AnimationClass
-
-
Method Details
-
restartAnimator
public void restartAnimator() -
initGUI
-
refresh
public void refresh()Description copied from interface:AnimationMethod 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
Description copied from interface:AnimationPaint 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- Specified by:
paintin interfaceAnimation- Overrides:
paintin classJComponent- Parameters:
g-
-
start
-
pause
-
reload
-
stop
-
next
-
resetNextEvent
public void resetNextEvent()To set all the subcomponents with nextEvent = false (because we want, after an event, the possibility to continue the simulation in normal mode or with nextEvent way) -
setVelocityFactor
public void setVelocityFactor(int velocity) Description copied from interface:AnimationSet the velocity Factor of the animation- Specified by:
setVelocityFactorin interfaceAnimation
-
isPaused
public boolean isPaused() -
updatePause
public void updatePause(long pause) Description copied from interface:AnimationThis 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- Specified by:
updatePausein interfaceAnimation- Parameters:
pause- the amount of time during which the animator was paused
-
addNewJob
This method adds a new job inside the list of jobs of the Animation. It is usually called by the source of the Animation- Parameters:
job- to add in the list
-
removeJob
This method removes a job inside the list of jobs of the Animation. It is usually called by the sink of the Animation- Parameters:
job- to remove from the list
-
updateSingle
public void updateSingle(Simulation sim, int nservers, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the SingleQueue- Parameters:
sim- new info about the simulationnservers- number of serversserviceTime- distribution of the service timeinterArrivalTime- distribution of the inter-arrival timemaxJobs- max number of generated jobsisGraphicalAnimation- if the edge between the source and the station is there or not
-
updateMultiple
public void updateMultiple(Simulation sim, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the MultipleQueue- Parameters:
sim- new info about the simulationserviceTime- distribution of the service timeinterArrivalTime- distribution of the inter-arrival timemaxJobs- max number of generated jobsisGraphicalAnimation- if the edge between the source and the station is there or not
-
updateMultiple
public void updateMultiple(Simulation sim, double[] percentages, DistributionJMCH serviceTime, DistributionJMCH interArrivalTime, int maxJobs, boolean isGraphicalAnimation) Method for updating the MultipleQueue with routing Policy = PROBABILISTIC- Parameters:
sim- new info about the simulationpercentages- new array of percentages associated to the outgoing arcs from the routerserviceTime- distribution of the service timeinterArrivalTime- distribution of the inter-arrival timemaxJobs- max number of generated jobsisGraphicalAnimation- if the edge between the source and the station is there or not
-
getAnimator
-
getSimulation
-
getSolverAnimation
-
getVelocityFactor
public int getVelocityFactor() -
getListJobSize
public int getListJobSize() -
getSource
-
getSingleStation
-
updateAnimResults
public void updateAnimResults()Description copied from interface:AnimationCalled by the animator each time is paused. Update the results in the Result table for the ANIM row.- Specified by:
updateAnimResultsin interfaceAnimation
-