LightJason - AgentSpeak(L++)
IView.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.view;
25 
32 
33 import javax.annotation.Nonnull;
34 import javax.annotation.Nullable;
35 import java.util.stream.Stream;
36 
37 
44 public interface IView extends IStructure
45 {
49  IView EMPTY = new IView()
50  {
51  @Nonnull
52  @Override
53  @SafeVarargs
54  @SuppressWarnings( "varargs" )
55  public final Stream<IView> walk( @Nonnull final IPath p_path, @Nullable final IViewGenerator... p_generator )
56  {
57  return Stream.empty();
58  }
59 
60  @Nonnull
61  @Override
62  public final IView generate( @Nonnull final IViewGenerator p_generator, @Nonnull final IPath... p_paths )
63  {
64  return this;
65  }
66 
67  @Nonnull
68  @Override
69  public final Stream<IView> root()
70  {
71  return Stream.empty();
72  }
73 
74  @Nonnull
75  @Override
76  public final IBeliefbase beliefbase()
77  {
78  return IBeliefbase.EMPY;
79  }
80 
81  @Nonnull
82  @Override
83  public final IPath path()
84  {
85  return IPath.EMPTY;
86  }
87 
88  @Nonnull
89  @Override
90  public final String name()
91  {
92  return "";
93  }
94 
95  @Nullable
96  @Override
97  public final IView parent()
98  {
99  return null;
100  }
101 
102  @Override
103  public final boolean hasParent()
104  {
105  return false;
106  }
107 
108  @Nonnull
109  @Override
110  public final Stream<ITrigger> trigger()
111  {
112  return Stream.empty();
113  }
114 
115  @Nonnull
116  @Override
117  public final Stream<ILiteral> stream( @Nullable final IPath... p_path )
118  {
119  return Stream.empty();
120  }
121 
122  @Nonnull
123  @Override
124  public final Stream<ILiteral> stream( final boolean p_negated, @Nullable final IPath... p_path )
125  {
126  return Stream.empty();
127  }
128 
129  @Nonnull
130  @Override
131  public final IView clear( @Nullable final IPath... p_path )
132  {
133  return this;
134  }
135 
136  @Nonnull
137  @Override
138  public final IView add( @Nonnull final Stream<ILiteral> p_literal )
139  {
140  return this;
141  }
142 
143  @Nonnull
144  @Override
145  @SuppressWarnings( "varargs" )
146  public final IView add( @Nonnull final IView... p_view )
147  {
148  return this;
149  }
150 
151  @Nonnull
152  @Override
153  public final IView add( @Nonnull final ILiteral... p_literal )
154  {
155  return this;
156  }
157 
158  @Nonnull
159  @Override
160  public final IView remove( @Nonnull final Stream<ILiteral> p_literal )
161  {
162  return this;
163  }
164 
165  @Nonnull
166  @Override
167  public final IView remove( @Nonnull final ILiteral... p_literal )
168  {
169  return this;
170  }
171 
172  @Nonnull
173  @Override
174  public final IView remove( @Nonnull final IView... p_view )
175  {
176  return this;
177  }
178 
179  @Override
180  public final boolean containsLiteral( @Nonnull final IPath p_path )
181  {
182  return false;
183  }
184 
185  @Override
186  public final boolean containsView( @Nonnull final IPath p_path )
187  {
188  return false;
189  }
190 
191  @Override
192  public final boolean empty()
193  {
194  return false;
195  }
196 
197  @Override
198  public final int size()
199  {
200  return 0;
201  }
202 
203  @Nonnull
204  @Override
205  public final IAgent<?> update( @Nonnull final IAgent<?> p_agent )
206  {
207  return p_agent;
208  }
209 
210  };
211 
212 
220  @Nonnull
221  @SuppressWarnings( "unchecked" )
222  Stream<IView> walk( @Nonnull final IPath p_path, @Nullable final IViewGenerator... p_generator );
223 
231  @Nonnull
232  IView generate( @Nonnull final IViewGenerator p_generator, @Nonnull final IPath... p_paths );
233 
241  @Nonnull
242  Stream<IView> root();
243 
249  @Nonnull
251 
259  @Nonnull
260  IPath path();
261 
267  @Nonnull
268  String name();
269 
275  @Nullable
276  IView parent();
277 
283  boolean hasParent();
284 
285 
286 
292  @Nonnull
293  Stream<ITrigger> trigger();
294 
295 
296 
303  @Nonnull
304  Stream<ILiteral> stream( @Nullable final IPath... p_path );
305 
313  @Nonnull
314  Stream<ILiteral> stream( final boolean p_negated, @Nullable final IPath... p_path );
315 
316 
317 
324  @Nonnull
325  IView clear( @Nullable final IPath... p_path );
326 
327 
328 
335  @Nonnull
336  IView add( @Nonnull final ILiteral... p_literal );
337 
344  @Nonnull
345  IView add( @Nonnull final Stream<ILiteral> p_literal );
346 
353  @Nonnull
354  @SuppressWarnings( "unchecked" )
355  IView add( @Nonnull final IView... p_view );
356 
363  @Nonnull
364  IView remove( @Nonnull final Stream<ILiteral> p_literal );
365 
372  @Nonnull
373  IView remove( @Nonnull final ILiteral... p_literal );
374 
381  @Nonnull
382  @SuppressWarnings( "unchecked" )
383  IView remove( @Nonnull final IView... p_view );
384 
385 
386 
393  boolean containsLiteral( @Nonnull final IPath p_path );
394 
401  boolean containsView( @Nonnull final IPath p_path );
402 
403 }
boolean containsView( @Nonnull final IPath p_path)
view existing check
Stream< ITrigger > trigger()
retruns all trigger of the beliefbase
IAgent<?> update( @Nonnull final IAgent<?> p_agent)
updates all items
Stream< ILiteral > stream( @Nullable final IPath... p_path)
returns stream of literal
boolean empty()
checks if the structure empty
IBeliefbase beliefbase()
returns the beliefbase
view for a beliefbase that creates any access to the underlying data structures
Definition: IView.java:44
interface of beliefbase definition, that create the trigger events for the agent
String name()
returns only the element name
boolean hasParent()
check if the view has got a parent
Stream< IView > root()
returns a stream to the root node,
IView generate( @Nonnull final IViewGenerator p_generator, @Nonnull final IPath... p_paths)
generates path structure
interface for generating non-existing beliefbases views
IView parent()
returns the parent of the view
interface for equal method on views and beliefbases
Definition: IStructure.java:36
Stream< IView > walk( @Nonnull final IPath p_path, @Nullable final IViewGenerator... p_generator)
streams path walking
int size()
returns the size of literals
IView add( @Nonnull final ILiteral... p_literal)
adds a literal in the current structure
boolean containsLiteral( @Nonnull final IPath p_path)
checks if a literal exists
IView clear( @Nullable final IPath... p_path)
clears all elements