LightJason - AgentSpeak(L++)
CAchievementGoalLiteral.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.language.execution.action.achievement_test;
25 
32 
33 import javax.annotation.Nonnull;
34 import java.text.MessageFormat;
35 import java.util.List;
36 
37 
41 public final class CAchievementGoalLiteral extends IAchievementGoal<ILiteral>
42 {
46  private static final long serialVersionUID = -8534258655371085840L;
47 
54  public CAchievementGoalLiteral( @Nonnull final ILiteral p_type, final boolean p_immediately )
55  {
56  super( p_type, p_immediately );
57  }
58 
59  @Override
60  public final String toString()
61  {
62  return MessageFormat.format( "{0}{1}", m_immediately ? "!!" : "!", m_value );
63  }
64 
65  @Nonnull
66  @Override
67  public final IFuzzyValue<Boolean> execute( final boolean p_parallel, @Nonnull final IContext p_context,
68  @Nonnull final List<ITerm> p_argument, @Nonnull final List<ITerm> p_return )
69  {
70  return p_context.agent().trigger( CTrigger.from( ITrigger.EType.ADDGOAL, m_value.unify( p_context ) ), m_immediately );
71  }
72 
73 }
static ITrigger from( @Nonnull final EType p_event, @Nonnull final ILiteral p_literal)
creates a trigger event^
Definition: CTrigger.java:87
execution context with local data
Definition: IContext.java:42
CAchievementGoalLiteral( @Nonnull final ILiteral p_type, final boolean p_immediately)
ctor
result for an immutable fuzzy value
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)