edu.sc.ants
Class Target

java.lang.Object
  |
  +--edu.sc.ants.Thing
        |
        +--edu.sc.ants.Agent
              |
              +--edu.sc.ants.Target

public class Target
extends Agent

Is followed by a Follower agent and uses negotiation protocols to make sure that no more than n agents are following him


Field Summary
(package private)  java.util.Vector followers
          The IDs of the agents following me
(package private)  int maxNumFollow
          The maximum number of agents I want following me.
 
Fields inherited from class edu.sc.ants.Thing
env, fixed, heading, lastInput, myBroadcastRange, myColor, myExpireWait, myID, mySensingRange, mySize, name, running, suspended, type, xLocation, yLocation
 
Constructor Summary
Target(int id, Environment e, java.lang.String n, double x, double y, double h, java.lang.String t)
           
 
Method Summary
 void draw(java.awt.Graphics g, double x, double y, double heading)
          Draw myself the color red.
(package private)  boolean isFollowingMe(int agentID)
          Is this agent following me (i.e.
 void processInput()
           
 
Methods inherited from class edu.sc.ants.Agent
drawInfo, generateAction
 
Methods inherited from class edu.sc.ants.Thing
draw, expireObservations, incorporateObservations, incorporateOthersObservations, resume, run, start, stop, suspend
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

maxNumFollow

int maxNumFollow
The maximum number of agents I want following me.

followers

java.util.Vector followers
The IDs of the agents following me
Constructor Detail

Target

public Target(int id,
              Environment e,
              java.lang.String n,
              double x,
              double y,
              double h,
              java.lang.String t)
Method Detail

draw

public void draw(java.awt.Graphics g,
                 double x,
                 double y,
                 double heading)
Draw myself the color red.
Overrides:
draw in class Thing

isFollowingMe

boolean isFollowingMe(int agentID)
Is this agent following me (i.e. do I think he is following me). I cannot use .contains because that looks for the exact object, not the value of the object
Parameters:
agentID - him
Returns:
true if he is, false if not

processInput

public void processInput()
Overrides:
processInput in class Agent