metaglue
Class OccupationFilter

java.lang.Object
  |
  +--metaglue.OccupationFilter
All Implemented Interfaces:
Cloneable, Filter, Serializable

public class OccupationFilter
extends Object
implements Filter, Serializable, Cloneable

This filter will match on objects that implement (or extend) certain occupation. So if you ask for "agentland.device.Device", it will match on everything that extends Device.

See Also:
Serialized Form

Field Summary
protected  Class occupation
           
 
Constructor Summary
OccupationFilter(String occupation)
           
 
Method Summary
protected static boolean isA(AgentID aid, Class occup)
           
static boolean isA(AgentID aid, String occupation)
          Returns true if agent represented by agent id is an instance of a given occupation; false otherwise.
 boolean match(Object obj)
          Returns true if the parameter is an AgentID of an agent that implements occupation passed in to the constructor of this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

occupation

protected Class occupation
Constructor Detail

OccupationFilter

public OccupationFilter(String occupation)
Method Detail

match

public boolean match(Object obj)
Returns true if the parameter is an AgentID of an agent that implements occupation passed in to the constructor of this filter. False otherwise.
Specified by:
match in interface Filter

isA

public static boolean isA(AgentID aid,
                          String occupation)
                   throws ClassNotFoundException
Returns true if agent represented by agent id is an instance of a given occupation; false otherwise. This method is declared static so that other people can use it from outside if they just need to do a one-time test

isA

protected static boolean isA(AgentID aid,
                             Class occup)
                      throws ClassNotFoundException