org.dbe.eve.simulator
Class AttributePool

java.lang.Object
  extended by org.dbe.eve.simulator.AttributePool

public class AttributePool
extends java.lang.Object

Is used to provide attributes


Field Summary
private  java.util.Vector attributes
           
private static AttributePool instance
           
(package private) static org.apache.log4j.Logger logger
           
private  EvEModel model
           
(package private) static MersenneTwister mt
           
 
Constructor Summary
private AttributePool()
           
 
Method Summary
 boolean addAttribute(Attribute attributeToAdd)
          Adds an Attribute to the Pool
 void clear()
          Clears the attribute pool
 java.util.Vector getAllAttributesInAttributePool()
          Return the whole AttributePool
 Attribute getAttribute(int ID)
          Retuns an Attribute which have a specific ID
private  int getConfiguredAttributeLenght()
           
static AttributePool getInstance()
          Singelton to ensure that only one Instance exsist
 Attribute getRandomAttribute()
          Returns a random picked Attribute of the AttributePool
 java.util.Vector getRandomAttributes()
          creates a vector of attributes choosen randomly from the attribute pool number of attributes is taken from the eveModel
 java.util.Vector getRandomAttributes(int numOfAttributes)
          creates a vector of attributes choosen randomly from the attribute pool
 DemandedAttribute getRandomDemandedAttribute()
          Returns a random picked Attribute of the AttributePool and converts its into an DemandedAttribute
 java.util.Vector getRandomDemandedAttributes()
          creates a vector of DemandedAttributes choosen randomly from the attribute pool number of attributes is taken from the eveModel
 java.util.Vector getRandomDemandedAttributes(int numOfDemandedAttributes)
          creates a vector with demandedAttributes choosen randomly from the attribute pool
 void initialiseRandomAttributePool(int numberOfAttributes)
          Creates an random AttributePool
 boolean removeAttribute(Attribute attributeToRemove)
          Removes an Attribute of this AttributePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static AttributePool instance

attributes

private java.util.Vector attributes

logger

static org.apache.log4j.Logger logger

model

private EvEModel model

mt

static MersenneTwister mt
Constructor Detail

AttributePool

private AttributePool()
Method Detail

getInstance

public static AttributePool getInstance()
Singelton to ensure that only one Instance exsist

Returns:
AttributePool the instance

addAttribute

public boolean addAttribute(Attribute attributeToAdd)
Adds an Attribute to the Pool

Parameters:
attributeToAdd - is the Attribute which should be added to the Pool
Returns:
true if no Attribute with the same ID is in the Pool

removeAttribute

public boolean removeAttribute(Attribute attributeToRemove)
Removes an Attribute of this AttributePool

Parameters:
attributeToRemove - represents the Attribute which should be removed from the AttributePool
Returns:
true if it was found and removed from the AttributePool

initialiseRandomAttributePool

public void initialiseRandomAttributePool(int numberOfAttributes)
Creates an random AttributePool

Parameters:
numberOfAttributes - is the number of Attributes of which the random AttributePool should exsist

getAllAttributesInAttributePool

public java.util.Vector getAllAttributesInAttributePool()
Return the whole AttributePool

Returns:
Vector of attributes

getAttribute

public Attribute getAttribute(int ID)
Retuns an Attribute which have a specific ID

Parameters:
ID -
Returns:
Attribute the searched Attribute

getRandomAttribute

public Attribute getRandomAttribute()
Returns a random picked Attribute of the AttributePool

Returns:
Attribute

getRandomAttributes

public java.util.Vector getRandomAttributes()
creates a vector of attributes choosen randomly from the attribute pool number of attributes is taken from the eveModel

Parameters:
numOfAttributes - number of attributes
Returns:
Vector of Attributes

getRandomAttributes

public java.util.Vector getRandomAttributes(int numOfAttributes)
creates a vector of attributes choosen randomly from the attribute pool

Parameters:
numOfAttributes - number of attributes
Returns:
Vector of Attributes

getConfiguredAttributeLenght

private int getConfiguredAttributeLenght()
Returns:
random number between min and max value of configured Attribute lenght in the EvEModel

getRandomDemandedAttribute

public DemandedAttribute getRandomDemandedAttribute()
Returns a random picked Attribute of the AttributePool and converts its into an DemandedAttribute

Returns:
DemandedAttribute

getRandomDemandedAttributes

public java.util.Vector getRandomDemandedAttributes()
creates a vector of DemandedAttributes choosen randomly from the attribute pool number of attributes is taken from the eveModel

Parameters:
numOfAttributes - number of attributes
Returns:
Vector of Attributes

getRandomDemandedAttributes

public java.util.Vector getRandomDemandedAttributes(int numOfDemandedAttributes)
creates a vector with demandedAttributes choosen randomly from the attribute pool

Parameters:
numOfAttributes - number of attributes
Returns:
Vector of Attributes

clear

public void clear()
Clears the attribute pool