24 package org.lightjason.agentspeak.action.builtin.string;
34 import javax.annotation.Nonnegative;
35 import javax.annotation.Nonnull;
36 import java.util.List;
37 import java.util.stream.Collectors;
38 import java.util.stream.IntStream;
70 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
75 .map(
ITerm::<String>raw )
76 .collect( Collectors.toList() );
78 if ( l_strings.size() < 2 )
85 .map(
ITerm::<Number>raw )
86 .mapToDouble( Number::doubleValue )
88 .collect( Collectors.toList() );
91 IntStream.range( l_weights.size(), 3 ).forEach( i -> l_weights.add( 1.0 ) );
96 .mapToDouble( i ->
CCommon.
levenshtein( l_strings.get( 0 ), i, l_weights.get( 1 ), l_weights.get( 1 ), l_weights.get( 2 ) ) )
99 .forEach( p_return::add );
static final long serialVersionUID
serial id
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
final int minimalArgumentNumber()
minimum number of arguments
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
calculates the levenshtein distance.
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
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
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 double levenshtein( @Nonnull final String p_first, @Nonnull final String p_second, final double p_insertweight, final double p_replaceweight, final double p_deleteweight)
calculates the levenshtein distance
term structure for simple datatypes