antsim.nestor
Class LocalRequestSet

java.lang.Object
  |
  +--antsim.nestor.LocalRequestSet
All Implemented Interfaces:
Clearable, RequestSet

public class LocalRequestSet
extends Object
implements RequestSet

This class is a simple implementation of ResourceSet containing an hash table mapping ant identifiers to response listeners.

Version:
$Revision: 1.3 $
Author:
Alberto Montresor

Field Summary
 
Fields inherited from interface anthill.nest.RequestSet
NAME
 
Constructor Summary
LocalRequestSet(Factory factory, String name)
          Constructor
 
Method Summary
 void add(RequestId key, ResponseListener listener)
          Adds an association between a key and the listener interested in the responses returned by this ant.
 void clear()
          Restores the object to its initial state.
 boolean returnResources(RequestId key, Resource[] resources)
          Returns the specified resources to the listener associated to the given key
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalRequestSet

public LocalRequestSet(Factory factory,
                       String name)
Constructor

Parameters:
factory - the factory to be used to read configuration arguments and to create other configurable objects
name - the name that is associated to this instance in the configuration file
Method Detail

add

public void add(RequestId key,
                ResponseListener listener)
Description copied from interface: RequestSet
Adds an association between a key and the listener interested in the responses returned by this ant.

Specified by:
add in interface RequestSet
Parameters:
key - the key that will be used later to obtain the listener
listener - the listener which will be notified when a response is available

returnResources

public boolean returnResources(RequestId key,
                               Resource[] resources)
Description copied from interface: RequestSet
Returns the specified resources to the listener associated to the given key

Specified by:
returnResources in interface RequestSet
Parameters:
key - the key that is used to obtain listener
resources - the resources found.

clear

public void clear()
Restores the object to its initial state.

Specified by:
clear in interface Clearable

toString

public String toString()
Overrides:
toString in class Object