/** * Title: GPS Simulator * Copyright: Copyright (c) 2002 * Company: University of Oregon Computer Science Dept. * * @author Jason Prideaux * @version 1.0 * */ package transport.protocol; import java.io.*; /* ====================================================================== */ /** This class defines the basic structure for a message used to send data * between agents in the simulation. * */ public abstract class Message implements Serializable{ /** The port number of who sent the message. */ private int from; /** The port number to whom the message is being sent. */ private int to; /* ===================================================================== */ /** This constructor initializes the Message. * * @param p The port the ipaq gps receiver is listening on. * */ public Message(int to, int from){ this.to = to; this.from = from; } //Constructor /* ===================================================================== */ /** This method returns the port that the sender listens to. * * @return int The port number. * */ public int getFrom(){ return from; } //method: getFrom /* ===================================================================== */ /** This method returns the port to send the message to. * * @return int The port number. * */ public int getTo(){ return to; } //method: getTo /* ===================================================================== */ /** This method sets the port to send the message to. * * @return int The port number. * */ public void setTo(int t){ to = t; } //method: getTo } //class: Message