|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.colorado.cs.ns2.animation.Animate
public class Animate
This class implements the animation thread. It is responsible for populating the simulatio nevent TimeLine and animating the Packet Flow.
Runnable
Field Summary | |
---|---|
private java.awt.Container |
contentPane
A Reference to the JFrame's contentPane. |
private DrawableMover |
mover
A Reference to the DrawableMover object. |
private java.util.Vector<TimeLine> |
timeLine
A time line of simulation events. |
Constructor Summary | |
---|---|
Animate(java.awt.Container contentPane,
DrawableMover mover)
Constructor. |
Method Summary | |
---|---|
void |
drawPacket(int X,
int Y,
int packetSize)
Draw a Rectangle to represent the packet. |
void |
erasePacket(int X,
int Y,
int packetSize)
Erase the Rectangle at the given Location. |
java.util.Vector<java.awt.Point> |
getPacketFlow(int fromNode,
int toNode,
int noOfPoints)
Calculates the set of Co-ordinates at which the packet component should be drawn in the Animation. |
void |
run()
This is the animation thread's main entry point. |
void |
setupTimeLine()
Sets up the TimeLine of events that need to be animated and stores it as a Vector of TimeLine Objects. |
void |
sortTimeLine()
Sort the TimeLine Vector using Quicksort. |
void |
startAnimation(int increment)
Reads the TimeLine Vector and animates pakcets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.awt.Container contentPane
private DrawableMover mover
private java.util.Vector<TimeLine> timeLine
Constructor Detail |
---|
public Animate(java.awt.Container contentPane, DrawableMover mover)
contentPane
- mover
- Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
public java.util.Vector<java.awt.Point> getPacketFlow(int fromNode, int toNode, int noOfPoints)
fromNode
- - Read from the out.nam FiletoNode
- - Read from the out.nam FilenoOfPoints
- - The number of Points between two nodes where packet needs to be drawn.
public void setupTimeLine()
public void startAnimation(int increment)
increment
- - Time Interval in ms for incrementing the simulation time period.public void sortTimeLine()
public void drawPacket(int X, int Y, int packetSize)
X
- x co-ordinate for the RectangleY
- y co-ordinate for the RectanglepacketSize
- - the size of the rectangle - currently ignoredpublic void erasePacket(int X, int Y, int packetSize)
X
- x co-ordinate for the RectangleY
- y co-ordinate for the RectanglepacketSize
- - the size of the rectangle - currently ignored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |