Nodenet Problem Set Javadocs

nodenet
Class Packet

java.lang.Object
  extended bynodenet.Packet
All Implemented Interfaces:
java.lang.Cloneable

public class Packet
extends java.lang.Object
implements java.lang.Cloneable

An object that can be sent across the network. Currently all code ignores the fact that packets are more than Objects, but in future versions the destination and the list of visited nodes may become significant.

Author:
Patrick G. Heck, gus.heck@olin.edu $Id: Packet.java,v 1.6 2004/01/14 21:43:17 gus Exp $

Constructor Summary
Packet(java.lang.String dest)
          Creates a new instance of Packet
 
Method Summary
 java.lang.Object clone()
          Return a clone of the Packet.
 java.lang.String getDest()
          Find out where the packet is headed.
 java.util.Vector getVisitList()
          Get a list of the nodes visited, if they have been recorded.
 void logVisit(java.lang.String nodeName)
          Record that a node was visited.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Packet

public Packet(java.lang.String dest)
Creates a new instance of Packet

Method Detail

getDest

public java.lang.String getDest()
Find out where the packet is headed.

Returns:
the destination set for this packet if any

clone

public java.lang.Object clone()
Return a clone of the Packet. The cloned object is guaranteed to be an independant copy of the current object and not share any instances of mutable classes with the parent object. Immutable classes may or may not be shared. Client code should not rely on sharing of immutable classes since this may break in future implementations.

Returns:
a clone of the object.

logVisit

public void logVisit(java.lang.String nodeName)
Record that a node was visited.

Parameters:
nodeName - the name of the node to be reocorded

getVisitList

public final java.util.Vector getVisitList()
Get a list of the nodes visited, if they have been recorded. For this to be useful, the NodeBehaviors must invoke logVisit(String) when they handle a packet.

Returns:
A copy of the list of the nodes visited.

Nodenet Problem Set Javadocs