24 package org.lightjason.agentspeak.action.builtin.bool;
26 import com.google.common.collect.Multimap;
35 import javax.annotation.Nonnegative;
36 import javax.annotation.Nonnull;
37 import java.util.Arrays;
38 import java.util.Collection;
39 import java.util.List;
41 import java.util.stream.Stream;
72 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return
80 .map( i -> p_argument.get( 0 ).equals( i )
82 &&
equalcollection( p_argument.get( 0 ).<Collection<?>>raw().toArray(), i.raw() ) )
91 .map( i -> p_argument.get( 0 ).equals( i )
93 &&
equalmap( p_argument.get( 0 ).<Map<?, ?>>raw(), i.<Map<?, ?>>raw() ) )
102 .map( i -> p_argument.get( 0 ).equals( i )
104 &&
equalmultimap( p_argument.get( 0 ).<Multimap<?, ?>>raw(), i.<Multimap<?, ?>>raw() ) )
113 .map( i ->
equalobject( p_argument.get( 0 ).<Object>raw(), i.<Object>raw() ) )
124 protected boolean apply(
final boolean p_value )
139 p_stream.map( this::apply )
141 .forEach( p_return::add );
153 private static boolean equalobject( @Nonnull
final Object p_source, @Nonnull
final Object p_target )
155 return p_source.equals( p_target );
166 private static boolean equalcollection( @Nonnull
final Object[] p_source, @Nonnull
final Collection<?> p_target )
168 return Arrays.equals( p_source, p_target.toArray() );
179 private static boolean equalmap( @Nonnull
final Map<?, ?> p_source, @Nonnull
final Map<?, ?> p_target )
181 return Arrays.equals( p_source.keySet().toArray(), p_target.keySet().toArray() )
182 && Arrays.equals( p_source.values().toArray(), p_target.values().toArray() );
193 private static boolean equalmultimap( @Nonnull
final Multimap<?, ?> p_source, @Nonnull
final Multimap<?, ?> p_target )
195 return Arrays.equals( p_source.asMap().keySet().toArray(), p_target.asMap().keySet().toArray() )
196 && Arrays.equals( p_source.values().toArray(), p_target.values().toArray() );
base class of build-in actions for setting name by package/classname (without prefix character) ...
static boolean equalobject( @Nonnull final Object p_source, @Nonnull final Object p_target)
compare any objects
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
common structure for execution definition
static boolean equalcollection( @Nonnull final Object[] p_source, @Nonnull final Collection<?> p_target)
compares collections
IFuzzyValue< Boolean > pack( @Nonnull final List< ITerm > p_return, @Nonnull final Stream< Boolean > p_stream)
pack the result values into term
execution context with local data
static boolean equalmultimap( @Nonnull final Multimap<?, ?> p_source, @Nonnull final Multimap<?, ?> p_target)
compare multimap
static boolean equalmap( @Nonnull final Map<?, ?> p_source, @Nonnull final Map<?, ?> p_target)
compare maps
checks elements of equality.
boolean apply(final boolean p_value)
apply to change boolean result
final int minimalArgumentNumber()
minimum number of arguments
static< T > boolean rawvalueAssignableTo( @Nonnull final T p_value, @Nonnull final Class<?>... p_class)
checks a term value for assignable class
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)
defines a plan-body operation
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
static final long serialVersionUID
serial id
term structure for simple datatypes