de.cesr.lara.components.decision.impl
Class LHabitDeciderFactory<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
java.lang.Object
de.cesr.lara.components.decision.impl.LHabitDeciderFactory<A,BO>
- Type Parameters:
A
- type of agentBO
- type of behavioural option
- All Implemented Interfaces:
- LaraDeciderFactory<A,BO>
public class LHabitDeciderFactory<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
- extends Object
- implements LaraDeciderFactory<A,BO>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getFactory
public static <A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>> LaraDeciderFactory<A,BO> getFactory(Class<A> clazz)
- The problem: in java, non-static class AgentT (parameter) cannot be
referenced from a static context, since there is only one class per class
no matter how many parameters it has. On the other hand, for a singleton
one needs to assure that it returns an instance of the requested
parameter. In order to prevent from instancing a map of
parameter-to-instance pairs we check if the current instance's parameter
is valid by comparing the class object and create a new instance if not.
In case of many agent classes the map approach might be more efficient.
For few agent classes it is unproblematic as long as agents of a certain
class are executed in line and different agent classes are not mixed to
often.
- Type Parameters:
A
- BO
- - Parameters:
clazz
-
- Returns:
- an instance of this factory
getDecider
public LaraDecider<BO> getDecider(A agent,
LaraDecisionConfiguration dConfiguration)
- Specified by:
getDecider
in interface LaraDeciderFactory<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
- Returns:
- the valid
LaraDecider
- See Also:
LaraDeciderFactory.getDecider(de.cesr.lara.components.agents.LaraAgent,
de.cesr.lara.components.decision.LaraDecisionConfiguration)