24 package org.lightjason.agentspeak.language.execution.action;
34 import javax.annotation.Nonnull;
35 import java.text.MessageFormat;
36 import java.util.Collections;
37 import java.util.LinkedList;
38 import java.util.List;
39 import java.util.Objects;
40 import java.util.stream.Stream;
71 super( p_expression );
79 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
81 final List<ITerm> l_argument =
new LinkedList<>();
82 if ( ( !
m_value.execute( p_parallel, p_context, Collections.<
ITerm>emptyList(), l_argument ).value() )
83 || ( l_argument.size() != 1 ) )
86 return l_argument.get( 0 ).raw()
87 ? m_true.
execute( p_parallel, p_context, Collections.<
ITerm>emptyList(), p_return )
88 : m_false.
execute( p_parallel, p_context, Collections.<
ITerm>emptyList(), p_return );
94 return ( Objects.isNull(
m_value ) ? 0 :
m_value.hashCode() ) ^ m_true.hashCode() ^ m_false.hashCode();
98 public final boolean equals(
final Object p_object )
100 return ( p_object instanceof
IExecution ) && ( this.
hashCode() == p_object.hashCode() );
106 return MessageFormat.format(
"[ {0} ] ? [ {1} ] : [ {2} ]",
m_value, m_true, m_false );
IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
Stream< IVariable<?> > variables()
returns a stream with all used variables
internal execution interface
static final long serialVersionUID
serial id
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
final IExecution m_false
false execution block
execution context with local data
final Stream< IVariable<?> > variables()
result for an immutable fuzzy value
final boolean equals(final Object p_object)
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)
final IExecution m_true
true execution block
CTernaryOperation( @Nonnull final IExpression p_expression, @Nonnull final IExecution p_true, @Nonnull final IExecution p_false)
ctor