24 package org.lightjason.agentspeak.grammar;
26 import com.google.common.collect.LinkedHashMultimap;
27 import com.google.common.collect.Multimap;
28 import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
29 import org.apache.commons.lang3.tuple.ImmutablePair;
30 import org.apache.commons.lang3.tuple.Pair;
89 import javax.annotation.Nonnull;
90 import java.text.MessageFormat;
91 import java.util.Collection;
92 import java.util.Collections;
93 import java.util.HashSet;
94 import java.util.LinkedHashSet;
95 import java.util.LinkedList;
96 import java.util.List;
98 import java.util.Objects;
100 import java.util.logging.Logger;
101 import java.util.stream.Collectors;
110 @SuppressWarnings( {
"all",
"warnings",
"unchecked",
"unused",
"cast"} )
120 private final Set<ILiteral> m_initialbeliefs =
new LinkedHashSet<>();
124 private final Set<IPlan> m_plans =
new HashSet<>();
128 private final Multimap<IPath, IRule> m_rules = LinkedHashMultimap.create();
141 m_actions = p_actions.stream().collect( Collectors.toMap( i -> i.name(), i -> i ) );
142 LOGGER.info( MessageFormat.format(
"create parser with actions & rules : {0} / {1}", m_actions.keySet(), m_rules.keySet() ) );
149 public final Object
visitPlanbundle(
final PlanBundleParser.PlanbundleContext p_context )
151 return this.visitChildren( p_context );
159 public final Object
visitBelief(
final PlanBundleParser.BeliefContext p_context )
161 if ( Objects.isNull( p_context.literal() ) )
164 m_initialbeliefs.add( (
ILiteral) this.visitLiteral( p_context.literal() ) );
169 public final Object
visitPlans(
final PlanBundleParser.PlansContext p_context )
171 if ( Objects.isNull( p_context.plan() ) )
174 p_context.plan().stream().forEach( i -> ( (List<IPlan>) this.visitPlan( i ) ).stream().forEach( j -> m_plans.add( j ) ) );
175 LOGGER.info( MessageFormat.format(
"parsed plans: {0}", m_plans ) );
180 public final Object
visitLogicrules(
final PlanBundleParser.LogicrulesContext p_context )
183 p_context.logicrule().stream()
184 .map( i -> (
IRule) this.visitLogicrulePlaceHolder( i ) )
185 .forEach( i -> m_rules.put( i.identifier().fqnfunctor(), i ) );
187 final Multimap<IPath, IRule> l_rules = LinkedHashMultimap.create();
188 p_context.logicrule().stream()
189 .flatMap( i -> ( (List<IRule>) this.visitLogicrule( i ) ).stream() )
190 .forEach( i -> l_rules.put( i.identifier().fqnfunctor(), i ) );
194 l_rules.values().stream()
195 .map( i -> i.replaceplaceholder( l_rules ) )
196 .forEach( i -> m_rules.put( i.identifier().fqnfunctor(), i ) );
198 LOGGER.info( MessageFormat.format(
"parsed rules: {0}", m_rules.values() ) );
203 public final Object
visitLogicrule(
final PlanBundleParser.LogicruleContext p_context )
205 final ILiteral l_literal = (
ILiteral) this.visitLiteral( p_context.literal() );
206 return p_context.logicalruledefinition().stream()
207 .map( i ->
new CRule( (
ILiteral) l_literal.
deepcopy(), (List<IExecution>) this.visitLogicalruledefinition( i ) ) )
208 .collect( Collectors.toList() );
214 return this.visitBody( p_context.body() );
218 public final Object
visitPlan(
final PlanBundleParser.PlanContext p_context )
220 final Set<IAnnotation<?>> l_annotation = (Set<IAnnotation<?>>) this.visitAnnotations( p_context.annotations() );
222 (
ITrigger.
EType)
this.visitPlan_trigger( p_context.plan_trigger() ),
223 (
ILiteral) this.visitLiteral( p_context.literal() )
226 return p_context.plandefinition()
230 final Pair<IExpression, List<IExecution>> l_content = (Pair<IExpression, List<IExecution>>) this.visitPlandefinition( i );
231 return new CPlan( l_trigger, l_content.getLeft(), l_content.getRight(), l_annotation );
233 .collect( Collectors.toList() );
239 return new ImmutablePair<IExpression, List<IExecution>>(
241 : (
IExpression) this.visitExpression( p_context.expression() ),
242 (List<IExecution>) this.visitBody( p_context.body() )
247 public final Object
visitAnnotations(
final PlanBundleParser.AnnotationsContext p_context )
249 if ( ( Objects.isNull( p_context ) ) || ( p_context.isEmpty() ) )
250 return Collections.emptySet();
253 final Set<IAnnotation<?>> l_annotation =
new HashSet<>();
255 if ( Objects.nonNull( p_context.annotation_atom() ) )
256 p_context.annotation_atom().stream().map( i -> (
IAnnotation<?>) this.visitAnnotation_atom( i ) ).forEach( l_annotation::add );
258 if ( Objects.nonNull( p_context.annotation_literal() ) )
259 p_context.annotation_literal().stream().map( i -> (
IAnnotation<?>) this.visitAnnotation_literal( i ) ).forEach( l_annotation::add );
261 return l_annotation.isEmpty() ? Collections.emptySet() : l_annotation;
267 if ( Objects.nonNull( p_context.ATOMIC() ) )
270 if ( Objects.nonNull( p_context.PARALLEL() ) )
279 return this.visitChildren( p_context );
285 if ( Objects.nonNull( p_context.number() ) )
288 (String) this.visitVariableatom( p_context.variableatom() ),
289 ( (Number) this.visitNumber( p_context.number() ) ).doubleValue()
292 if ( Objects.nonNull( p_context.STRING() ) )
295 (String) this.visitVariableatom( p_context.variableatom() ),
296 stringvalue( p_context.STRING().getText() )
305 return this.visitChildren( p_context );
333 public final Object
visitBody(
final PlanBundleParser.BodyContext p_context )
336 return p_context.body_formula().stream()
337 .filter( i -> Objects.nonNull( i ) )
338 .map( i -> this.visitBody_formula( i ) )
342 .collect( Collectors.toList() );
348 return this.visitChildren( p_context );
356 if ( Objects.isNull( p_context.repair_formula() ) )
357 return this.visitChildren( p_context );
361 if ( Objects.nonNull( p_context.executable_term() ) )
363 (
IExecution) this.visitExecutable_term( p_context.executable_term() ),
364 (
IExecution) this.visitRepair_formula( p_context.repair_formula() )
367 if ( Objects.nonNull( p_context.test_action() ) )
369 (
IExecution) this.visitTest_action( p_context.test_action() ),
370 (
IExecution) this.visitRepair_formula( p_context.repair_formula() )
373 if ( Objects.nonNull( p_context.achievement_goal_action() ) )
375 (
IExecution) this.visitAchievement_goal_action( p_context.achievement_goal_action() ),
376 (
IExecution) this.visitRepair_formula( p_context.repair_formula() )
383 public final Object
visitUnification(
final PlanBundleParser.UnificationContext p_context )
385 final Object l_constraint = this.visitUnification_constraint( p_context.unification_constraint() );
389 p_context.AT() != null,
390 (
ILiteral) this.visitLiteral( p_context.literal() ),
391 (IExpression) l_constraint
396 p_context.AT() != null,
397 (
ILiteral) this.visitLiteral( p_context.literal() ),
398 (IVariable<?>) l_constraint
401 return new CDefaultUnify( p_context.AT() != null, (
ILiteral) this.visitLiteral( p_context.literal() ) );
407 if ( Objects.isNull( p_context ) )
410 if ( Objects.nonNull( p_context.expression() ) )
411 return this.visitExpression( p_context.expression() );
413 if ( Objects.nonNull( p_context.variable() ) )
414 return this.visitVariable( p_context.variable() );
422 if ( Objects.nonNull( p_context.body_formula() ) )
424 final LinkedList<IExecution> l_statement =
new LinkedList<>();
425 l_statement.add( (
IExecution) this.visitBody_formula( p_context.body_formula() ) );
429 return this.visitBody( p_context.body() );
433 public final Object
visitLambda(
final PlanBundleParser.LambdaContext p_context )
435 if ( Objects.nonNull( p_context.lambda_return() ) )
437 Objects.nonNull( p_context.AT() ),
438 (
IExecution) this.visitLambda_initialization( p_context.lambda_initialization() ),
439 (
IVariable<?>) this.visitVariable( p_context.variable() ),
440 (
IVariable<?>) this.visitLambda_return( p_context.lambda_return() ),
441 (List<IExecution>) this.visitBlock_formula( p_context.block_formula() )
445 Objects.nonNull( p_context.AT() ),
446 (
IExecution) this.visitLambda_initialization( p_context.lambda_initialization() ),
447 (
IVariable<?>) this.visitVariable( p_context.variable() ),
448 (List<IExecution>) this.visitBlock_formula( p_context.block_formula() )
455 if ( Objects.nonNull( p_context.variable() ) )
456 return new CRawAction<>( this.visitVariable( p_context.variable() ) );
458 if ( Objects.nonNull( p_context.literal() ) )
467 return this.visitVariable( p_context.variable() );
473 if ( Objects.nonNull( p_context.STRING() ) )
474 return new CRawAction<>( stringvalue( p_context.STRING().getText() ) );
475 if ( Objects.nonNull( p_context.number() ) )
476 return new CRawAction<>( this.visitNumber( p_context.number() ) );
477 if ( Objects.nonNull( p_context.LOGICALVALUE() ) )
478 return new CRawAction<>( logicalvalue( p_context.LOGICALVALUE().getText() ) );
480 if ( Objects.nonNull( p_context.executable_action() ) )
481 return this.visitExecutable_action( p_context.executable_action() );
482 if ( Objects.nonNull( p_context.executable_rule() ) )
483 return this.visitExecutable_rule( p_context.executable_rule() );
485 if ( Objects.nonNull( p_context.expression() ) )
486 return this.visitExpression( p_context.expression() );
487 if ( Objects.nonNull( p_context.ternary_operation() ) )
488 return this.visitTernary_operation( p_context.ternary_operation() );
496 return this.visitChildren( p_context );
503 (
IVariable<?>) this.visitVariable( p_context.variable() ),
504 (
IExecution) this.visitExecutable_term( p_context.executable_term() )
512 p_context.variablelist().variable().stream().map( i -> (
IVariable<?>) this.visitVariable( i ) )
513 .collect( Collectors.toList() ),
514 (
IExecution) this.visitExecutable_term( p_context.executable_term() )
521 switch ( p_context.UNARYOPERATOR().getText() )
538 final ITerm l_rhs = p_context.variable().size() == 2
540 :
CRawTerm.
from(
this.visitNumber( p_context.number() ) );
550 if ( Objects.nonNull( p_context.literal() ) )
553 if ( Objects.nonNull( p_context.variable_evaluate() ) )
555 (
IVariableEvaluate) this.visitVariable_evaluate( p_context.variable_evaluate() ),
556 p_context.DOUBLEEXCLAMATIONMARK() != null
566 (
IExpression) this.visitExpression( p_context.expression() ),
567 (
IExecution) this.visitTernary_operation_true( p_context.ternary_operation_true() ),
568 (
IExecution) this.visitTernary_operation_false( p_context.ternary_operation_false() )
575 return this.visitExecutable_term( p_context.executable_term() );
581 return this.visitExecutable_term( p_context.executable_term() );
585 public final Object
visitTest_action(
final PlanBundleParser.Test_actionContext p_context )
588 return p_context.DOLLAR() != null
596 if ( Objects.nonNull( p_context.PLUS() ) )
599 if ( Objects.nonNull( p_context.MINUS() ) )
609 p_context.variablelist().variable().stream().map( i -> (
IVariable<?>) this.visitVariable( i ) ).collect( Collectors.toList() ),
610 (
ITerm) ( p_context.literal() != null ? this.visitLiteral( p_context.literal() ) : this.visitVariable( p_context.variable() ) )
620 public final Object
visitLiteral(
final PlanBundleParser.LiteralContext p_context )
623 p_context.AT() != null,
624 p_context.STRONGNEGATION() != null,
625 CPath.
from( this.visitAtom( p_context.atom() ).toString() ),
626 (Collection<ITerm>) this.visitTermlist( p_context.termlist() )
631 public final Object
visitTerm(
final PlanBundleParser.TermContext p_context )
633 if ( Objects.nonNull( p_context.STRING() ) )
634 return stringvalue( p_context.STRING().getText() );
635 if ( Objects.nonNull( p_context.number() ) )
636 return this.visitNumber( p_context.number() );
637 if ( Objects.nonNull( p_context.LOGICALVALUE() ) )
638 return logicalvalue( p_context.LOGICALVALUE().getText() );
640 if ( Objects.nonNull( p_context.literal() ) )
641 return this.visitLiteral( p_context.literal() );
642 if ( Objects.nonNull( p_context.variable() ) )
643 return this.visitVariable( p_context.variable() );
645 if ( Objects.nonNull( p_context.termlist() ) )
646 return this.visitTermlist( p_context.termlist() );
647 if ( Objects.nonNull( p_context.expression() ) )
648 return this.visitExpression( p_context.expression() );
649 if ( Objects.nonNull( p_context.ternary_operation() ) )
650 return this.visitTernary_operation( p_context.ternary_operation() );
656 public final Object
visitTermlist(
final PlanBundleParser.TermlistContext p_context )
658 if ( ( Objects.isNull( p_context ) ) || ( p_context.isEmpty() ) )
659 return Collections.<
ITerm>emptyList();
661 return p_context.term().stream()
662 .map( i -> this.visitTerm( i ) )
663 .filter( i -> Objects.nonNull( i ) )
665 .collect( Collectors.toList() );
671 return this.visitChildren( p_context );
680 public final Object
visitNumber(
final PlanBundleParser.NumberContext p_context )
682 if ( Objects.nonNull( p_context.CONSTANTNUMBER() ) )
683 return numericonstant( p_context.CONSTANTNUMBER().getText() );
685 final Number l_value = (Number) this.visitChildren( p_context );
686 return p_context.MINUS() != null
687 ? -1 * l_value.doubleValue()
688 : l_value.doubleValue();
694 return Double.valueOf( p_context.getText() );
698 public final Object
visitAtom(
final PlanBundleParser.AtomContext p_context )
700 return p_context.getText();
704 public final Object
visitVariable(
final PlanBundleParser.VariableContext p_context )
712 return p_context.getText();
716 public final Object
visitExpression(
final PlanBundleParser.ExpressionContext p_context )
719 if ( Objects.nonNull( p_context.expression_bracket() ) )
720 return this.visitExpression_bracket( p_context.expression_bracket() );
725 (
IExpression)
this.visitExpression_logical_and( p_context.expression_logical_and() ),
726 p_context.expression() != null
727 ? p_context.expression().stream().map( i -> (
IExpression) this.visitExpression( i ) ).collect( Collectors.toList() )
728 : Collections.emptyList()
735 return this.visitExpression( p_context.expression() );
743 (
IExpression)
this.visitExpression_logical_xor( p_context.expression_logical_xor() ),
744 p_context.expression() != null
745 ? p_context.expression().stream().map( i -> (
IExpression) this.visitExpression( i ) ).collect( Collectors.toList() )
746 : Collections.emptyList()
753 if ( Objects.nonNull( p_context.expression_logical_element() ) )
756 (
IExpression)
this.visitExpression_logical_element( p_context.expression_logical_element() ),
757 p_context.expression() != null
758 ? p_context.expression().stream().map( i -> (
IExpression) this.visitExpression( i ) ).collect( Collectors.toList() )
759 : Collections.emptyList()
762 if ( Objects.nonNull( p_context.expression_logical_negation() ) )
763 return this.visitExpression_logical_negation( p_context.expression_logical_negation() );
765 if ( Objects.nonNull( p_context.expression_numeric() ) )
766 return this.visitExpression_numeric( p_context.expression_numeric() );
780 if ( Objects.nonNull( p_context.LOGICALVALUE().getSymbol() ) )
781 return new CAtom( logicalvalue( p_context.LOGICALVALUE().getText() ) );
783 if ( Objects.nonNull( p_context.variable() ) )
784 return new CAtom( this.visitVariable( p_context.variable() ) );
786 if ( Objects.nonNull( p_context.unification() ) )
789 if ( Objects.nonNull( p_context.executable_action() ) )
792 if ( Objects.nonNull( p_context.executable_rule() ) )
801 if ( Objects.isNull( p_context.expression_numeric() ) )
802 return this.visitExpression_numeric_relation( p_context.expression_numeric_relation() );
804 if ( Objects.nonNull( p_context.EQUAL() ) )
807 (
IExpression)
this.visitExpression_numeric_relation( p_context.expression_numeric_relation() ),
808 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
811 if ( Objects.nonNull( p_context.NOTEQUAL() ) )
814 (
IExpression)
this.visitExpression_numeric_relation( p_context.expression_numeric_relation() ),
815 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
824 if ( Objects.isNull( p_context.expression_numeric() ) )
825 return this.visitExpression_numeric_additive( p_context.expression_numeric_additive() );
827 if ( Objects.nonNull( p_context.GREATER() ) )
830 (
IExpression)
this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
831 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
834 if ( Objects.nonNull( p_context.GREATEREQUAL() ) )
837 (
IExpression)
this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
838 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
841 if ( Objects.nonNull( p_context.LESS() ) )
844 (
IExpression)
this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
845 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
848 if ( Objects.nonNull( p_context.LESSEQUAL() ) )
851 (
IExpression)
this.visitExpression_numeric_additive( p_context.expression_numeric_additive() ),
852 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
861 if ( Objects.isNull( p_context.expression_numeric() ) )
862 return this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() );
864 if ( Objects.nonNull( p_context.PLUS() ) )
867 (
IExpression)
this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() ),
868 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
871 if ( Objects.nonNull( p_context.MINUS() ) )
874 (
IExpression)
this.visitExpression_numeric_multiplicative( p_context.expression_numeric_multiplicative() ),
875 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
884 if ( Objects.isNull( p_context.expression_numeric() ) )
885 return this.visitExpression_numeric_power( p_context.expression_numeric_power() );
887 if ( Objects.nonNull( p_context.MULTIPLY() ) )
890 (
IExpression)
this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
891 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
894 if ( Objects.nonNull( p_context.SLASH() ) )
897 (
IExpression)
this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
898 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
901 if ( Objects.nonNull( p_context.MODULO() ) )
904 (
IExpression)
this.visitExpression_numeric_power( p_context.expression_numeric_power() ),
905 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
914 if ( Objects.isNull( p_context.expression_numeric() ) )
915 return this.visitExpression_numeric_element( p_context.expression_numeric_element() );
919 (
IExpression)
this.visitExpression_numeric_element( p_context.expression_numeric_element() ),
920 (
IExpression) this.visitExpression_numeric( p_context.expression_numeric() )
927 if ( Objects.nonNull( p_context.number() ) )
928 return new CAtom( this.visitNumber( p_context.number() ) );
930 if ( Objects.nonNull( p_context.variable() ) )
931 return new CAtom( this.visitVariable( p_context.variable() ) );
933 if ( Objects.nonNull( p_context.executable_action() ) )
936 if ( Objects.nonNull( p_context.executable_rule() ) )
951 if ( Objects.nonNull( p_context.literal() ) )
954 if ( Objects.nonNull( p_context.variable_evaluate() ) )
964 (
IVariable<?>) this.visitVariable( p_context.variable() ),
965 (List<ITerm>) this.visitTermlist( p_context.termlist() )
994 if ( Objects.nonNull( l_constant ) )
1008 return ( !p_value.isEmpty() ) && ( (
"true".equals( p_value ) ) || (
"success".equals( p_value ) ) );
1019 return p_value.length() < 3 ?
"" : p_value.substring( 1, p_value.length() - 1 );
1031 return m_initialbeliefs;
1045 return new HashSet<>( m_rules.values() );
final Object visitLiteral(final PlanBundleParser.LiteralContext p_context)
final Object visitExpression_numeric_multiplicative(final PlanBundleParser.Expression_numeric_multiplicativeContext p_context)
default abstract-syntax-tree (AST) visitor for plan-bundles scripts
final Object visitVariable_evaluate(final PlanBundleParser.Variable_evaluateContext p_context)
final Set< IPlan > plans()
get a multimap with event-plan matching
final Set< IRule > rules()
returns the rules / principles
final Object visitAssignment_expression_singlevariable(final PlanBundleParser.Assignment_expression_singlevariableContext p_context)
final Object visitExpression_logical_xor(final PlanBundleParser.Expression_logical_xorContext p_context)
IExpression EMPTY
empty expression, is always true
proxy action to encapsulate all actions
static String stringvalue( @Nonnull final String p_value)
create a string value without quotes
final Object visitPlandefinition(final PlanBundleParser.PlandefinitionContext p_context)
final Object visitExpression_numeric_relation(final PlanBundleParser.Expression_numeric_relationContext p_context)
lambda expression definition
placeholder rule to define correct rule referencing
final Object visitExecutable_rule(final PlanBundleParser.Executable_ruleContext p_context)
final Object visitDeconstruct_expression(final PlanBundleParser.Deconstruct_expressionContext p_context)
final Object visitLogicrules(final PlanBundleParser.LogicrulesContext p_context)
illegal argument exception
final Object visitAnnotations(final PlanBundleParser.AnnotationsContext p_context)
final Object visitLambda(final PlanBundleParser.LambdaContext p_context)
internal execution interface
final Object visitPlans(final PlanBundleParser.PlansContext p_context)
multiplicative binary expression
final Object visitExpression_numeric_element(final PlanBundleParser.Expression_numeric_elementContext p_context)
final Object visitLambda_return(final PlanBundleParser.Lambda_returnContext p_context)
interface of logical rule
static IPath from( @Nonnull final String p_string)
factor method to build path
exception for parsing error
static< T > String languagestring(final T p_source, final String p_label, final Object... p_parameter)
returns the language depend string on any object
final Object visitTernary_operation(final PlanBundleParser.Ternary_operationContext p_context)
class to create a path structure
encapsulate class for any non-executable data type e.g.
final Object visitTest_action(final PlanBundleParser.Test_actionContext p_context)
final Object visitExpression_numeric_power(final PlanBundleParser.Expression_numeric_powerContext p_context)
final Object visitExpression_numeric_additive(final PlanBundleParser.Expression_numeric_additiveContext p_context)
final Object visitLambda_initialization(final PlanBundleParser.Lambda_initializationContext p_context)
final Object visitPlan(final PlanBundleParser.PlanContext p_context)
numerical relation expression
visitor interface of the abstract-syntax-tree (AST) for an agent
final Object visitExpression_logical_and(final PlanBundleParser.Expression_logical_andContext p_context)
final Object visitLogicrule(final PlanBundleParser.LogicruleContext p_context)
comparable binary expression
final Object visitExpression_logical_element(final PlanBundleParser.Expression_logical_elementContext p_context)
Object visitLogicrulePlaceHolder(final PlanBundleParser.LogicruleContext p_context)
create a rule placeholder object
external action interface
achievement-goal action based on a literal
static Logger logger(final Class<?> p_class)
returns a logger instance
final Object visitPlan_belief_trigger(final PlanBundleParser.Plan_belief_triggerContext p_context)
final Object visitBelief(final PlanBundleParser.BeliefContext p_context)
final Object visitTernary_operation_false(final PlanBundleParser.Ternary_operation_falseContext p_context)
encpasulating any execution context
final Object visitNumber(final PlanBundleParser.NumberContext p_context)
final Object visitTernary_operation_true(final PlanBundleParser.Ternary_operation_trueContext p_context)
static EOperator from( @Nonnull final String p_value)
returns operator from string
final Object visitLogicalruledefinition(final PlanBundleParser.LogicalruledefinitionContext p_context)
final Object visitUnification(final PlanBundleParser.UnificationContext p_context)
final Object visitAnnotation_atom(final PlanBundleParser.Annotation_atomContext p_context)
achievement for rule-variable execution
final Object visitAtom(final PlanBundleParser.AtomContext p_context)
final Object visitBody_formula(final PlanBundleParser.Body_formulaContext p_context)
assignment action of a multi-variable list
final Object visitExpression_bracket(final PlanBundleParser.Expression_bracketContext p_context)
final Object visitRepair_formula(final PlanBundleParser.Repair_formulaContext p_context)
defines an execution element with a repair call
achievement for rule-literal execution
default generic literal class for agent beliefs a literal consists of a functor, an optional list of ...
assignment action of a single-variable
structure for creating evaluate variables
final Object visitExecutable_action(final PlanBundleParser.Executable_actionContext p_context)
final Object visitAnnotation_literal(final PlanBundleParser.Annotation_literalContext p_context)
final Object visitVariable(final PlanBundleParser.VariableContext p_context)
static Number numericonstant( @Nonnull final String p_value)
returns the value of a numeric constant
final Object visitVariableatom(final PlanBundleParser.VariableatomContext p_context)
final Object visitPlan_trigger(final PlanBundleParser.Plan_triggerContext p_context)
static IExpression createLogicalBinaryExpression( @Nonnull final EOperator p_operator, @Nonnull final IExpression p_lefthandside, @Nonnull final Collection< IExpression > p_righthandside)
creates a logical expression concationation with single operator
final Object visitAchievement_goal_action(final PlanBundleParser.Achievement_goal_actionContext p_context)
annotation without parameter
T deepcopy( @Nullable final IPath... p_prefix)
clones the object (shallow-copy)
static boolean logicalvalue( @Nonnull final String p_value)
converts a string token to the type
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
class for any helper calls
final Object visitExpression(final PlanBundleParser.ExpressionContext p_context)
final Object visitPlan_goal_trigger(final PlanBundleParser.Plan_goal_triggerContext p_context)
default variable definition
final Object visitAssignment_expression_multivariable(final PlanBundleParser.Assignment_expression_multivariableContext p_context)
static final Map< String, Double > NUMERICCONSTANT
numeric constant values - infinity is defined manually
final Object visitVariablelist(final PlanBundleParser.VariablelistContext p_context)
final Object visitUnification_constraint(final PlanBundleParser.Unification_constraintContext p_context)
visitor interface of the abstract-syntax-tree (AST) for a plan bundle
final Object visitTerm(final PlanBundleParser.TermContext p_context)
final Object visitBinary_expression(final PlanBundleParser.Binary_expressionContext p_context)
final Object visitTermlist(final PlanBundleParser.TermlistContext p_context)
final Object visitExecutable_term(final PlanBundleParser.Executable_termContext p_context)
final Map< IPath, IAction > m_actions
map with action definition
final Object visitAssignment_expression(final PlanBundleParser.Assignment_expressionContext p_context)
final Object visitBody(final PlanBundleParser.BodyContext p_context)
final Object visitDigitsequence(final PlanBundleParser.DigitsequenceContext p_context)
final Object visitBelief_action(final PlanBundleParser.Belief_actionContext p_context)
assign operator expression
additve binary expression
final Set< ILiteral > initialbeliefs()
returns initial beliefs
final Object visitBlock_formula(final PlanBundleParser.Block_formulaContext p_context)
final Object visitExpression_numeric(final PlanBundleParser.Expression_numericContext p_context)
interface for evaluate variables
final Object visitPlanbundle(final PlanBundleParser.PlanbundleContext p_context)
Object visitAnnotation_value_literal(final PlanBundleParser.Annotation_value_literalContext p_context)
final Object visitExpression_logical_negation(final PlanBundleParser.Expression_logical_negationContext p_context)
achievement-goal action based on variables
CASTVisitorPlanBundle( @Nonnull final Set< IAction > p_actions)
ctor
term structure for simple datatypes
final Object visitUnary_expression(final PlanBundleParser.Unary_expressionContext p_context)