class IncludesFunction extends BaseFEELFunction {

    public FEELFnResult<Boolean> invoke(@ParameterName( "range" ) Range range, @ParameterName( "value" ) Comparable value) {
        if ( value == null ) {
            return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "value", "cannot be null"));
        }
        if ( range == null ) {
            return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range", "cannot be null"));
        }
        try {
            boolean result = (range.getLowEndPoint().compareTo(value) < 0 && range.getHighEndPoint().compareTo(value) > 0) ||
                             (range.getLowEndPoint().compareTo(value) == 0 && range.getLowBoundary() == RangeBoundary.CLOSED) ||
                             (range.getHighEndPoint().compareTo(value) == 0 && range.getHighBoundary() == RangeBoundary.CLOSED);
            return FEELFnResult.ofResult( result );
        } catch( Exception e ) {
            // values are not comparable
            return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "value", "cannot be compared to range"));
        }
    }

    public  IncludesFunction();

}