LightJason - AgentSpeak(L++)
org.lightjason.agentspeak.beliefbase.CBeliefbase Class Reference

beliefbase to generate any event-based data by reference counting More...

+ Inheritance diagram for org.lightjason.agentspeak.beliefbase.CBeliefbase:
+ Collaboration diagram for org.lightjason.agentspeak.beliefbase.CBeliefbase:

Public Member Functions

 CBeliefbase ( @Nonnull final IStorage< ILiteral, IView > p_storage)
 ctor More...
 
final ILiteral add ( @Nonnull final ILiteral p_literal)
 adds a literal More...
 
final IView add ( @Nonnull final IView p_view)
 adds a view More...
 
final IBeliefbase clear ()
 clears all elements More...
 
final boolean containsLiteral ( @Nonnull final String p_key)
 contains a multi-element More...
 
final boolean containsView ( @Nonnull final String p_key)
 contains a single-element More...
 
final boolean empty ()
 checks if the structure empty More...
 
final boolean equals (final Object p_object)
 
final int hashCode ()
 
final Collection< ILiteralliteral ( @Nonnull final String p_key)
 returns a literal by the name More...
 
final IView remove ( @Nonnull final IView p_view)
 removes a view More...
 
final ILiteral remove ( @Nonnull final ILiteral p_literal)
 removes a literal More...
 
final int size ()
 returns the size of literals More...
 
final Stream< ILiteralstreamLiteral ()
 returns a stream over all literals More...
 
final Stream< IViewstreamView ()
 returns a stream over all views More...
 
final String toString ()
 
final Stream< ITriggertrigger ( @Nonnull final IView p_view)
 returns all trigger of the beliefbase More...
 
final IAgent<?> update ( @Nonnull final IAgent<?> p_agent)
 updates all items More...
 
final IView view ( @Nonnull final String p_key)
 returns a view element More...
 
final IView viewOrDefault ( @Nonnull final String p_key, @Nullable final IView p_default)
 returns a view element More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.beliefbase.IBaseBeliefbase
ILiteral add ( @Nonnull final ILiteral p_literal)
 adds a literal More...
 
final IView create ( @Nonnull final String p_name)
 returns a new view of the belief base More...
 
final IView create ( @Nonnull final String p_name, final IView p_parent)
 
ILiteral remove ( @Nonnull final ILiteral p_literal)
 removes a literal More...
 
Stream< ITriggertrigger ( @Nonnull final IView p_view)
 returns all trigger of the beliefbase More...
 
IAgent<?> update ( @Nonnull final IAgent<?> p_agent)
 updates all items More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.beliefbase.IBeliefbase
IView create ( @Nonnull final String p_name, @Nullable final IView p_parent)
 returns a new view of the belief base More...
 

Private Attributes

final IStorage< ILiteral, IViewm_storage
 storage with data More...
 

Additional Inherited Members

- Public Attributes inherited from org.lightjason.agentspeak.beliefbase.IBeliefbase
IBeliefbase EMPY
 empty beliefbase More...
 
- Protected Member Functions inherited from org.lightjason.agentspeak.beliefbase.IBaseBeliefbase
final Stream< ITriggercleartrigger (final IView p_view)
 copy of all trigger values More...
 
ILiteral event (final ITrigger.EType p_event, final ILiteral p_literal)
 push an event and literal to the event map More...
 
IView eventreference (final IView p_view)
 adds a view to the event referencing structure More...
 
final IView internalremove (final IView p_view)
 removes the interal view references More...
 

Detailed Description

Definition at line 41 of file CBeliefbase.java.

Constructor & Destructor Documentation

◆ CBeliefbase()

org.lightjason.agentspeak.beliefbase.CBeliefbase.CBeliefbase ( @Nonnull final IStorage< ILiteral, IView p_storage)
Parameters
p_storagestorage

Definition at line 53 of file CBeliefbase.java.

Member Function Documentation

◆ add() [1/2]

final ILiteral org.lightjason.agentspeak.beliefbase.CBeliefbase.add ( @Nonnull final ILiteral  p_literal)
Parameters
p_literalliteral without path
Returns
beliefbase reference

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 72 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.putMultiElement().

+ Here is the call graph for this function:

◆ add() [2/2]

final IView org.lightjason.agentspeak.beliefbase.CBeliefbase.add ( @Nonnull final IView  p_view)
Parameters
p_viewview
Returns
beliefbase reference

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 81 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.putSingleElement().

+ Here is the call graph for this function:

◆ clear()

◆ containsLiteral()

final boolean org.lightjason.agentspeak.beliefbase.CBeliefbase.containsLiteral ( @Nonnull final String  p_key)
Parameters
p_keykey
Returns
boolean existing flag

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 105 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.containsMultiElement().

+ Here is the call graph for this function:

◆ containsView()

