org.dbe.eve.simulator
Class LocalServicePool

java.lang.Object
  extended by org.dbe.eve.simulator.LocalServicePool
All Implemented Interfaces:
java.lang.Cloneable

public class LocalServicePool
extends java.lang.Object
implements java.lang.Cloneable

Is used to manage services


Field Summary
(package private) static org.apache.log4j.Logger logger
           
private  EvEModel model
           
(package private) static MersenneTwister mt
           
private  java.util.Vector<ServicePoolElement> servicePool
           
 
Constructor Summary
LocalServicePool()
          constructs an ServicePool
LocalServicePool(java.util.Vector newServicePool, EvEModel model)
          Constructs an ServicePool have certain already stored.
 
Method Summary
 void clearLocalServicePool()
           
 java.lang.Object clone()
          returns an hard copy of the ServicePool
 Service getRandomService()
          returns random an Serivce of the ServicePool
 java.util.Vector getServicePool()
          returns the ServicePool
 ServicePoolElement getServicePoolElement(Service searchedService)
          search in the ServicePool if the searchedService is stored in this ServicePool
 java.util.Vector getServicePoolServices()
          returns an Vector which store the Services of the ServicePool
 java.util.Vector getServicePoolServicesSortedByNumUsedInGA()
          The first element of the return value (a vector) is the ServicePoolElement with the smallest NumUsedInGA
 java.util.Vector getServicePoolServicesSortedByWasAddedAtStep()
          The first element of the return value (a vector) is the oldes ServicePoolElement
 int getServicePoolSize()
          returns the number of Services which are stored in this ServicePool
 void putServiceToServicePool(Service serviceToAdd)
          adds an Service to this ServicePool
 void putServiceToServicePool(java.util.Vector<Service> servicesToAdd)
          adds all Services in a given Vector to this ServicePool
 boolean removeServiceFromServicePool(Service serviceToRemove)
          removes an Service from this ServicePool
 boolean serviceWasUsedInGA(Service serviceToSearch)
          return true if the service was used one or more times in an GA
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

servicePool

private java.util.Vector<ServicePoolElement> servicePool

model

private EvEModel model

mt

static MersenneTwister mt

logger

static org.apache.log4j.Logger logger
Constructor Detail

LocalServicePool

public LocalServicePool()
constructs an ServicePool


LocalServicePool

public LocalServicePool(java.util.Vector newServicePool,
                        EvEModel model)
Constructs an ServicePool have certain already stored.

Parameters:
newServicePool - are Services which should be stored in the ServicePool
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
returns an hard copy of the ServicePool

Overrides:
clone in class java.lang.Object
Returns:
Object is the copy of the ServicePool
Throws:
java.lang.CloneNotSupportedException

getServicePool

public java.util.Vector getServicePool()
returns the ServicePool

Returns:
Vector in which all Service of this ServicePool are stored

getServicePoolServices

public java.util.Vector getServicePoolServices()
returns an Vector which store the Services of the ServicePool

Returns:

getServicePoolServicesSortedByWasAddedAtStep

public java.util.Vector getServicePoolServicesSortedByWasAddedAtStep()
The first element of the return value (a vector) is the oldes ServicePoolElement

Returns:
Vector of services

serviceWasUsedInGA

public boolean serviceWasUsedInGA(Service serviceToSearch)
return true if the service was used one or more times in an GA


getServicePoolServicesSortedByNumUsedInGA

public java.util.Vector getServicePoolServicesSortedByNumUsedInGA()
The first element of the return value (a vector) is the ServicePoolElement with the smallest NumUsedInGA

Returns:
Vector of services

getServicePoolElement

public ServicePoolElement getServicePoolElement(Service searchedService)
search in the ServicePool if the searchedService is stored in this ServicePool

Parameters:
searchedService -
Returns:
ServicePoolElement if the searchedService was found in this ServicePool

getServicePoolSize

public int getServicePoolSize()
returns the number of Services which are stored in this ServicePool

Returns:
int the number of Services stored in this ServicePool

putServiceToServicePool

public void putServiceToServicePool(Service serviceToAdd)
adds an Service to this ServicePool

Parameters:
serviceToAdd - is the Service which should be added

putServiceToServicePool

public void putServiceToServicePool(java.util.Vector<Service> servicesToAdd)
adds all Services in a given Vector to this ServicePool

Parameters:
servicesToAdd - are the Services which should be added

removeServiceFromServicePool

public boolean removeServiceFromServicePool(Service serviceToRemove)
removes an Service from this ServicePool

Parameters:
serviceToRemove - is the Service which should be removed
Returns:
true if it was possible to remove the Service form this ServicePool

getRandomService

public Service getRandomService()
returns random an Serivce of the ServicePool

Returns:
Service is an random choosen Service

clearLocalServicePool

public void clearLocalServicePool()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object