Class InMemoryBlackboard
-
- All Implemented Interfaces:
-
com.embabel.agent.core.Bindable,com.embabel.agent.core.Blackboard,com.embabel.agent.core.MayHaveLastResult,com.embabel.common.core.types.HasInfoString
public final class InMemoryBlackboard implements Blackboard
-
-
Field Summary
Fields Modifier and Type Field Description private final List<Object>objectsprivate final StringblackboardId
-
Constructor Summary
Constructors Constructor Description InMemoryBlackboard(String blackboardId)
-
Method Summary
Modifier and Type Method Description List<Object>getObjects()Entries in the order they were added. StringgetBlackboardId()Unique identifier of this blackboard. Blackboardspawn()Spawn an independent child blackboard based on the content of this Unithide(Object what)Hide this object. final BooleanisHidden(Object what)Objectget(String name)Return the value of a variable, if it is set by name. Blackboardbind(String key, Object value)UnitplusAssign(Object value)UnitplusAssign(Pair<String, Object> pair)Unitset(String key, Object value)Bind a value to a name <V extends Any> VgetOrPut(String name, Function0<V> creator)Threadsafe get or put BlackboardsetCondition(String key, Boolean value)Explicitly set the condition value Used in planning. BooleangetCondition(String key)BlackboardaddObject(Object value)Add to entries without binding to a variable name. Map<String, Object>expressionEvaluationModel()Expose the model data for use in prompts Prefer more strongly typed usage patterns StringinfoString(Boolean verbose, Integer indent)-
Methods inherited from class com.embabel.agent.core.Bindable
addAll, bindAll, plusAssign -
Methods inherited from class com.embabel.agent.core.Blackboard
count, getValue, hasValue, last, lastResult, objectsOfType -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
InMemoryBlackboard
InMemoryBlackboard(String blackboardId)
-
-
Method Detail
-
getObjects
List<Object> getObjects()
Entries in the order they were added. The default instance of any type is the last one Objects are immutable and may not be removed.
-
getBlackboardId
String getBlackboardId()
Unique identifier of this blackboard. Blackboard doesn't extend StableIdentified to avoid conflict with implementations that are otherwise identified
-
spawn
Blackboard spawn()
Spawn an independent child blackboard based on the content of this
-
hide
Unit hide(Object what)
Hide this object. Does not remove it from the blackboard but will prevent it being retrieved.
-
get
Object get(String name)
Return the value of a variable, if it is set by name. Does not limit return via type information.
-
bind
Blackboard bind(String key, Object value)
-
plusAssign
Unit plusAssign(Object value)
-
plusAssign
Unit plusAssign(Pair<String, Object> pair)
-
setCondition
Blackboard setCondition(String key, Boolean value)
Explicitly set the condition value Used in planning.
-
getCondition
Boolean getCondition(String key)
-
addObject
Blackboard addObject(Object value)
Add to entries without binding to a variable name. Implementations must respect the order in which entities were added. This is equivalent to using the default binding name as the key. For example, if you add a Dog to the blackboard without a key, it will be bound to the default binding name "it" and will be the last entry in the list of objects. Equivalent:
blackboard["it"] = dog blackboard.addObject(dog)
-
expressionEvaluationModel
Map<String, Object> expressionEvaluationModel()
Expose the model data for use in prompts Prefer more strongly typed usage patterns
-
infoString
String infoString(Boolean verbose, Integer indent)
-
-
-
-