Class JobAnimation
java.lang.Object
common.animation.JobAnimation
- All Implemented Interfaces:
Animation
Created by IntelliJ IDEA.
User: orsotronIII
Date: 17-gen-2005
Time: 13.53.44
Represents a job to be routed through the queue net. Paths to be followed must be specified.
If more than one path is defined, this class randomly decides which path to follow next when
the current one is completed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doublecurrent symbolic position.protected longtimer that keeps trace of the millisecs passed by the time this job entered the element (e.g. -
Constructor Summary
ConstructorsConstructorDescriptionJobAnimation(double speed, JobPath[] jps, Rectangle bounds) Creates a new instance of JobAnimation initialized with specified default paths to be followed by the job and specified speed.JobAnimation(double speed, JobPath[] jps, Rectangle bounds, IconsToolkit toolkit) Creates a new instance of JobAnimation initialized with specified default paths to be followed by the job and specified speed.JobAnimation(JobAnimation job) Creates a new instance of JobAnimation initialized with specified values of another job. -
Method Summary
Modifier and TypeMethodDescriptionreturns background image for this animation.Returns bounding box for this animation, e.g.Returns next queue net element this job must be routed to.doublebooleanTells whether this job was set to be hidden or to be shown.doublegetSpeed()longreturns system timestamp (in millisecs) for the time of entrance in an element of the queuenet.voidinit()Initialization method for implementing class.voidpaint(Graphics g, ImageObserver io) Paints image currently handled in a rectangle defined withinAnimation.setBounds(Rectangle)methodvoidrefresh()Called when an animation needs to be refreshed.voidResets the time of entrance of this job in the element that currently contains it.voidsetBGImage(Image img) sets background image for this animation.voidSets bounding box for this animation.voidsetPosition(double newPosition) voidsetRepaint(boolean repaint) Tells this class to show or hide itself.
-
Field Details
-
position
protected double positioncurrent symbolic position. Represents a coordinate calculated along the line of an edge. -
timeOfEntrance
protected long timeOfEntrancetimer that keeps trace of the millisecs passed by the time this job entered the element (e.g. edge or station) it is going through
-
-
Constructor Details
-
JobAnimation
Creates a new instance of JobAnimation initialized with specified default paths to be followed by the job and specified speed.- Parameters:
speed- : speed this job must keep following its paths. It is measured in pixels per secondjps- : paths this Job can go throughbounds- : default size for this job
-
JobAnimation
Creates a new instance of JobAnimation initialized with specified values of another job.- Parameters:
job- : job wanted to be copied.
-
JobAnimation
Creates a new instance of JobAnimation initialized with specified default paths to be followed by the job and specified speed.- Parameters:
speed- : speed this job must keep following its paths. It is measured in pixels per secondjps- : paths this Job can go throughbounds- : default size for this jobtoolkit- : Image toolkit for customized renderization of job image
-
-
Method Details
-
refresh
-
init
-
paint
Description copied from interface:AnimationPaints image currently handled in a rectangle defined withinAnimation.setBounds(Rectangle)method -
getBGImage
Description copied from interface:Animationreturns background image for this animation.- Specified by:
getBGImagein interfaceAnimation- Returns:
- :Background image for this animation
-
setBGImage
Description copied from interface:Animationsets background image for this animation.- Specified by:
setBGImagein interfaceAnimation- Parameters:
img- : background image for this animation
-
setBounds
Description copied from interface:AnimationSets bounding box for this animation. If this box is set, animation will update only this certain area of the Graphics object passed withinAnimation.paint(Graphics, ImageObserver)method. -
getBounds
-
setRepaint
public void setRepaint(boolean repaint) Tells this class to show or hide itself.- Parameters:
repaint- : true if this class must show itself, false otherwise.
-
getRepaint
public boolean getRepaint()Tells whether this job was set to be hidden or to be shown.- Returns:
- true if this job must be shown, false otherwise
-
getSpeed
public double getSpeed() -
getPosition
public double getPosition() -
setPosition
public void setPosition(double newPosition) -
getNextElement
Returns next queue net element this job must be routed to. -
resetTimeOfEntrance
public void resetTimeOfEntrance()Resets the time of entrance of this job in the element that currently contains it. every class that accepts jobs must call this method whenever a a new job is added, in order to calculate the correct position once the job speed is known. -
getTimeOfEntrance
public long getTimeOfEntrance()returns system timestamp (in millisecs) for the time of entrance in an element of the queuenet.- Returns:
- :number of system millisecs time.
-