/** * Title: GPS Simulator * Copyright: Copyright (c) 2002 * Company: University of Oregon Computer Science Dept. * * @author Jason Prideaux * @version 1.0 * */ package agent; import util.*; import java.awt.*; /* ====================================================================== */ /** This class represents an agent on the map. An agent may be a User * representing an emulated ipaq user, or it may be a wireless access point * whose sole purpose is to help connect users. * This class cannot be initiated it only defines methods and variables that * will be used by specific types of Agents. * */ public abstract class Agent{ /** The current pixel location of this user. */ private Point location; /** The current gps Position of the agent. */ private Position position; /** The wireless networking range of this agent. */ private int range; /** The name of this agent. */ private String name; /* ===================================================================== */ /** This constructor initializes the agent with universal information * * @param n The name of the agent. * @param l The starting pixel location of this agent on the map. * @param p The starting gps position of this agent on the map. * @param r The wireless network range of the agent. * */ public Agent(String n, Point l, Position p, int r){ name = n; position = p; location = l; range = r; } //Constructor /* ===================================================================== */ /** This constructor initializes the agent with universal information * * @param l The starting pixel location of this agent on the map. * @param p The starting gps position of this agent on the map. * @param r The wireless network range of the agent. * */ public Agent(Point l, Position p, int r){ position = p; location = l; range = r; name = ""; } //Constructor /* ===================================================================== */ /** This method returns the name of this agent. * * @return String The name of this agent. * */ public String getName(){ return name; } //method: getName /* ===================================================================== */ /** This method sets the name of the agent. * * @param n The name of this agent. * */ public void setName(String n){ name = n; } //method: setName /* ===================================================================== */ /** This method returns the current pixel location of the agent. * * @return Point The current location. * */ public Point getLocation(){ return location; } //method: getLocation /* ===================================================================== */ /** This method return the current gps position of the agent. * * @return Position The current position. * */ public Position getPosition(){ return position; } //method: getPosition /* ===================================================================== */ /** This method returns the range of the agent. * * @return int The range in pixels. * */ public int getRange(){ return range; } //method: getRange /* ===================================================================== */ /** This method sets the pixel location of the agent. * * @param l The location of agent. * */ public void setLocation(Point l){ location = l; } //method: setLocation /* ===================================================================== */ /** This method sets the gps position of the agent. * * @param p The position of agent. * */ public void setPosition(Position p){ position = p; } //method: setPosition /* ===================================================================== */ /** This method sets the range of the agent. * * @param r The range in pixels. * */ public void setRange(int r){ range = r; } //method: setRange } //class: Agent