final boolean org.lightjason.agentspeak.beliefbase.CBeliefbase.containsView ( @Nonnull final String  p_key)
Parameters
p_keykey
Returns
boolean existing flag

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 111 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.containsSingleElement().

+ Here is the call graph for this function:

◆ empty()

final boolean org.lightjason.agentspeak.beliefbase.CBeliefbase.empty ( )
Returns
empty boolean

Implements org.lightjason.agentspeak.beliefbase.IStructure.

Definition at line 163 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.empty().

+ Here is the call graph for this function:

◆ equals()

final boolean org.lightjason.agentspeak.beliefbase.CBeliefbase.equals ( final Object  p_object)

Definition at line 65 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.CBeliefbase.hashCode().

+ Here is the call graph for this function:

◆ hashCode()

final int org.lightjason.agentspeak.beliefbase.CBeliefbase.hashCode ( )

Definition at line 59 of file CBeliefbase.java.

Referenced by org.lightjason.agentspeak.beliefbase.CBeliefbase.equals().

+ Here is the caller graph for this function:

◆ literal()

final Collection<ILiteral> org.lightjason.agentspeak.beliefbase.CBeliefbase.literal ( @Nonnull final String  p_key)
Parameters
p_keyname of the literal
Returns
collection of pairs with negated and literal

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 132 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.getMultiElement().

+ Here is the call graph for this function:

◆ remove() [1/2]

final IView org.lightjason.agentspeak.beliefbase.CBeliefbase.remove ( @Nonnull final IView  p_view)
Parameters
p_viewview
Returns
beliefbase reference

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 89 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.IBaseBeliefbase.internalremove(), and org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.removeSingleElement().

+ Here is the call graph for this function:

◆ remove() [2/2]

final ILiteral org.lightjason.agentspeak.beliefbase.CBeliefbase.remove ( @Nonnull final ILiteral  p_literal)
Parameters
p_literalwithout path
Returns
beliefbase reference

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 97 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.removeMultiElement().

+ Here is the call graph for this function:

◆ size()

final int org.lightjason.agentspeak.beliefbase.CBeliefbase.size ( )
Returns
size

Implements org.lightjason.agentspeak.beliefbase.IStructure.

Definition at line 169 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.IStructure.size(), org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.size(), and org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.streamSingleElements().

+ Here is the call graph for this function:

◆ streamLiteral()

final Stream<ILiteral> org.lightjason.agentspeak.beliefbase.CBeliefbase.streamLiteral ( )
Returns
literal stream

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 186 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.streamMultiElements().

+ Here is the call graph for this function:

◆ streamView()

final Stream<IView> org.lightjason.agentspeak.beliefbase.CBeliefbase.streamView ( )
Returns
view stream

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 193 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.streamSingleElements().

+ Here is the call graph for this function:

◆ toString()

final String org.lightjason.agentspeak.beliefbase.CBeliefbase.toString ( )

Definition at line 199 of file CBeliefbase.java.

◆ trigger()

final Stream<ITrigger> org.lightjason.agentspeak.beliefbase.CBeliefbase.trigger ( @Nonnull final IView  p_view)
Parameters
p_viewmask for events
Returns
set with trigger events

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 176 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.streamSingleElements(), and org.lightjason.agentspeak.beliefbase.view.IView.trigger().

+ Here is the call graph for this function:

◆ update()

final IAgent<?> org.lightjason.agentspeak.beliefbase.CBeliefbase.update ( @Nonnull final IAgent<?>  p_agent)
Parameters
p_agentagent which runs the update call
Returns
agent
Warning
call update on a storage and on all storage-view, if exists different views which are point to the same storage, the update is called more than once, so the storage must limit the number of update calls

Implements org.lightjason.agentspeak.beliefbase.IStructure.

Definition at line 139 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.streamSingleElements(), and org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.update().

+ Here is the call graph for this function:

◆ view()

final IView org.lightjason.agentspeak.beliefbase.CBeliefbase.view ( @Nonnull final String  p_key)
Parameters
p_keyname of the view
Returns
view or null

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 118 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.getSingleElement().

+ Here is the call graph for this function:

◆ viewOrDefault()

final IView org.lightjason.agentspeak.beliefbase.CBeliefbase.viewOrDefault ( @Nonnull final String  p_key,
@Nullable final IView  p_default 
)
Parameters
p_keyname of the view
p_defaultview
Returns
view or default element

Implements org.lightjason.agentspeak.beliefbase.IBeliefbase.

Definition at line 125 of file CBeliefbase.java.

References org.lightjason.agentspeak.beliefbase.storage.IStorage< N, M >.getSingleElementOrDefault().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_storage

final IStorage<ILiteral, IView> org.lightjason.agentspeak.beliefbase.CBeliefbase.m_storage
private

Definition at line 46 of file CBeliefbase.java.