@Test public void testOrOperatorWithReverseRange() { Range<Long> range1 = new Range<>(10l, 12l); Range<Long> range2 = new Range<>(7l, 11l); RangeList<Long> result = rangeOperations.or(range1, range2); RangeList<Long> expected = new RangeList<>(); expected.addAllRanges(new Range<>(7l, 12l)); assertEquals(result, expected); }
public RangeList<T> or(Range<T> r1, Range<T> r2) { RangeList<T> rangeList = new RangeList<>(); if (checkDiscrete(r1, r2)) { rangeList.addAllRanges(r1, r2); return rangeList; } else { T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r1.getMin() : r2.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r2.getMax() : r1.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }
RangeOperations { public RangeList<T> or(Range<T> r1, Range<T> r2) { RangeList<T> rangeList = new RangeList<>(); if (checkDiscrete(r1, r2)) { rangeList.addAllRanges(r1, r2); return rangeList; } else { T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r1.getMin() : r2.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r2.getMax() : r1.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } } }
RangeOperations { public RangeList<T> or(Range<T> r1, Range<T> r2) { RangeList<T> rangeList = new RangeList<>(); if (checkDiscrete(r1, r2)) { rangeList.addAllRanges(r1, r2); return rangeList; } else { T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r1.getMin() : r2.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r2.getMax() : r1.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }  }
RangeOperations { public RangeList<T> or(Range<T> r1, Range<T> r2) { RangeList<T> rangeList = new RangeList<>(); if (checkDiscrete(r1, r2)) { rangeList.addAllRanges(r1, r2); return rangeList; } else { T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r1.getMin() : r2.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r2.getMax() : r1.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }  RangeList<T> and(Range<T> r1, Range<T> r2); RangeList<T> or(Range<T> r1, Range<T> r2); RangeNode<T> processFilterItem(FilterItem filterItem, String table, String columnName); RangeNode<T> rangeNodeOr(RangeNode<T> left, RangeNode<T> right); RangeNode<T> rangeNodeAnd(RangeNode<T> left, RangeNode<T> right); @SuppressWarnings("unchecked") RangeNode<T> processRangeNodes(RangeNode<?> left, RangeNode<?> right, LogicalOperation logicalOperation); abstract T getValue(String valueString); abstract T getMinValue(); abstract T getMaxValue(); abstract T add(T value, int step); abstract T subtract(T value, int step); }
RangeOperations { public RangeList<T> or(Range<T> r1, Range<T> r2) { RangeList<T> rangeList = new RangeList<>(); if (checkDiscrete(r1, r2)) { rangeList.addAllRanges(r1, r2); return rangeList; } else { T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r1.getMin() : r2.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r2.getMax() : r1.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }  RangeList<T> and(Range<T> r1, Range<T> r2); RangeList<T> or(Range<T> r1, Range<T> r2); RangeNode<T> processFilterItem(FilterItem filterItem, String table, String columnName); RangeNode<T> rangeNodeOr(RangeNode<T> left, RangeNode<T> right); RangeNode<T> rangeNodeAnd(RangeNode<T> left, RangeNode<T> right); @SuppressWarnings("unchecked") RangeNode<T> processRangeNodes(RangeNode<?> left, RangeNode<?> right, LogicalOperation logicalOperation); abstract T getValue(String valueString); abstract T getMinValue(); abstract T getMaxValue(); abstract T add(T value, int step); abstract T subtract(T value, int step);  }