Interface Blackboard
-
- All Implemented Interfaces:
-
com.embabel.agent.core.Bindable,com.embabel.agent.core.MayHaveLastResult,com.embabel.common.core.types.HasInfoString
public interface Blackboard implements Bindable, MayHaveLastResult, HasInfoString
A Blackboard is how an AgentProcess maintains context. Blackboard operations are threadsafe. Blackboards are immutable in the sense that once an object has been added it cannot be removed. However, objects can be hidden so they are no longer visible to retrieval operations (e.g. driving planning).
-
-
Method Summary
Modifier and Type Method Description abstract Objectget(String name)Return the value of a variable, if it is set by name. abstract Unithide(Object what)Hide this object. abstract <V extends Any> VgetOrPut(String name, Function0<V> creator)Threadsafe get or put BooleanhasValue(String variable, String type, DataDictionary dataDictionary)Indicates whether this blackboard contains a variable. ObjectgetValue(String variable, String type, DataDictionary dataDictionary)Resolve the value of a variable, if it is set. <T extends Any> Integercount(Class<T> clazz)<T extends Any> Tlast(Class<T> clazz)Last entry of the given type, if there is one <T extends Any> List<T>objectsOfType(Class<T> clazz)Return all objects of the given type abstract Blackboardspawn()Spawn an independent child blackboard based on the content of this abstract BlackboardsetCondition(String key, Boolean value)Explicitly set the condition value Used in planning. abstract BooleangetCondition(String key)ObjectlastResult()Last result, of any type, if there is one. abstract Map<String, Object>expressionEvaluationModel()Expose the model data for use in prompts Prefer more strongly typed usage patterns abstract Unitclear()Clear all entries from the blackboard. abstract StringgetBlackboardId()Unique identifier of this blackboard. abstract List<Object>getObjects()Entries in the order they were added. -
Methods inherited from class com.embabel.agent.core.Bindable
addAll, addObject, bind, bindAll, bindProtected, plusAssign, plusAssign, plusAssign, set -
Methods inherited from class com.embabel.common.core.types.HasInfoString
infoString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
get
abstract Object get(String name)
Return the value of a variable, if it is set by name. Does not limit return via type information.
-
hide
abstract Unit hide(Object what)
Hide this object. Does not remove it from the blackboard but will prevent it being retrieved.
-
getOrPut
abstract <V extends Any> V getOrPut(String name, Function0<V> creator)
Threadsafe get or put
-
hasValue
Boolean hasValue(String variable, String type, DataDictionary dataDictionary)
Indicates whether this blackboard contains a variable.
-
getValue
Object getValue(String variable, String type, DataDictionary dataDictionary)
Resolve the value of a variable, if it is set. Resolve superclasses For example, getValue("it", "Animal") will match a Dog if Dog extends Animal
-
objectsOfType
<T extends Any> List<T> objectsOfType(Class<T> clazz)
Return all objects of the given type
-
spawn
abstract Blackboard spawn()
Spawn an independent child blackboard based on the content of this
-
setCondition
abstract Blackboard setCondition(String key, Boolean value)
Explicitly set the condition value Used in planning.
-
getCondition
abstract Boolean getCondition(String key)
-
lastResult
Object lastResult()
Last result, of any type, if there is one.
-
expressionEvaluationModel
abstract Map<String, Object> expressionEvaluationModel()
Expose the model data for use in prompts Prefer more strongly typed usage patterns
-
clear
@ApiStatus.Internal() abstract Unit clear()
Clear all entries from the blackboard. Not intended for use in user code.
-
getBlackboardId
abstract String getBlackboardId()
Unique identifier of this blackboard. Blackboard doesn't extend StableIdentified to avoid conflict with implementations that are otherwise identified
-
getObjects
abstract 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.
-
-
-
-