edu.colorado.cs.ns2.animation
Class TimeLine

java.lang.Object
  extended by edu.colorado.cs.ns2.animation.TimeLine
All Implemented Interfaces:
java.lang.Comparable

public class TimeLine
extends java.lang.Object
implements java.lang.Comparable

This class is used to represent discrete events in the simulation as a time line. It stores the time of the event, co-ordinates, and packet size for animation. @see Comparable

Author:
Kevin Bauer, Pushkar Sambhoos.

Field Summary
private  int packetSize
          The size of the packet within the event.
private  int time
          Store the logical time of the discrete event (not the real clock time).
private  int X
          The X-coordinate.
private  int Y
          The Y-coordinate.
 
Constructor Summary
TimeLine(int time, int x, int y)
          Three-argument constructor.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares two TimeLine Objects by the time field.
 int getPacketSize()
          Get the Size of Packet for this Event.
 int getTime()
          Get the time in ms for the event.
 int getX()
          Get x co-ordinate of the packet to be displayed.
 int getY()
          Get y co-ordinate of the packet to be displayed.
 void setPacketSize(int packetSize)
          Set the size of the packet for this Event.
 java.lang.String toString()
          Returns a String representation of a TimeLine Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

time

private int time
Store the logical time of the discrete event (not the real clock time).


X

private int X
The X-coordinate.


Y

private int Y
The Y-coordinate.


packetSize

private int packetSize
The size of the packet within the event.

Constructor Detail

TimeLine

public TimeLine(int time,
                int x,
                int y)
Three-argument constructor.

Parameters:
time - Stores the logical time of the discrete event.
x - Stores the X-coordinate.
y - Stores the Y-coordinate.
Method Detail

getTime

public int getTime()
Get the time in ms for the event.

Returns:
The time in ms.

getX

public int getX()
Get x co-ordinate of the packet to be displayed.

Returns:
The X-coordinate.

getY

public int getY()
Get y co-ordinate of the packet to be displayed.

Returns:
The Y-coordinate.

compareTo

public int compareTo(java.lang.Object o)
Compares two TimeLine Objects by the time field.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The Object that is compared to the current object.
Returns:
0 if the two TimeLine objects have the same time, -1 if the current TimeLine Object is less than Object o, or 1 if the current Object is greater than Object o.

toString

public java.lang.String toString()
Returns a String representation of a TimeLine Object.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of a TimeLine Object.

getPacketSize

public int getPacketSize()
Get the Size of Packet for this Event.

Returns:
- The event's packet size.

setPacketSize

public void setPacketSize(int packetSize)
Set the size of the packet for this Event.

Parameters:
The - event's packet size.