@Override public boolean hasBound(Bound b) { if (isEmpty()) return false; return restrictions.lastRestriction().hasBound(b); }
@Override public boolean hasBound(Bound b) { if (isEmpty()) return false; return restrictions.lastRestriction().hasBound(b); }
@Override public boolean hasBound(Bound b) { if (isEmpty()) return false; return restrictions.lastRestriction().hasBound(b); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }