Inheritance diagram for Packet::

| Public Methods | |
| Packet () | |
| Packet (int length) | |
| Packet (int length, Node source, Node destination) | |
| Packet (int length, Node source, Node destination, int ttl) | |
| StringBuffer | getContents () | 
| void | setContents (StringBuffer contents) | 
| int | getLength () | 
| void | setTimeToLive (int time_to_live) | 
| int | hop () | 
| void | setSourceNode (Node source_node) | 
| void | setDestinationNode (Node destination_node) | 
| Node | getSourceNode () | 
| Node | getDestinationNode () | 
| boolean | getDrawingFlag () | 
| void | setDrawingFlag (boolean flag) | 
| void | paint (Graphics g, FontMetrics metrics, Color fill_color, int x, int y) | 
| Protected Attributes | |
| StringBuffer | contents | 
| int | packet_length = 500 | 
| Node | source_node = null | 
| Node | destination_node = null | 
| int | time_to_live = 40 | 
| boolean | draw = false | 
Definition at line 22 of file Packet.java.
| 
 | 
| Default empty constructor. Constructs a 500 bytes package. Definition at line 46 of file Packet.java. 00047     {
00048         contents = new StringBuffer (packet_length);
00049     }
 | 
| 
 | 
| Constructructs a packet with inital size specified by length argument. 
 Definition at line 56 of file Packet.java. 00057     {
00058         if(length < 0) length = 500;
00059         packet_length = length;
00060         contents = new StringBuffer(packet_length);
00061     }
 | 
| 
 | 
| Constructructs a packet with inital size specified by length argument and sets source and destination node. 
 Definition at line 71 of file Packet.java. 00072     {
00073         if(length < 0) length = 500;
00074         packet_length = length;
00075         source_node = source;
00076         destination_node = destination;
00077         contents = new StringBuffer(packet_length);
00078     }
 | 
| 
 | 
| Constructructs a packet with inital ttl specified by ttl argument and sets source and destination node. 
 Definition at line 89 of file Packet.java. 00090     {
00091         if(length < 0) length = 500;
00092         packet_length = length;
00093         source_node = source;
00094         destination_node = destination;
00095         contents = new StringBuffer(packet_length);
00096         time_to_live = ttl;
00097     }
 | 
| 
 | 
| Gets packet contents. 
 Definition at line 104 of file Packet.java. 00105     {
00106         return contents;
00107     }
 | 
| 
 | 
| Gets destination node. 
 Definition at line 192 of file Packet.java. Referenced by Node::transmitAll(). 
 00193     {
00194         return destination_node;
00195     }
 | 
| 
 | 
| Gets status of drawing flag. Drawing flag is used to distinguish important packets (packets that have the drawing flag set will always be drawn). 
 Definition at line 204 of file Packet.java. Referenced by Line::paint(). 
 00205     {
00206         return draw;
00207     }
 | 
| 
 | 
| Gets packet length. 
 Definition at line 126 of file Packet.java. 00127     {
00128         return packet_length;
00129     }
 | 
| 
 | 
| Gets source node. 
 Definition at line 182 of file Packet.java. 00183     {
00184         return source_node;
00185     }
 | 
| 
 | 
| Decreases TTL counter. When zero is hit, packet will be discarded. 
 Definition at line 148 of file Packet.java. Referenced by Node::transmitAll(). 
 00149     {
00150         if (time_to_live > 0)
00151             {
00152                 time_to_live -= 1;
00153             }
00154         return time_to_live;
00155     }
 | 
| 
 | 
| Draws packet at location (x, y). 
 Definition at line 228 of file Packet.java. Referenced by Line::paint(). 
 00229     {
00230         g.setColor(fill_color);
00231         g.fillOval(x, y, 8, 8);
00232         g.setColor(Color.black);
00233         g.drawOval(x, y, 8, 8);
00234     }
 | 
| 
 | 
| Sets packet contents. 
 Definition at line 114 of file Packet.java. 00115     {
00116         this.contents.setLength(0);
00117         this.contents.append(contents);
00118         this.contents.setLength(packet_length);
00119     }
 | 
| 
 | 
| Sets destination node. 
 Definition at line 172 of file Packet.java. 00173     {
00174         this.destination_node = destination_node;
00175     }
 | 
| 
 | 
| Sets drawing flag. 
 Definition at line 214 of file Packet.java. Referenced by CyclopsSimulator::sendPacket(). 
 00215     {
00216         draw = flag;
00217     }
 | 
| 
 | 
| Sets source node. 
 Definition at line 162 of file Packet.java. 00163     {
00164         this.source_node = source_node;
00165     }
 | 
| 
 | 
| Sets TTL counter. If the given time is negative, packet will live forever (or until simulation is terminated). 
 Definition at line 138 of file Packet.java. Referenced by CyclopsSimulator::addDummyPackets(). 
 00139     {
00140         this.time_to_live = time_to_live;
00141     }
 | 
| 
 | 
| A varible size buffer for packet's contents. Definition at line 26 of file Packet.java. | 
| 
 | 
| Destination node. Set by first Node. Definition at line 35 of file Packet.java. | 
| 
 | 
| Drawing flag. Definition at line 41 of file Packet.java. | 
| 
 | 
| Packet length. Definition at line 29 of file Packet.java. | 
| 
 | 
| Source node. Set by first Node. Definition at line 32 of file Packet.java. | 
| 
 | 
| Time to live. Definition at line 38 of file Packet.java. | 
 1.2.7 written by Dimitri van Heesch,
 © 1997-2001
1.2.7 written by Dimitri van Heesch,
 © 1997-2001