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
                        
    • 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

      • clear

         Unit clear()

        Clear all entries from the blackboard. Not intended for use in user code.

      • 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.

      • bindProtected

         Blackboard bindProtected(String key, Object value)

        Bind a value to a name and mark it as protected. Protected bindings survive Blackboard.clear operations, which occur during state transitions. Use this for bindings that should persist across states, such as conversation history and user identity.

      • getOrPut

         <V extends Any> V getOrPut(String name, Function0<V> creator)

        Threadsafe get or put

      • 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)