de.cesr.lara.components.preprocessor.impl
Class LPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>

java.lang.Object
  extended by de.cesr.lara.components.preprocessor.impl.LPreprocessor<A,BO>
Type Parameters:
A - the type of agents this preprocessor builder is intended for
BO - the type of behavioural options the preprocessor shall manage
All Implemented Interfaces:
LaraAbstractEventSubscriber, LaraInternalEventSubscriber, LaraPreprocessor<A,BO>

public final class LPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
extends Object
implements LaraPreprocessor<A,BO>, LaraInternalEventSubscriber

The LPreprocessor class provides immutable (once assigned, the references to preprocessor components are only passed to the preprocessor constructor which is designed to be used only for one agent during a single simulation step) instances of LPreprocessors. Default implementation of LaraPreprocessor. Supports comprehensive logging. IMPLEMENTATION NOTE: An enum implementation would be nice but fails to deal with different types of pre-process components...


Constructor Summary
protected LPreprocessor()
          Use LaraPreprocessorConfigurator.getPreprocessor() to receive an instance of a pre-processor (it keeps instances and returns it if appropriate)!
protected LPreprocessor(LaraPreprocessorConfigurator<A,BO> configuration)
          Use LaraPreprocessorConfigurator.getPreprocessor() to receive an instance of a pre-processor (it keeps instances and returns it if appropriate)!
 
Method Summary
 boolean equals(Object preprocessor)
          Checks for equal objects.
 LaraPreprocessorConfigurator<A,BO> getAlteredConfiguration(LaraPreprocessorConfigurator<A,BO> changeConfiguration)
          This method returns a LaraPreprocessorConfigurator that equals this instance apart from the configuration included in the given LaraPreprocessorConfigurator.
 String getComponentsString()
          Lists all preprocessor components defined in this preprocessor.
 boolean meetsConfiguration(LaraPreprocessorConfigurator<A,BO> configuration)
          Checks whether this preprocessor conforms to the configuration represented by the given LaraPreprocessorConfigurator.
 void onInternalEvent(LaraEvent event)
          Only for internal super classes beeing part of the LARA core.
 void preprocess(LaraDecisionConfiguration dConfig, A agent)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LPreprocessor

protected LPreprocessor()
Use LaraPreprocessorConfigurator.getPreprocessor() to receive an instance of a pre-processor (it keeps instances and returns it if appropriate)! Uses LPreprocessorConfigurator.getDefaultPreprocessConfigurator().


LPreprocessor

protected LPreprocessor(LaraPreprocessorConfigurator<A,BO> configuration)
Use LaraPreprocessorConfigurator.getPreprocessor() to receive an instance of a pre-processor (it keeps instances and returns it if appropriate)!

Parameters:
configuration -
Method Detail

equals

public boolean equals(Object preprocessor)
Checks for equal objects. This is valid in usual cases since then there is only one instance per configuration.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getAlteredConfiguration

public LaraPreprocessorConfigurator<A,BO> getAlteredConfiguration(LaraPreprocessorConfigurator<A,BO> changeConfiguration)
This method returns a LaraPreprocessorConfigurator that equals this instance apart from the configuration included in the given LaraPreprocessorConfigurator.

Parameters:
changeConfiguration -
Returns:

getComponentsString

public String getComponentsString()
Description copied from interface: LaraPreprocessor
Lists all preprocessor components defined in this preprocessor.

Specified by:
getComponentsString in interface LaraPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
String
See Also:
Object.toString()

meetsConfiguration

public boolean meetsConfiguration(LaraPreprocessorConfigurator<A,BO> configuration)
Checks whether this preprocessor conforms to the configuration represented by the given LaraPreprocessorConfigurator.

Specified by:
meetsConfiguration in interface LaraPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
configuration -
Returns:
true, if every component map matches the given configurator, false else and if the given configurator is not compatible

onInternalEvent

public void onInternalEvent(LaraEvent event)
Description copied from interface: LaraInternalEventSubscriber
Only for internal super classes beeing part of the LARA core. Use this in your base class to react on events, when the reaction should not be overridden by subclasses.

Specified by:
onInternalEvent in interface LaraInternalEventSubscriber
See Also:
LaraInternalEventSubscriber.onInternalEvent(de.cesr.lara.components.eventbus.events.LaraEvent)

preprocess

public void preprocess(LaraDecisionConfiguration dConfig,
                       A agent)
Specified by:
preprocess in interface LaraPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
See Also:
de.cesr.lara.components.preprocessor.LaraPreprocessor#preprocess(de.cesr.lara.components.preprocessor.LaraPreprocessor.Accuracy, de.cesr.lara.components.agents.LaraAgent)