massim.framework
Class AbstractAgentFilter

java.lang.Object
  extended by massim.framework.AbstractAgentFilter
All Implemented Interfaces:
AgentProvider
Direct Known Subclasses:
TeamAgentFilter

public abstract class AbstractAgentFilter
extends java.lang.Object
implements AgentProvider

This class provides a good start to build agent provider that are based on another agent provider which will just filter it's offers by some criteria based upon an agent parameter.


Constructor Summary
protected AbstractAgentFilter(AgentProvider b)
           
 
Method Summary
 void allocateAgent(UniqueSimulationAgent agent)
          Allocates an agent.
 void freeAgent(UniqueSimulationAgent agent)
          Free an agent
 UniqueSimulationAgent[] getAgents(AgentParameter p)
          Retrieve a list of available agents, fulfilling requirements as mentioned in agentparameter;
 AgentProvider getBase()
           
protected abstract  boolean isSuitable(UniqueSimulationAgent a, AgentParameter p)
          This method determines if an agent suits the requirements found in agent parameters p.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAgentFilter

protected AbstractAgentFilter(AgentProvider b)
Method Detail

getBase

public AgentProvider getBase()

getAgents

public UniqueSimulationAgent[] getAgents(AgentParameter p)
Description copied from interface: AgentProvider
Retrieve a list of available agents, fulfilling requirements as mentioned in agentparameter;

Specified by:
getAgents in interface AgentProvider
Returns:
an array of suitable agents

isSuitable

protected abstract boolean isSuitable(UniqueSimulationAgent a,
                                      AgentParameter p)
This method determines if an agent suits the requirements found in agent parameters p.

Parameters:
a - agent candidate
p - agent requirements.
Returns:
true iff a suits p.

allocateAgent

public void allocateAgent(UniqueSimulationAgent agent)
Allocates an agent. An allocated agent won't be offered by this provider until it's remove method is called.

Specified by:
allocateAgent in interface AgentProvider
Parameters:
agent - to allocate.

freeAgent

public void freeAgent(UniqueSimulationAgent agent)
Description copied from interface: AgentProvider
Free an agent

Specified by:
freeAgent in interface AgentProvider


Copyright © 2012. All Rights Reserved.