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

view which can use a map of maps to represent the hierarchical beliefbase structure More...

+ Inheritance diagram for org.lightjason.agentspeak.beliefbase.view.CViewMap:
+ Collaboration diagram for org.lightjason.agentspeak.beliefbase.view.CViewMap:

Classes

class  CWrapperBeliefbase
 wrapper beliefbase More...
 

Public Member Functions

 CViewMap ( @Nonnull final String p_name, @Nonnull final Map< String, Object > p_map)
 ctor More...
 
 CViewMap ( @Nonnull final String p_name, @Nonnull final Map< String, Object > p_map, @Nullable final IView p_parent)
 ctor More...
 
 CViewMap ( @Nonnull final String p_name, @Nonnull final Map< String, Object > p_map, @Nullable final IView p_parent, @Nonnull final BiConsumer< String, Map< String, Object >> p_addviewconsumer, @Nonnull final BiConsumer< Pair< String, Stream< ITerm >>, Map< String, Object >> p_addliteralconsumer, @Nonnull final BiConsumer< String, Map< String, Object >> p_removeviewconsumer, @Nonnull final BiConsumer< String, Map< String, Object >> p_removeliteralconsumer, @Nonnull final Consumer< Map< String, Object >> p_clearconsumer, @Nonnull final Function< String, String > p_literaltokey, @Nonnull final Function< String, String > p_keytoliteral)
 ctor More...
 
final IView add ( @Nonnull final Stream< ILiteral > p_literal)
 adds a literal in the current structure More...
 
final IView add ( @Nonnull final ILiteral... p_literal)
 adds a literal in the current structure More...
 
final IView add ( @Nonnull final IView... p_view)
 adds view in the current structure More...
 
final IBeliefbase beliefbase ()
 returns the beliefbase More...
 
final IView clear ( @Nullable final IPath... p_path)
 clears all elements More...
 
boolean containsLiteral ( @Nonnull final IPath p_path)
 checks if a literal exists More...
 
final boolean containsView ( @Nonnull final IPath p_path)
 view existing check More...
 
final boolean empty ()
 checks if the structure empty More...
 
IView generate ( @Nonnull final IViewGenerator p_generator, @Nonnull final IPath... p_paths)
 generates path structure More...
 
final boolean hasParent ()
 check if the view has got a parent More...
 
final String name ()
 returns only the element name More...
 
final IView parent ()
 returns the parent of the view More...
 
final IPath path ()
 returns the full path More...
 
IView remove ( @Nonnull final Stream< ILiteral > p_literal)
 removes a literal in the current structure More...
 
IView remove ( @Nonnull final ILiteral... p_literal)
 removes a literal in the current structure More...
 
final IView remove ( @Nonnull final IView... p_view)
 removes a view in the current structure More...
 
final Stream< IViewroot ()
 returns a stream to the root node, More...
 
final int size ()
 returns the size of literals More...
 
final Stream< ILiteralstream ( @Nullable final IPath... p_path)
 returns stream of literal More...
 
final Stream< ILiteralstream (final boolean p_negated, @Nullable final IPath... p_path)
 returns stream of literal More...
 
final Stream< ITriggertrigger ()
 retruns all trigger of the beliefbase More...
 
final IAgent<?> update ( @Nonnull final IAgent<?> p_agent)
 updates all items More...
 
final Stream< IViewwalk ( @Nonnull final IPath p_path, @Nullable final IViewGenerator... p_generator)
 streams path walking More...
 

Private Member Functions

IView leafview ( @Nonnull final Stream< IView > p_stream)
 returns the leaf of a view path More...
 
Stream< IViewwalkdown (final IPath p_path, @Nullable final IViewGenerator... p_generator)
 

Private Attributes

final BiConsumer< Pair< String, Stream< ITerm > >, Map< String, Object > > m_addliteralconsumer
 add-literal consumer More...
 
final BiConsumer< String, Map< String, Object > > m_addviewconsumer
 add-view consumer More...
 
final IBeliefbase m_beliefbase = new CWrapperBeliefbase()
 beliefbase More...
 
final Consumer< Map< String, Object > > m_clearconsumer
 clear consumer More...
 
