@Test public void testThreeDiscreteRangeAnd() { Range<Long> range1 = new Range<>(2l, 10l); Range<Long> raneg2 = new Range<>(3l, 8l); Range<Long> range3 = new Range<>(7l, 8l); RangeList<Long> threeAndRange = rangeOperations.and(range1, rangeOperations.and(raneg2, range3).getRanges().get(0)); assertNotNull(threeAndRange); }
public RangeList<T> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }
RangeOperations { public RangeList<T> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } } }
RangeOperations { public RangeList<T> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }  }
RangeOperations { public RangeList<T> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.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> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.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);  }