antsim.impl
Class RandomResourceSet

java.lang.Object
  |
  +--antsim.impl.RandomResourceSet
All Implemented Interfaces:
Clearable, ResourceSet

public class RandomResourceSet
extends Object
implements ResourceSet, Clearable

RandomResourceSet is a simple implementation of ResourceSet which generates RandomResources. Each random resource has a generic name, which is the string representing a random long value. Requests are obtained by selecting randomly one of the resources stored in this ResourceSet and by returning the string containing the resource name.

Version:
$Revision: 1.3 $
Author:
Alberto Montresor

Field Summary
static String PAR_SIZE
          String name of the parameter used to determine the number of of resources contained in this resource set.
 
Fields inherited from interface antsim.ResourceSet
NAME
 
Constructor Summary
RandomResourceSet(Factory factory, String name)
          Initializes a new random resource set.
 
Method Summary
 void clear()
          Restores the object to its initial state.
 List getResources()
          Return an array containing the resources generated and stored in this ResourceSet.
 int size()
          Return the number of resources generated and stored in this ResourceSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAR_SIZE

public static final String PAR_SIZE
String name of the parameter used to determine the number of of resources contained in this resource set.

See Also:
Constant Field Values
Constructor Detail

RandomResourceSet

public RandomResourceSet(Factory factory,
                         String name)
Initializes a new random resource set. Configuration parameters are read through the

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

clear

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

Specified by:
clear in interface Clearable

size

public int size()
Return the number of resources generated and stored in this ResourceSet.


getResources

public List getResources()
Return an array containing the resources generated and stored in this ResourceSet.

Specified by:
getResources in interface ResourceSet