LightJason - AgentSpeak(L++)
CASTVisitorType.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.grammar;
25 
26 import com.google.common.collect.LinkedHashMultimap;
27 import com.google.common.collect.Multimap;
28 import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
60 
61 import javax.annotation.Nonnull;
62 import java.util.Collection;
63 import java.util.Collections;
64 import java.util.Map;
65 import java.util.Objects;
66 import java.util.Set;
67 import java.util.stream.Collectors;
68 
69 
73 @SuppressWarnings( {"all", "warnings", "unchecked", "unused", "cast"} )
74 public final class CASTVisitorType extends AbstractParseTreeVisitor<Object> implements IASTVisitorType
75 {
79  private final Map<IPath, IAction> m_actions;
83  private final Multimap<IPath, IRule> m_rules = LinkedHashMultimap.create();
87  private ILiteral m_literal = ILiteral.EMPTY;
91  private IExpression m_expression = IExpression.EMPTY;
95  private ITerm m_term = ITerm.EMPTY;
96 
97 
102  {
103  this( Collections.<IAction>emptySet(), Collections.<IRule>emptySet() );
104  }
105 
112  public CASTVisitorType( @Nonnull final Set<IAction> p_actions, @Nonnull final Set<IRule> p_rules )
113  {
114  m_actions = p_actions.stream().collect( Collectors.toMap( i -> i.name(), i -> i ) );
115  p_rules.stream().forEach( i -> m_rules.put( i.identifier().fqnfunctor(), i ) );
116  }
117 
118  // --- start rules -----------------------------------------------------------------------------------------------------------------------------------------
119 
120 
121  @Override
122  public final Object visitLiteral_type( final TypeParser.Literal_typeContext p_context )
123  {
124  m_literal = (ILiteral) this.visitChildren( p_context );
125  return null;
126  }
127 
128  @Override
129  public final Object visitExpression_type( final TypeParser.Expression_typeContext p_context )
130  {
131  m_expression = (IExpression) this.visitChildren( p_context );
132  return null;
133  }
134 
135  @Override
136  public final Object visitExpression_term( final TypeParser.Expression_termContext p_context )
137  {
138  m_term = (ITerm) this.visitChildren( p_context );
139  return null;
140  }
141 
142  @Override
143  public final Object visitExecutable_term( final TypeParser.Executable_termContext p_context )
144  {
145  if ( Objects.nonNull( p_context.STRING() ) )
146  return new CRawAction<>( p_context.STRING() );
147  if ( Objects.nonNull( p_context.number() ) )
148  return new CRawAction<>( this.visitNumber( p_context.number() ) );
149  if ( Objects.nonNull( p_context.LOGICALVALUE() ) )
150  return new CRawAction<>( logicalvalue( p_context.LOGICALVALUE().getText() ) );
151 
152  if ( Objects.nonNull( p_context.executable_action() ) )
153  return this.visitExecutable_action( p_context.executable_action() );
154  if ( Objects.nonNull( p_context.executable_rule() ) )
155  return this.visitExecutable_rule( p_context.executable_rule() );
156 
157  if ( Objects.nonNull( p_context.expression() ) )
158  return this.visitExpression( p_context.expression() );
159  if ( Objects.nonNull( p_context.ternary_operation() ) )
160  return this.visitTernary_operation( p_context.ternary_operation() );
161 
162  throw new CIllegalArgumentException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "termunknown", p_context.getText() ) );
163  }
164 
165  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
166 
167 
168  // --- term element rules ----------------------------------------------------------------------------------------------------------------------------------
169 
170  @Override
171  public final Object visitUnification( final TypeParser.UnificationContext p_context )
172  {
173  final Object l_constraint = this.visitUnification_constraint( p_context.unification_constraint() );
174 
175  if ( l_constraint instanceof IExpression )
176  return new CExpressionUnify(
177  Objects.nonNull( p_context.AT() ),
178  (ILiteral) this.visitLiteral( p_context.literal() ),
179  (IExpression) l_constraint
180  );
181 
182  if ( l_constraint instanceof IVariable<?> )
183  return new CVariableUnify(
184  Objects.nonNull( p_context.AT() ),
185  (ILiteral) this.visitLiteral( p_context.literal() ),
186  (IVariable<?>) l_constraint
187  );
188 
189  return new CDefaultUnify( Objects.nonNull( p_context.AT() ), (ILiteral) this.visitLiteral( p_context.literal() ) );
190  }
191 
192  @Override
193  public final Object visitUnification_constraint( final TypeParser.Unification_constraintContext p_context )
194  {
195  if ( Objects.isNull( p_context ) )
196  return null;
197 
198  if ( Objects.nonNull( p_context.expression() ) )
199  return this.visitExpression( p_context.expression() );
200 
201  if ( Objects.nonNull( p_context.variable() ) )
202  return this.visitVariable( p_context.variable() );
203 
204  return null;
205  }
206 
207  @Override
208  public final Object visitTernary_operation( final TypeParser.Ternary_operationContext p_context )
209  {
210  return new CTernaryOperation(
211  (IExpression) this.visitExpression( p_context.expression() ),
212  (IExecution) this.visitTernary_operation_true( p_context.ternary_operation_true() ),
213  (IExecution) this.visitTernary_operation_false( p_context.ternary_operation_false() )
214  );
215  }
216 
217  @Override
218  public final Object visitTernary_operation_true( final TypeParser.Ternary_operation_trueContext p_context )
219  {
220  return this.visitExecutable_term( p_context.executable_term() );
221  }
222 
223  @Override
224  public final Object visitTernary_operation_false( final TypeParser.Ternary_operation_falseContext p_context )
225  {
226  return this.visitExecutable_term( p_context.executable_term() );
227  }
228 
229  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
230 
231 
232  // --- simple datatypes ------------------------------------------------------------------------------------------------------------------------------------
233 
234  @Override
235  public final Object visitLiteral( final TypeParser.LiteralContext p_context )
236  {
237  return new CLiteral(
238  Objects.nonNull( p_context.AT() ),
239  Objects.nonNull( p_context.STRONGNEGATION() ),
240  CPath.from( this.visitAtom( p_context.atom() ).toString() ),
241  (Collection<ITerm>) this.visitTermlist( p_context.termlist() )
242  );
243  }
244 
245  @Override
246  public final Object visitTerm( final TypeParser.TermContext p_context )
247  {
248  if ( Objects.nonNull( p_context.STRING() ) )
249  return stringvalue( p_context.STRING().getText() );
250  if ( Objects.nonNull( p_context.number() ) )
251  return this.visitNumber( p_context.number() );
252  if ( Objects.nonNull( p_context.LOGICALVALUE() ) )
253  return logicalvalue( p_context.LOGICALVALUE().getText() );
254 
255  if ( Objects.nonNull( p_context.literal() ) )
256  return this.visitLiteral( p_context.literal() );
257  if ( Objects.nonNull( p_context.variable() ) )
258  return this.visitVariable( p_context.variable() );
259 
260  if ( Objects.nonNull( p_context.termlist() ) )
261  return this.visitTermlist( p_context.termlist() );
262  if ( Objects.nonNull( p_context.expression() ) )
263  return this.visitExpression( p_context.expression() );
264  if ( Objects.nonNull( p_context.ternary_operation() ) )
265  return this.visitTernary_operation( p_context.ternary_operation() );
266 
267  throw new CIllegalArgumentException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "termunknown", p_context.getText() ) );
268  }
269 
270  @Override
271  public final Object visitTermlist( final TypeParser.TermlistContext p_context )
272  {
273  if ( ( Objects.isNull( p_context ) ) || ( p_context.isEmpty() ) )
274  return Collections.<ITerm>emptyList();
275 
276  return p_context.term().stream()
277  .map( i -> this.visitTerm( i ) )
278  .filter( i -> Objects.nonNull( i ) )
279  .map( i -> i instanceof ITerm ? (ITerm) i : CRawTerm.from( i ) )
280  .collect( Collectors.toList() );
281  }
282 
283  @Override
284  public final Object visitVariablelist( final TypeParser.VariablelistContext p_context )
285  {
286  return this.visitChildren( p_context );
287  }
288 
289  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
290 
291 
292  // --- raw rules -------------------------------------------------------------------------------------------------------------------------------------------
293 
294  @Override
295  public final Object visitNumber( final TypeParser.NumberContext p_context )
296  {
297  if ( Objects.nonNull( p_context.CONSTANTNUMBER() ) )
298  return numericonstant( p_context.CONSTANTNUMBER().getText() );
299 
300  final Number l_value = (Number) this.visitChildren( p_context );
301  return Objects.nonNull( p_context.MINUS() )
302  ? -1 * l_value.doubleValue()
303  : l_value.doubleValue();
304  }
305 
306  @Override
307  public final Object visitDigitsequence( final TypeParser.DigitsequenceContext p_context )
308  {
309  return Double.valueOf( p_context.getText() );
310  }
311 
312  @Override
313  public final Object visitAtom( final TypeParser.AtomContext p_context )
314  {
315  return p_context.getText();
316  }
317 
318  @Override
319  public final Object visitVariable( final TypeParser.VariableContext p_context )
320  {
321  return Objects.isNull( p_context.AT() )
322  ? new CVariable<>( (String) this.visitVariableatom( p_context.variableatom() ) )
323  : new CMutexVariable<>( (String) this.visitVariableatom( p_context.variableatom() ) );
324  }
325 
326  @Override
327  public final Object visitVariableatom( final TypeParser.VariableatomContext p_context )
328  {
329  return p_context.getText();
330  }
331 
332  @Override
333  public final Object visitExpression( final TypeParser.ExpressionContext p_context )
334  {
335  // bracket expression
336  if ( Objects.nonNull( p_context.expression_bracket() ) )
337  return this.visitExpression_bracket( p_context.expression_bracket() );
338 
339  // or-expression
340  return CCommon.createLogicalBinaryExpression(
341  EOperator.OR,
342  (IExpression) this.visitExpression_logical_and( p_context.expression_logical_and() ),
343  Objects.nonNull( p_context.expression() )
344  ? p_context.expression().stream().map( i -> (IExpression) this.visitExpression( i ) ).collect(
345  Collectors.toList() )
346  : Collections.<IExpression>emptyList()
347  );
348  }
349 
350  @Override
351  public final Object visitExpression_bracket( final TypeParser.Expression_bracketContext p_context )
352  {
353  return this.visitExpression( p_context.expression() );
354  }
355 
356  @Override
357  public final Object visitExpression_logical_and( final TypeParser.Expression_logical_andContext p_context )
358  {
359  return CCommon.createLogicalBinaryExpression(
360  EOperator.AND,
361  (IExpression) this.visitExpression_logical_xor( p_context.expression_logical_xor() ),
362  Objects.nonNull( p_context.expression() )
363  ? p_context.expression().stream().map( i -> (IExpression) this.visitExpression( i ) ).collect(
364  Collectors.toList() )
365  : Collections.<IExpression>emptyList()
366  );
367  }
368 
369  @Override
370  public final Object visitExpression_logical_xor( final TypeParser.Expression_logical_xorContext p_context )
371  {
372  if ( Objects.nonNull( p_context.expression_logical_element() ) )
373  return CCommon.createLogicalBinaryExpression(
374  EOperator.XOR,
375  (IExpression) this.visitExpression_logical_element( p_context.expression_logical_element() ),
376  Objects.nonNull( p_context.expression() )
377  ? p_context.expression().stream().map( i -> (IExpression) this.visitExpression( i ) ).collect(
378  Collectors.toList() )
379  : Collections.<IExpression>emptyList()
380  );
381 
382  if ( Objects.nonNull( p_context.expression_logical_negation() ) )
383  return this.visitExpression_logical_negation( p_context.expression_logical_negation() );
384 
385  if ( Objects.nonNull( p_context.expression_numeric() ) )
386  return this.visitExpression_numeric( p_context.expression_numeric() );
387 
388  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "logicallefthandside", p_context.getText() ) );
389  }
390 
391  @Override
392  public final Object visitExpression_logical_negation( final TypeParser.Expression_logical_negationContext p_context )
393  {
394  return new CUnary( EOperator.NEGATION, (IExpression) this.visitExpression( p_context.expression() ) );
395  }
396 
397  @Override
398  public final Object visitExpression_logical_element( final TypeParser.Expression_logical_elementContext p_context )
399  {
400  if ( Objects.nonNull( p_context.LOGICALVALUE() ) )
401  return new CAtom( logicalvalue( p_context.LOGICALVALUE().getText() ) );
402 
403  if ( Objects.nonNull( p_context.variable() ) )
404  return new CAtom( this.visitVariable( p_context.variable() ) );
405 
406  if ( Objects.nonNull( p_context.unification() ) )
407  return new CProxyReturnExpression<>( (IExecution) this.visitUnification( p_context.unification() ) );
408 
409  if ( Objects.nonNull( p_context.executable_action() ) )
410  return new CProxyReturnExpression<>( (IExecution) this.visitExecutable_action( p_context.executable_action() ) );
411 
412  if ( Objects.nonNull( p_context.executable_rule() ) )
413  return new CProxyReturnExpression<>( (IExecution) this.visitExecutable_rule( p_context.executable_rule() ) );
414 
415  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "logicalelement", p_context.getText() ) );
416  }
417 
418  @Override
419  public final Object visitExpression_numeric( final TypeParser.Expression_numericContext p_context )
420  {
421  if ( Objects.isNull( p_context.expression_numeric() ) )
422  return this.visitExpression_numeric_relation( p_context.expression_numeric_relation() );
423 
424  if ( Objects.nonNull( p_context.EQUAL() ) )
425  return new CComparable(
427  (IExpression) this.visitExpression_numeric_relation( p_context.expression_numeric_relation() ),
428  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
429  );
430 
431  if ( Objects.nonNull( p_context.NOTEQUAL() ) )
432  return new CComparable(
434  (IExpression) this.visitExpression_numeric_relation( p_context.expression_numeric_relation() ),
435  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
436  );
437 
438  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "compareoperator", p_context.getText() ) );
439  }
440 
441  @Override
442  public final Object visitExpression_numeric_relation( final TypeParser.Expression_numeric_relationContext p_context )
443  {
444  if ( Objects.isNull( p_context.expression_numeric() ) )
445  return this.visitExpression_numeric_additive( p_context.expression_numeric_additive() );
446 
447  if ( Objects.nonNull( p_context.GREATER() ) )
448  return new CRelational(
450  (IExpression) this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
451  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
452  );
453 
454  if ( Objects.nonNull( p_context.GREATEREQUAL() ) )
455  return new CRelational(
457  (IExpression) this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
458  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
459  );
460 
461  if ( Objects.nonNull( p_context.LESS() ) )
462  return new CRelational(
463  EOperator.LESS,
464  (IExpression) this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
465  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
466  );
467 
468  if ( Objects.nonNull( p_context.LESSEQUAL() ) )
469  return new CRelational(
471  (IExpression) this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
472  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
473  );
474 
475  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "relationaloperator", p_context.getText() ) );
476  }
477 
478  @Override
479  public final Object visitExpression_numeric_additive( final TypeParser.Expression_numeric_additiveContext p_context )
480  {
481  if ( Objects.isNull( p_context.expression_numeric() ) )
482  return this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() );
483 
484  if ( Objects.nonNull( p_context.PLUS() ) )
485  return new CAdditive(
486  EOperator.PLUS,
487  (IExpression) this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() ),
488  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
489  );
490 
491  if ( Objects.nonNull( p_context.MINUS() ) )
492  return new CAdditive(
494  (IExpression) this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() ),
495  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
496  );
497 
498  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "additiveoperator", p_context.getText() ) );
499  }
500 
501  @Override
502  public final Object visitExpression_numeric_multiplicative( final TypeParser.Expression_numeric_multiplicativeContext p_context )
503  {
504  if ( Objects.isNull( p_context.expression_numeric() ) )
505  return this.visitExpression_numeric_power( p_context.expression_numeric_power() );
506 
507  if ( Objects.nonNull( p_context.MULTIPLY() ) )
508  return new CMultiplicative(
510  (IExpression) this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
511  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
512  );
513 
514  if ( Objects.nonNull( p_context.SLASH() ) )
515  return new CMultiplicative(
517  (IExpression) this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
518  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
519  );
520 
521  if ( Objects.nonNull( p_context.MODULO() ) )
522  return new CMultiplicative(
524  (IExpression) this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
525  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
526  );
527 
528  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "multiplicativeoperator", p_context.getText() ) );
529  }
530 
531  @Override
532  public final Object visitExpression_numeric_power( final TypeParser.Expression_numeric_powerContext p_context )
533  {
534  if ( Objects.isNull( p_context.expression_numeric() ) )
535  return this.visitExpression_numeric_element( p_context.expression_numeric_element() );
536 
537  return new CPower(
539  (IExpression) this.visitExpression_numeric_element( p_context.expression_numeric_element() ),
540  (IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
541  );
542  }
543 
544  @Override
545  public final Object visitExpression_numeric_element( final TypeParser.Expression_numeric_elementContext p_context )
546  {
547  if ( Objects.nonNull( p_context.number() ) )
548  return new CAtom( this.visitNumber( p_context.number() ) );
549 
550  if ( Objects.nonNull( p_context.variable() ) )
551  return new CAtom( this.visitVariable( p_context.variable() ) );
552 
553  if ( Objects.nonNull( p_context.executable_action() ) )
554  return new CProxyReturnExpression<>( (IExecution) this.visitExecutable_action( p_context.executable_action() ) );
555 
556  if ( Objects.nonNull( p_context.executable_rule() ) )
557  return new CProxyReturnExpression<>( (IExecution) this.visitExecutable_rule( p_context.executable_rule() ) );
558 
559  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( this, "numericelement", p_context.getText() ) );
560  }
561 
562  @Override
563  public final Object visitExecutable_action( final TypeParser.Executable_actionContext p_context )
564  {
565  return new CProxyAction( m_actions, (ILiteral) this.visitLiteral( p_context.literal() ) );
566  }
567 
568  @Override
569  public final Object visitExecutable_rule( final TypeParser.Executable_ruleContext p_context )
570  {
571  if ( Objects.nonNull( p_context.literal() ) )
572  return new CAchievementRuleLiteral( (ILiteral) this.visitLiteral( p_context.literal() ) );
573 
574  return null;
575  }
576 
577  @Override
578  public final Object visitVariable_evaluate( final TypeParser.Variable_evaluateContext p_context )
579  {
580  return null;
581  }
582 
583  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
584 
585 
586  // --- helper ----------------------------------------------------------------------------------------------------------------------------------------------
587 
594  private static Number numericonstant( @Nonnull final String p_value )
595  {
596  final Double l_constant = org.lightjason.agentspeak.grammar.CCommon.NUMERICCONSTANT.get( p_value );
597  if ( Objects.nonNull( l_constant ) )
598  return l_constant;
599 
600  throw new CSyntaxErrorException( org.lightjason.agentspeak.common.CCommon.languagestring( CASTVisitorType.class, "constantunknown", p_value ) );
601  }
602 
609  private static boolean logicalvalue( @Nonnull final String p_value )
610  {
611  return ( !p_value.isEmpty() ) && ( ( "true".equals( p_value ) ) || ( "success".equals( p_value ) ) );
612  }
613 
620  private static String stringvalue( @Nonnull final String p_value )
621  {
622  return p_value.length() < 3 ? "" : p_value.substring( 1, p_value.length() - 1 );
623  }
624 
625  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
626 
627 
628  // --- getter structure ------------------------------------------------------------------------------------------------------------------------------------
629 
630  @Nonnull
631  @Override
632  public final ILiteral literal()
633  {
634  return m_literal;
635  }
636 
637  @Nonnull
638  @Override
639  public final IExpression expression()
640  {
641  return m_expression;
642  }
643 
644  @Nonnull
645  @Override
646  public final ITerm term()
647  {
648  return m_term;
649  }
650 
651  // ---------------------------------------------------------------------------------------------------------------------------------------------------------
652 
653 }
final Object visitExpression_numeric_relation(final TypeParser.Expression_numeric_relationContext p_context)
static boolean logicalvalue( @Nonnull final String p_value)
converts a string token to the type
final Object visitTernary_operation_false(final TypeParser.Ternary_operation_falseContext p_context)
IExpression EMPTY
empty expression, is always true
final Object visitVariable_evaluate(final TypeParser.Variable_evaluateContext p_context)
final Object visitUnification(final TypeParser.UnificationContext p_context)
final Object visitAtom(final TypeParser.AtomContext p_context)
final Object visitUnification_constraint(final TypeParser.Unification_constraintContext p_context)
static IPath from( @Nonnull final String p_string)
factor method to build path
Definition: CPath.java:166
final Object visitExpression_logical_xor(final TypeParser.Expression_logical_xorContext p_context)
static< T > String languagestring(final T p_source, final String p_label, final Object... p_parameter)
returns the language depend string on any object
class to create a path structure
Definition: CPath.java:53
encapsulate class for any non-executable data type e.g.
Definition: CRawAction.java:47
final Object visitExpression(final TypeParser.ExpressionContext p_context)
final Object visitExpression_numeric_additive(final TypeParser.Expression_numeric_additiveContext p_context)
final Object visitVariable(final TypeParser.VariableContext p_context)
final Object visitExpression_numeric_multiplicative(final TypeParser.Expression_numeric_multiplicativeContext p_context)
final Object visitExecutable_action(final TypeParser.Executable_actionContext p_context)
static String stringvalue( @Nonnull final String p_value)
create a string value without quotes
final Object visitTernary_operation(final TypeParser.Ternary_operationContext p_context)
external action interface
Definition: IAction.java:38
final Object visitExpression_logical_negation(final TypeParser.Expression_logical_negationContext p_context)
final Object visitExpression_term(final TypeParser.Expression_termContext p_context)
final Object visitTernary_operation_true(final TypeParser.Ternary_operation_trueContext p_context)
static Number numericonstant( @Nonnull final String p_value)
returns the value of a numeric constant
final Object visitVariableatom(final TypeParser.VariableatomContext p_context)
final Object visitExpression_numeric_power(final TypeParser.Expression_numeric_powerContext p_context)
final Map< IPath, IAction > m_actions
map with action definition
default generic literal class for agent beliefs a literal consists of a functor, an optional list of ...
Definition: CLiteral.java:64
final IExpression expression()
get the parsed expression
final Object visitLiteral(final TypeParser.LiteralContext p_context)
final ILiteral literal()
get the parsed literal
final Object visitLiteral_type(final TypeParser.Literal_typeContext p_context)
final Object visitExecutable_rule(final TypeParser.Executable_ruleContext p_context)
final Object visitExpression_numeric_element(final TypeParser.Expression_numeric_elementContext p_context)
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
Definition: CRawTerm.java:104
final Object visitExpression_type(final TypeParser.Expression_typeContext p_context)
final Object visitVariablelist(final TypeParser.VariablelistContext p_context)
final Object visitExpression_logical_element(final TypeParser.Expression_logical_elementContext p_context)
static final Map< String, Double > NUMERICCONSTANT
numeric constant values - infinity is defined manually
final Object visitExpression_logical_and(final TypeParser.Expression_logical_andContext p_context)
final Object visitTermlist(final TypeParser.TermlistContext p_context)
final Object visitExpression_numeric(final TypeParser.Expression_numericContext p_context)
final Object visitDigitsequence(final TypeParser.DigitsequenceContext p_context)
final Object visitExpression_bracket(final TypeParser.Expression_bracketContext p_context)
final Object visitTerm(final TypeParser.TermContext p_context)
CASTVisitorType( @Nonnull final Set< IAction > p_actions, @Nonnull final Set< IRule > p_rules)
ctor
final Object visitNumber(final TypeParser.NumberContext p_context)
term structure for simple datatypes
Definition: CRawTerm.java:45
final Object visitExecutable_term(final TypeParser.Executable_termContext p_context)