final Map< String, Object > m_data
 root map More...
 
final Function< String, String > m_keytoliteral
 key to literal converting More...
 
final Function< String, String > m_literaltokey
 path to key converting More...
 
final String m_name
 view name More...
 
final IView m_parent
 parent name More...
 
final BiConsumer< String, Map< String, Object > > m_removeliteralconsumer
 remove-literal consumer More...
 
final BiConsumer< String, Map< String, Object > > m_removeviewconsumer
 remove-view consumer More...
 

Additional Inherited Members

- Public Attributes inherited from org.lightjason.agentspeak.beliefbase.view.IView
IView EMPTY
 empty view More...
 

Detailed Description

Note
given map should be thread-safe

Definition at line 60 of file CViewMap.java.

Constructor & Destructor Documentation

◆ CViewMap() [1/3]

org.lightjason.agentspeak.beliefbase.view.CViewMap.CViewMap ( @Nonnull final String  p_name,
@Nonnull final Map< String, Object >  p_map 
)
Parameters
p_namename of the view
p_mapmap reference

Definition at line 113 of file CViewMap.java.

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.CWrapperBeliefbase.size(), org.lightjason.agentspeak.beliefbase.view.CViewMap.CWrapperBeliefbase.streamView(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.walkdown().

+ Here is the caller graph for this function:

◆ CViewMap() [2/3]

org.lightjason.agentspeak.beliefbase.view.CViewMap.CViewMap ( @Nonnull final String  p_name,
@Nonnull final Map< String, Object >  p_map,
@Nullable final IView  p_parent 
)
Parameters
p_nameview name
p_mapmap reference
p_parentparent view

Definition at line 125 of file CViewMap.java.

References org.lightjason.agentspeak.language.ITerm.raw().

+ Here is the call graph for this function:

◆ CViewMap() [3/3]

org.lightjason.agentspeak.beliefbase.view.CViewMap.CViewMap ( @Nonnull final String  p_name,
@Nonnull final Map< String, Object >  p_map,
@Nullable final IView  p_parent,
@Nonnull final BiConsumer< String, Map< String, Object >>  p_addviewconsumer,
@Nonnull final BiConsumer< Pair< String, Stream< ITerm >>, Map< String, Object >>  p_addliteralconsumer,
@Nonnull final BiConsumer< String, Map< String, Object >>  p_removeviewconsumer,
@Nonnull final BiConsumer< String, Map< String, Object >>  p_removeliteralconsumer,
@Nonnull final Consumer< Map< String, Object >>  p_clearconsumer,
@Nonnull final Function< String, String >  p_literaltokey,
@Nonnull final Function< String, String >  p_keytoliteral 
)
Parameters
p_nameview name
p_mapmap reference
p_parentparent view
p_addviewconsumeradd-view consumer
p_addliteralconsumeradd-literal consumer
p_removeviewconsumerremove-view consumer
p_removeliteralconsumerremove-view consumer
p_clearconsumerclear consumer
p_literaltokeyconverts a path ( functor item to a map key
p_keytoliteralconverts a map key to literal path

Definition at line 167 of file CViewMap.java.

Member Function Documentation

◆ add() [1/3]

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.add ( @Nonnull final Stream< ILiteral p_literal)
Parameters
p_literalliteral stream
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 287 of file CViewMap.java.

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.add().

+ Here is the caller graph for this function:

◆ add() [2/3]

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.add ( @Nonnull final ILiteral...  p_literal)
Parameters
p_literalliteral
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 295 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.add().

+ Here is the call graph for this function:

◆ add() [3/3]

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.add ( @Nonnull final IView...  p_view)
Parameters
p_viewexisting view
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 303 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.IView.stream().

+ Here is the call graph for this function:

◆ beliefbase()

final IBeliefbase org.lightjason.agentspeak.beliefbase.view.CViewMap.beliefbase ( )

◆ clear()

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.clear ( @Nullable final IPath...  p_path)
Parameters
p_pathpath values
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 275 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.m_clearconsumer, org.lightjason.agentspeak.beliefbase.view.CViewMap.m_data, and org.lightjason.agentspeak.beliefbase.view.CViewMap.walkdown().

+ Here is the call graph for this function:

◆ containsLiteral()

boolean org.lightjason.agentspeak.beliefbase.view.CViewMap.containsLiteral ( @Nonnull final IPath  p_path)
Parameters
p_pathpath to a literal (suffix is literal name)
Returns
existance boolean

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 336 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.IBeliefbase.containsLiteral(), org.lightjason.agentspeak.beliefbase.view.CViewMap.leafview(), org.lightjason.agentspeak.beliefbase.view.CViewMap.m_beliefbase, and org.lightjason.agentspeak.beliefbase.view.CViewMap.walk().

+ Here is the call graph for this function:

◆ containsView()

final boolean org.lightjason.agentspeak.beliefbase.view.CViewMap.containsView ( @Nonnull final IPath  p_path)
Parameters
p_pathpath to a view
Returns
existance boolean

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 348 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.IBeliefbase.containsView(), org.lightjason.agentspeak.beliefbase.view.CViewMap.leafview(), org.lightjason.agentspeak.beliefbase.view.CViewMap.m_beliefbase, and org.lightjason.agentspeak.beliefbase.view.CViewMap.walk().

+ Here is the call graph for this function:

◆ empty()

final boolean org.lightjason.agentspeak.beliefbase.view.CViewMap.empty ( )
Returns
empty boolean

Implements org.lightjason.agentspeak.beliefbase.IStructure.

Definition at line 359 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.IStructure.empty(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.m_beliefbase.

+ Here is the call graph for this function:

◆ generate()

IView org.lightjason.agentspeak.beliefbase.view.CViewMap.generate ( @Nonnull final IViewGenerator  p_generator,
@Nonnull final IPath...  p_paths 
)
Parameters
p_generatorgenerator for views
p_pathspaths items
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 197 of file CViewMap.java.

◆ hasParent()

final boolean org.lightjason.agentspeak.beliefbase.view.CViewMap.hasParent ( )
Returns
boolean flag of the parent

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 240 of file CViewMap.java.

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.root().

+ Here is the caller graph for this function:

◆ leafview()

IView org.lightjason.agentspeak.beliefbase.view.CViewMap.leafview ( @Nonnull final Stream< IView p_stream)
private
Parameters
p_streamstream of views
Returns
last / leaf view

Definition at line 384 of file CViewMap.java.

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.containsLiteral(), org.lightjason.agentspeak.beliefbase.view.CViewMap.containsView(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.stream().

+ Here is the caller graph for this function:

◆ name()

final String org.lightjason.agentspeak.beliefbase.view.CViewMap.name ( )

◆ parent()

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.parent ( )
Returns
parent object or null

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 234 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.m_parent.

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.root().

+ Here is the caller graph for this function:

◆ path()

final IPath org.lightjason.agentspeak.beliefbase.view.CViewMap.path ( )
Returns
path
Note
the path is relative to the root node, exclusive root element

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 220 of file CViewMap.java.

References org.lightjason.agentspeak.common.CPath.collect(), org.lightjason.agentspeak.beliefbase.view.IView.name(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.root().

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.stream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove() [1/3]

IView org.lightjason.agentspeak.beliefbase.view.CViewMap.remove ( @Nonnull final Stream< ILiteral p_literal)
Parameters
p_literalliteral stream
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 311 of file CViewMap.java.

◆ remove() [2/3]

IView org.lightjason.agentspeak.beliefbase.view.CViewMap.remove ( @Nonnull final ILiteral...  p_literal)
Parameters
p_literalliteral
Returns
self reference

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 320 of file CViewMap.java.

◆ remove() [3/3]

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

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 328 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.IView.stream().

+ Here is the call graph for this function:

◆ root()

final Stream<IView> org.lightjason.agentspeak.beliefbase.view.CViewMap.root ( )
Returns
stream of views
Note
the stream is exclusive of the root node and starts with the current node

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 204 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.hasParent(), org.lightjason.agentspeak.beliefbase.view.CViewMap.parent(), and org.lightjason.agentspeak.beliefbase.view.IView.root().

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.path().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

final int org.lightjason.agentspeak.beliefbase.view.CViewMap.size ( )
Returns
size

Implements org.lightjason.agentspeak.beliefbase.IStructure.

Definition at line 365 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.m_beliefbase, and org.lightjason.agentspeak.beliefbase.IStructure.size().

+ Here is the call graph for this function:

◆ stream() [1/2]

final Stream<ILiteral> org.lightjason.agentspeak.beliefbase.view.CViewMap.stream ( @Nullable final IPath...  p_path)
Parameters
p_pathpaths of the literals
Returns
literal stream

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 255 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.IView.beliefbase(), org.lightjason.agentspeak.beliefbase.view.CViewMap.leafview(), org.lightjason.agentspeak.beliefbase.IBeliefbase.literal(), org.lightjason.agentspeak.beliefbase.view.CViewMap.path(), org.lightjason.agentspeak.beliefbase.IBeliefbase.streamLiteral(), org.lightjason.agentspeak.beliefbase.IBeliefbase.streamView(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.walk().

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.stream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream() [2/2]

final Stream<ILiteral> org.lightjason.agentspeak.beliefbase.view.CViewMap.stream ( final boolean  p_negated,
@Nullable final IPath...  p_path 
)
Parameters
p_negatednegated flag
p_pathpaths of the literals
Returns
literal stream

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 268 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.stream().

+ Here is the call graph for this function:

◆ trigger()

final Stream<ITrigger> org.lightjason.agentspeak.beliefbase.view.CViewMap.trigger ( )
Returns
set with trigger events

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 247 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.IBeliefbase.trigger().

+ Here is the call graph for this function:

◆ update()

final IAgent<?> org.lightjason.agentspeak.beliefbase.view.CViewMap.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 372 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.m_beliefbase, and org.lightjason.agentspeak.beliefbase.IStructure.update().

+ Here is the call graph for this function:

◆ walk()

final Stream<IView> org.lightjason.agentspeak.beliefbase.view.CViewMap.walk ( @Nonnull final IPath  p_path,
@Nullable final IViewGenerator...  p_generator 
)
Parameters
p_pathpath
p_generatorgenerator for view creating (first argument is used, orther elements will be ignored)
Returns
stream of views

Implements org.lightjason.agentspeak.beliefbase.view.IView.

Definition at line 190 of file CViewMap.java.

References org.lightjason.agentspeak.beliefbase.view.CViewMap.walkdown().

Referenced by org.lightjason.agentspeak.beliefbase.view.CViewMap.containsLiteral(), org.lightjason.agentspeak.beliefbase.view.CViewMap.containsView(), and org.lightjason.agentspeak.beliefbase.view.CViewMap.stream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ walkdown()

Stream<IView> org.lightjason.agentspeak.beliefbase.view.CViewMap.walkdown ( final IPath  p_path,
@Nullable final IViewGenerator...  p_generator 
)
private

Member Data Documentation

◆ m_addliteralconsumer

final BiConsumer<Pair<String, Stream<ITerm> >, Map<String, Object> > org.lightjason.agentspeak.beliefbase.view.CViewMap.m_addliteralconsumer
private

◆ m_addviewconsumer

final BiConsumer<String, Map<String, Object> > org.lightjason.agentspeak.beliefbase.view.CViewMap.m_addviewconsumer
private

◆ m_beliefbase

◆ m_clearconsumer

final Consumer<Map<String, Object> > org.lightjason.agentspeak.beliefbase.view.CViewMap.m_clearconsumer
private

◆ m_data

◆ m_keytoliteral

◆ m_literaltokey

◆ m_name

final String org.lightjason.agentspeak.beliefbase.view.CViewMap.m_name
private

◆ m_parent

final IView org.lightjason.agentspeak.beliefbase.view.CViewMap.m_parent
private

◆ m_removeliteralconsumer

final BiConsumer<String, Map<String, Object> > org.lightjason.agentspeak.beliefbase.view.CViewMap.m_removeliteralconsumer
private

◆ m_removeviewconsumer

final BiConsumer<String, Map<String, Object> > org.lightjason.agentspeak.beliefbase.view.CViewMap.m_removeviewconsumer
private