24 package org.lightjason.agentspeak.grammar;
26 import com.codepoetics.protonpack.StreamUtils;
32 import javax.annotation.Nonnull;
33 import java.util.AbstractMap;
34 import java.util.Collection;
35 import java.util.Collections;
36 import java.util.List;
38 import java.util.stream.Collectors;
39 import java.util.stream.Stream;
80 Double.POSITIVE_INFINITY,
81 Double.NEGATIVE_INFINITY,
87 AbstractMap.SimpleImmutableEntry::new
88 ).collect( Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue ) ) );
107 @Nonnull
final Collection<IExpression> p_righthandside
110 if ( ( !p_operator.isBinary() ) || ( !p_operator.isLogical() ) )
113 final List<IExpression> l_expression = Stream.concat( Stream.of( p_lefthandside ), p_righthandside.stream() ).collect( Collectors.toList() );
116 if ( l_expression.size() == 1 )
117 return l_expression.get( 0 );
121 while ( l_expression.size() > 1 )
122 l_expression.add( 0,
new CBinary( p_operator, l_expression.remove( 0 ), l_expression.remove( 0 ) ) );
124 return l_expression.get( 0 );
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
logical binary expression
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
class for any helper calls
static final Map< String, Double > NUMERICCONSTANT
numeric constant values - infinity is defined manually