LightJason - AgentSpeak(L++)
IBeliefbase.java
Go to the documentation of this file.
1 /*
2  * @cond LICENSE
3  * ######################################################################################
4  * # LGPL License #
5  * # #
6  * # This file is part of the LightJason AgentSpeak(L++) #
7  * # Copyright (c) 2015-19, LightJason (info@lightjason.org) #
8  * # This program is free software: you can redistribute it and/or modify #
9  * # it under the terms of the GNU Lesser General Public License as #
10  * # published by the Free Software Foundation, either version 3 of the #
11  * # License, or (at your option) any later version. #
12  * # #
13  * # This program is distributed in the hope that it will be useful, #
14  * # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15  * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16  * # GNU Lesser General Public License for more details. #
17  * # #
18  * # You should have received a copy of the GNU Lesser General Public License #
19  * # along with this program. If not, see http://www.gnu.org/licenses/ #
20  * ######################################################################################
21  * @endcond
22  */
23 
24 package org.lightjason.agentspeak.beliefbase;
25 
30 
31 import javax.annotation.Nonnull;
32 import javax.annotation.Nullable;
33 import java.util.Collection;
34 import java.util.Collections;
35 import java.util.stream.Stream;
36 
37 
44 public interface IBeliefbase extends IStructure
45 {
50  {
51 
52  @Override
53  public final boolean empty()
54  {
55  return true;
56  }
57 
58  @Override
59  public final int size()
60  {
61  return 0;
62  }
63 
64  @Nonnull
65  @Override
66  public final IAgent<?> update( @Nonnull final IAgent<?> p_agent )
67  {
68  return p_agent;
69  }
70 
71  @Nonnull
72  @Override
73  public final Stream<ITrigger> trigger( @Nonnull final IView p_view )
74  {
75  return Stream.empty();
76  }
77 
78  @Nonnull
79  @Override
80  public final Stream<ILiteral> streamLiteral()
81  {
82  return Stream.empty();
83  }
84 
85  @Nonnull
86  @Override
87  public final Stream<IView> streamView()
88  {
89  return Stream.empty();
90  }
91 
92  @Nonnull
93  @Override
94  public final IBeliefbase clear()
95  {
96  return this;
97  }
98 
99  @Nonnull
100  @Override
101  public final ILiteral add( @Nonnull final ILiteral p_literal )
102  {
103  return p_literal;
104  }
105 
106  @Nonnull
107  @Override
108  public final IView add( @Nonnull final IView p_view )
109  {
110  return p_view;
111  }
112 
113  @Nonnull
114  @Override
115  public final ILiteral remove( @Nonnull final ILiteral p_literal )
116  {
117  return p_literal;
118  }
119 
120  @Nonnull
121  @Override
122  public final IView remove( @Nonnull final IView p_view )
123  {
124  return p_view;
125  }
126 
127  @Override
128  public final boolean containsLiteral( @Nonnull final String p_key )
129  {
130  return false;
131  }
132 
133  @Override
134  public final boolean containsView( @Nonnull final String p_key )
135  {
136  return false;
137  }
138 
139  @Nullable
140  @Override
141  public final IView view( @Nonnull final String p_key )
142  {
143  return IView.EMPTY;
144  }
145 
146  @Nonnull
147  @Override
148  public final Collection<ILiteral> literal( @Nonnull final String p_key )
149  {
150  return Collections.emptySet();
151  }
152 
153  @Nullable
154  @Override
155  public final IView viewOrDefault( @Nonnull final String p_key, @Nullable final IView p_default )
156  {
157  return p_default;
158  }
159 
160  @Nonnull
161  @Override
162  public final IView create( @Nonnull final String p_name )
163  {
164  return IView.EMPTY;
165  }
166 
167  @Nonnull
168  @Override
169  public final IView create( @Nonnull final String p_name, @Nullable final IView p_parent
170  )
171  {
172  return IView.EMPTY;
173  }
174 
175  };
176 
183  @Nonnull
184  Stream<ITrigger> trigger( @Nonnull final IView p_view );
185 
186 
187 
193  @Nonnull
194  Stream<ILiteral> streamLiteral();
195 
201  @Nonnull
202  Stream<IView> streamView();
203 
204 
205 
211  @Nonnull
212  IBeliefbase clear();
213 
214 
215 
222  @Nonnull
223  ILiteral add( @Nonnull final ILiteral p_literal );
224 
231  @Nonnull
232  IView add( @Nonnull final IView p_view );
233 
234 
235 
242  @Nonnull
243  ILiteral remove( @Nonnull final ILiteral p_literal );
244 
251  @Nonnull
252  IView remove( @Nonnull final IView p_view );
253 
254 
255 
262  boolean containsLiteral( @Nonnull final String p_key );
263 
270  boolean containsView( @Nonnull final String p_key );
271 
272 
273 
280  @Nullable
281  IView view( @Nonnull final String p_key );
282 
289  @Nonnull
290  Collection<ILiteral> literal( @Nonnull final String p_key );
291 
299  @Nullable
300  IView viewOrDefault( @Nonnull final String p_key, @Nullable final IView p_default );
301 
302 
303 
310  @Nonnull
311  IView create( @Nonnull final String p_name );
312 
320  @Nonnull
321  IView create( @Nonnull final String p_name, @Nullable final IView p_parent );
322 
323 }
Stream< IView > streamView()
returns a stream over all views
IBeliefbase clear()
clears all elements
IAgent<?> update( @Nonnull final IAgent<?> p_agent)
updates all items
ILiteral add( @Nonnull final ILiteral p_literal)
adds a literal
boolean empty()
checks if the structure empty
view for a beliefbase that creates any access to the underlying data structures
Definition: IView.java:44
Stream< ITrigger > trigger( @Nonnull final IView p_view)
returns all trigger of the beliefbase
boolean containsLiteral( @Nonnull final String p_key)
contains a multi-element
IView view( @Nonnull final String p_key)
returns a view element
IView viewOrDefault( @Nonnull final String p_key, @Nullable final IView p_default)
returns a view element
interface of beliefbase definition, that create the trigger events for the agent
Collection< ILiteral > literal( @Nonnull final String p_key)
returns a literal by the name
Stream< ILiteral > streamLiteral()
returns a stream over all literals
interface for equal method on views and beliefbases
Definition: IStructure.java:36
int size()
returns the size of literals
boolean containsView( @Nonnull final String p_key)
contains a single-element
IView create( @Nonnull final String p_name)
returns a new view of the belief base