edu.ntnu.ecosim.agents.consumers
Class Memory

java.lang.Object
  extended by edu.ntnu.ecosim.agents.consumers.Memory

public class Memory
extends java.lang.Object

This class represents the memory of the consumers.

Author:
Martin

Constructor Summary
protected Memory()
          Constructor of the memory.
 
Method Summary
protected  void addCalculatedProviderValue(int sp, double value)
          Method to add a value to the "calculatedProviderValue" list
protected  void addInnovationKnowledge(java.util.HashMap<java.lang.String,java.lang.String> newInnovations)
          Method that may be used to add knowledge about a range of innovations (represented through a HashMap)
protected  void addInnovationKnowledge(java.lang.String uniqueID, java.lang.String spUniqueID)
          Method to add knowledge about an innovation
protected  void addKnowledge(java.lang.String uniqueID, int persuation)
          Method used to add knowledge about a service provider.
protected  void addTriedProvider(java.lang.String uniqueID, int time)
          Method used when a new provider is tried out.
protected  void eraseOldMemory(int time)
          Method to erase memory older than the "memory time".
protected  double getCalculatedProviderValue(int sp)
          Mehtod to get the calculated value of a specified service provider
protected  java.util.HashMap<java.lang.String,java.lang.String> getInnovationsOfProvider(java.lang.String spUniqueID)
          Method used to get the list of all the innovations this memory contains about a specified provider
protected  java.util.ArrayList<java.lang.String> getKnownProviders()
          Method to get the list of known providers.
protected  boolean isTried(java.lang.String uniqueID)
          This method can be used to check whether or not a provider is tried out earlier
protected  boolean knowsInnovation(java.lang.String uniqueID)
          Method to check whether this memory contains information about an innovation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Memory

protected Memory()
Constructor of the memory.

Method Detail

addCalculatedProviderValue

protected void addCalculatedProviderValue(int sp,
                                          double value)
Method to add a value to the "calculatedProviderValue" list

Parameters:
sp - the service providers place in the market list
value - the value of the provider

addInnovationKnowledge

protected void addInnovationKnowledge(java.util.HashMap<java.lang.String,java.lang.String> newInnovations)
Method that may be used to add knowledge about a range of innovations (represented through a HashMap)

Parameters:
newInnovations - a HashMap containing the new innovations

addInnovationKnowledge

protected void addInnovationKnowledge(java.lang.String uniqueID,
                                      java.lang.String spUniqueID)
Method to add knowledge about an innovation

Parameters:
uniqueID - the unique ID of the innovation
spUniqueID - the unique ID of the service provider providing the innovation

addKnowledge

protected void addKnowledge(java.lang.String uniqueID,
                            int persuation)
Method used to add knowledge about a service provider.

Parameters:
persuation - the persuation force of this knowledge
uniqueID - The unique ID of the service provider

addTriedProvider

protected void addTriedProvider(java.lang.String uniqueID,
                                int time)
Method used when a new provider is tried out.

Parameters:
time - the time at which the provider was chosen
uniqueID - the unique ID of the tried provider

eraseOldMemory

protected void eraseOldMemory(int time)
Method to erase memory older than the "memory time".

Parameters:
time - The current time

getCalculatedProviderValue

protected double getCalculatedProviderValue(int sp)
Mehtod to get the calculated value of a specified service provider

Parameters:
sp - the service providers place in the market list
Returns:
the value

getInnovationsOfProvider

protected java.util.HashMap<java.lang.String,java.lang.String> getInnovationsOfProvider(java.lang.String spUniqueID)
Method used to get the list of all the innovations this memory contains about a specified provider

Parameters:
spUniqueID - the unique ID of the service provider
Returns:
a HashMap containing the unique IDs of the innovations and the unique ID of the service provider they belong to

getKnownProviders

protected java.util.ArrayList<java.lang.String> getKnownProviders()
Method to get the list of known providers.

Returns:
the list of known providers

isTried

protected boolean isTried(java.lang.String uniqueID)
This method can be used to check whether or not a provider is tried out earlier

Parameters:
uniqueID - the unique id of the provider
Returns:
true if the provider is tried before

knowsInnovation

protected boolean knowsInnovation(java.lang.String uniqueID)
Method to check whether this memory contains information about an innovation

Parameters:
uniqueID - the unique id of the innovation
Returns:
true if the memory contains the innovation