public FEELFnResult<Object> invoke(@ParameterName("list") List list) { if ( list == null || list.isEmpty() ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null or empty")); } else { try { return FEELFnResult.ofResult( Collections.min( list ) ); } catch (ClassCastException e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "contains items that are not comparable")); } } }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "number" ) BigDecimal number) { if ( number == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "number", "cannot be null" ) ); } return FEELFnResult.ofResult( new BigDecimal( Math.exp( number.doubleValue() ), MathContext.DECIMAL128 ) ); } }
public FEELFnResult<List<Object>> invoke(@ParameterName("list") List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } // spec requires us to return a new list final List<Object> result = new ArrayList<>( list ); Collections.reverse( result ); return FEELFnResult.ofResult( result ); } }
public FEELFnResult<Boolean> invoke(@ParameterName("string") String string, @ParameterName("match") String match) { if ( string == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "string", "cannot be null")); } if ( match == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "match", "cannot be null")); } return FEELFnResult.ofResult(string.contains(match)); } }
public FEELFnResult<Boolean> invoke(@ParameterName("string") String string, @ParameterName("match") String match) { if ( string == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "string", "cannot be null")); } if ( match == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "match", "cannot be null")); } return FEELFnResult.ofResult( string.startsWith( match ) ); }
public FEELFnResult<Object> invoke(@ParameterName("m") Object m, @ParameterName("key") String key) { if (m == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "m", "cannot be null")); } else if (!(m instanceof Map)) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "m", "is not a context")); } else { return FEELFnResult.ofResult(((Map<?, ?>) m).get(key)); } } }
public FEELFnResult<Boolean> invoke(@ParameterName( "b" ) Object[] list) { if ( list == null ) { // Arrays.asList does not accept null as parameter return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "b", "cannot be null")); } return invoke( Arrays.asList( list ) ); } }
public FEELFnResult<Boolean> invoke(@ParameterName( "b" ) Object[] list) { if ( list == null ) { // Arrays.asList does not accept null as parameter return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "b", "cannot be null")); } return invoke( Arrays.asList( list ) ); } }
public FEELFnResult<Boolean> invoke(@ParameterName( "number" ) BigDecimal number) { if ( number == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "number", "cannot be null" ) ); } if ( number.remainder( BigDecimal.ONE ).signum() != 0 ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "number", "cannot have non-zero fractional part" ) ); } return FEELFnResult.ofResult( BigDecimal.ZERO.compareTo( number.remainder(TWO) ) != 0); } }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "n" ) BigDecimal n) { if ( n == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "n", "cannot be null")); } return FEELFnResult.ofResult( n.setScale( 0, BigDecimal.ROUND_CEILING ) ); } }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "n" ) BigDecimal n) { if ( n == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "n", "cannot be null")); } return FEELFnResult.ofResult( n.setScale( 0, BigDecimal.ROUND_FLOOR ) ); } }
public FEELFnResult<Boolean> invoke(@ParameterName( "number" ) BigDecimal number) { if ( number == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "number", "cannot be null" ) ); } if ( number.remainder( BigDecimal.ONE ).signum() != 0 ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "number", "cannot have non-zero fractional part" ) ); } return FEELFnResult.ofResult( BigDecimal.ZERO.compareTo( number.remainder(TWO) ) == 0); } }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "n" ) Object[] list) { if ( list == null ) { // Arrays.asList does not accept null as parameter return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "n", "cannot be null")); } return invoke( Arrays.asList( list ) ); } }
public FEELFnResult<Object> invoke(@ParameterName("c") Object[] list) { if ( list == null || list.length == 0 ) { // Arrays.asList does not accept null as parameter return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "c", "cannot be null or empty")); } return invoke( Arrays.asList( list ) ); }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "c" ) Object[] list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "c", "cannot be null")); } return invoke( Arrays.asList( list ) ); } }
public FEELFnResult<BigDecimal> invoke(@ParameterName( "number" ) BigDecimal number) { if ( number == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "value", "cannot be null")); } return FEELFnResult.ofResult( number.abs() ); } }
public FEELFnResult<BigDecimal> invoke(@ParameterName("list") Object sole) { if ( sole == null ) { return FEELFnResult.ofResult( null ); } else if( EvalHelper.getBigDecimalOrNull( sole ) == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( FEELEvent.Severity.ERROR, "list", "the value can not be converted to a number" ) ); } return FEELFnResult.ofError(new InvalidParametersEvent(FEELEvent.Severity.ERROR, "list", "sample standard deviation of a single sample is undefined")); }
public FEELFnResult<TemporalAccessor> invoke(@ParameterName( "from" ) TemporalAccessor date) { if ( date == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "cannot be null")); } try { return FEELFnResult.ofResult( LocalDate.from( date ) ); } catch (DateTimeException e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "date-parsing exception", e)); } } }
public FEELFnResult<Boolean> invoke(@ParameterName("negand") Object negand) { if ( negand != null && !(negand instanceof Boolean) ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "negand", "must be a boolean value" ) ); } return FEELFnResult.ofResult( negand == null ? null : !((Boolean) negand) ); }
public FEELFnResult<Boolean> invoke(@ParameterName("list") List list, @ParameterName("element") Object element) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } else { return FEELFnResult.ofResult( list.contains( element ) ); } }