|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
jsim.animator.AnimationImp
public class AnimationImp
This class implements the Animation front end for the JSIM Simulation package. It uses a shared data Structure to receive AnimatorMessages from the Simulator and then repaints the Animation to reflect these changes.
| Nested Class Summary | |
|---|---|
class |
AnimationImp.AnimationFrame
Frame class for holding the components of the Animation |
class |
AnimationImp.AnimationPanel
Panel Class for holding Animation components |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected static java.util.logging.Logger |
trc
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
AnimationImp(Graph g,
AnimationQueue q)
Constructor Initializes all dataMembers |
|
AnimationImp(Graph g,
AnimationQueue q,
Model env)
Constructor Initializes all dataMembers |
|
| Method Summary | |
|---|---|
void |
beginSim()
Begins the Animation by setting start to true |
void |
changeSpeed(int value)
Controls the speed of the Animation |
void |
create(int shapeID,
java.lang.String shape,
java.awt.Label l,
double x,
double y,
double w,
double h,
double arcW,
double arcH,
double x2,
double y2,
int type,
double time)
Adds a Shape at given location Shapes: Line2D, QuadCurve2D, CubicCurve2D, Rectangle2D, RoundRectangle2D, Arc2D, Ellipse2D Qparam shapeID id for the new Shape |
void |
dequeueEntity(int shapeID,
double time)
Dequeues an entity |
void |
destroy(int shapeID,
double time)
Destroys a Shape based on ShapeID |
void |
endSim()
Ends the Animation by setting end to true |
void |
enqueueEntity(int shapeID,
double time)
Enqueues an entity |
void |
executeInstruction()
Gets an instruction from the shared queue and performs the instruction |
void |
incrementLost()
Increments the number of lost entities |
static void |
main(java.lang.String[] args)
Main Function used for testing purposes |
void |
move(int shapeID,
int edgeID,
int endNodeID,
double time)
Moves an entity from a starting node to an ending node along a given edge |
void |
rotate(int shapeID,
double theta,
double x,
double y,
double time)
Rotates a shape |
void |
run()
run() Responsible for the main control loop of the Animation Creates the Frame and Panel, then sleeps and repaints until the animation is through |
void |
scale(int shapeID,
double sx,
double sy,
double time)
Scales a Shape |
void |
setPaint(int shapeID,
java.awt.Color c1,
java.awt.Color c2,
double time)
Paint Method for gradient color, uses 2 Color arguments |
void |
setPaint(int shapeID,
java.awt.Color c,
double time)
Paint Method for solid color, uses 1 Color argument |
void |
setToLocation(int shapeID,
double x_location,
double y_location)
Moves an entity to the specified location |
void |
shear(int shapeID,
double shx,
double shy,
double time)
Shears a Shape |
void |
translate(int shapeID,
double tx,
double ty,
double time)
Translates a Shape to a new (x,y) location |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static java.util.logging.Logger trc
| Constructor Detail |
|---|
public AnimationImp(Graph g,
AnimationQueue q)
g - initial Graph for animationq - Animation queue for communication with Simulator
public AnimationImp(Graph g,
AnimationQueue q,
Model env)
g - initial Graph for animationq - Animation queue for communication with Simulatorenv - creating Model object| Method Detail |
|---|
public void create(int shapeID,
java.lang.String shape,
java.awt.Label l,
double x,
double y,
double w,
double h,
double arcW,
double arcH,
double x2,
double y2,
int type,
double time)
create in interface Animatorshape - Shape of the objectl - Label for the created Shapex - x-coordinate of the locationy - y-coordinate of the locationw - width of the shapeh - height of the shapearcW - arc width for curvesarcH - arc height for curvesx2 - double needed for some shapesy2 - double needed for some shapestype - type needed for certian shapestime - Simulation timeshapeID - id for the new Shape
public void destroy(int shapeID,
double time)
destroy in interface AnimatorshapeID - id of the Shape to destroytime - SImulation timepublic void incrementLost()
public void translate(int shapeID,
double tx,
double ty,
double time)
translate in interface AnimatorshapeID - id of Shape to translatetx - new x-coordinatety - new y-coordinatetime - Simulation time
public void rotate(int shapeID,
double theta,
double x,
double y,
double time)
rotate in interface AnimatorshapeID - id of Shape to tanslatetheta - angle of rotationx - new x-coordinatey - new y-coordinatetime - Simulation time
public void scale(int shapeID,
double sx,
double sy,
double time)
scale in interface AnimatorshapeID - id of Shape to scalesx - scaled x-coordinatesy - scaled y-coordiantetime - simulation time
public void shear(int shapeID,
double shx,
double shy,
double time)
shear in interface AnimatorshapeID - id of Shape to shearshx - scaled x-coordinateshy - scaled y-cooordinatetime - Simulation time
public void setPaint(int shapeID,
java.awt.Color c,
double time)
setPaint in interface AnimatorshapeID - id for Shape to paintc - Color for the Shapetime - Simulation time
public void setPaint(int shapeID,
java.awt.Color c1,
java.awt.Color c2,
double time)
setPaint in interface AnimatorshapeID - id for SHape to paintc1 - 1st Color for Shapec2 - 2nd Color for Shapetime - Simulation time
public void move(int shapeID,
int edgeID,
int endNodeID,
double time)
shapeID - id for Shape to moveedgeID - id for edge to move alongendNodeID - id of end nodetime - Simulation time
public void setToLocation(int shapeID,
double x_location,
double y_location)
shapeID - id of shape to movex_location - new x-coordinatey_location - new y-coordinatepublic void beginSim()
public void endSim()
public void changeSpeed(int value)
value - the value used to adjust speed
public void enqueueEntity(int shapeID,
double time)
shapeID - id of the entitytime - time in simulation
public void dequeueEntity(int shapeID,
double time)
shapeID - id of the entitytime - time in simulationpublic void executeInstruction()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||