@Test public void invokeParamIsNull() { FunctionTestUtil.assertResultError( overlapsFunction.invoke((Range) null, (Range) new RangeImpl() ), InvalidParametersEvent.class ); FunctionTestUtil.assertResultError( overlapsFunction.invoke((Range) new RangeImpl(), (Range) null ), InvalidParametersEvent.class ); }
public FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2) { if (range1 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be null")); } if (range2 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range2", "cannot be null")); } try { boolean result = (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) > 0 || (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) == 0 && range1.getHighBoundary() == RangeBoundary.CLOSED && range2.getLowBoundary() == RangeBoundary.CLOSED)) && (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) < 0 || (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) == 0 && range1.getLowBoundary() == RangeBoundary.CLOSED && range2.getHighBoundary() == RangeBoundary.CLOSED)); return FEELFnResult.ofResult(result); } catch (Exception e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be compared to range2")); } }
OverlapsFunction extends BaseFEELFunction { public FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2) { if (range1 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be null")); } if (range2 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range2", "cannot be null")); } try { boolean result = (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) > 0 || (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) == 0 && range1.getHighBoundary() == RangeBoundary.CLOSED && range2.getLowBoundary() == RangeBoundary.CLOSED)) && (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) < 0 || (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) == 0 && range1.getLowBoundary() == RangeBoundary.CLOSED && range2.getHighBoundary() == RangeBoundary.CLOSED)); return FEELFnResult.ofResult(result); } catch (Exception e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be compared to range2")); } } }
OverlapsFunction extends BaseFEELFunction { public FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2) { if (range1 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be null")); } if (range2 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range2", "cannot be null")); } try { boolean result = (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) > 0 || (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) == 0 && range1.getHighBoundary() == RangeBoundary.CLOSED && range2.getLowBoundary() == RangeBoundary.CLOSED)) && (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) < 0 || (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) == 0 && range1.getLowBoundary() == RangeBoundary.CLOSED && range2.getHighBoundary() == RangeBoundary.CLOSED)); return FEELFnResult.ofResult(result); } catch (Exception e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be compared to range2")); } } OverlapsFunction(); }
OverlapsFunction extends BaseFEELFunction { public FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2) { if (range1 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be null")); } if (range2 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range2", "cannot be null")); } try { boolean result = (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) > 0 || (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) == 0 && range1.getHighBoundary() == RangeBoundary.CLOSED && range2.getLowBoundary() == RangeBoundary.CLOSED)) && (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) < 0 || (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) == 0 && range1.getLowBoundary() == RangeBoundary.CLOSED && range2.getHighBoundary() == RangeBoundary.CLOSED)); return FEELFnResult.ofResult(result); } catch (Exception e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be compared to range2")); } } OverlapsFunction(); FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2); }
OverlapsFunction extends BaseFEELFunction { public FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2) { if (range1 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be null")); } if (range2 == null) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range2", "cannot be null")); } try { boolean result = (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) > 0 || (range1.getHighEndPoint().compareTo(range2.getLowEndPoint()) == 0 && range1.getHighBoundary() == RangeBoundary.CLOSED && range2.getLowBoundary() == RangeBoundary.CLOSED)) && (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) < 0 || (range1.getLowEndPoint().compareTo(range2.getHighEndPoint()) == 0 && range1.getLowBoundary() == RangeBoundary.CLOSED && range2.getHighBoundary() == RangeBoundary.CLOSED)); return FEELFnResult.ofResult(result); } catch (Exception e) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "range1", "cannot be compared to range2")); } } OverlapsFunction(); FEELFnResult<Boolean> invoke(@ParameterName("range1") Range range1, @ParameterName("range2") Range range2); static final OverlapsFunction INSTANCE; }