24 package org.lightjason.agentspeak.action.builtin.collection.multimap;
26 import com.codepoetics.protonpack.StreamUtils;
27 import com.google.common.collect.HashMultimap;
28 import com.google.common.collect.Multimaps;
37 import javax.annotation.Nonnull;
38 import java.util.List;
39 import java.util.stream.Collectors;
71 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return
74 final List<ITerm> l_arguments =
CCommon.
flatten( p_argument ).collect( Collectors.toList() );
75 if ( ( l_arguments.size() > 0 ) && ( l_arguments.size() % 2 == 1 ) )
78 final HashMultimap<Object, Object> l_map = HashMultimap.create();
79 StreamUtils.windowed( l_arguments.stream(), 2 ).forEach( i -> l_map.put( i.get( 0 ).raw(), i.get( 1 ).raw() ) );
80 p_return.add(
CRawTerm.
from( p_parallel ? Multimaps.synchronizedSetMultimap( l_map ) : l_map ) );
base class of build-in actions for setting name by package/classname (without prefix character) ...
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
common structure for execution definition
execution context with local data
static Stream< ITerm > flatten( @Nonnull final Collection<? extends ITerm > p_terms)
flat term-in-term collection into a straight term list
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