public void addFilter(List<Filter> filters) { filterListBase.addFilterLists(filters); }
public FilterListBase(List<Filter> filters) { reversed = checkAndGetReversed(filters, reversed); this.filters = new ArrayList<>(filters); }
@Override public boolean filterAllRemaining() throws IOException { return filterListBase.filterAllRemaining(); }
@Override public String toString() { int endIndex = this.size() < MAX_LOG_FILTERS ? this.size() : MAX_LOG_FILTERS; return formatLogFilters(filters.subList(0, endIndex)); }
@Override public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException { return filterListBase.filterRowKey(rowKey, offset, length); }
@Override public boolean filterRow() throws IOException { return filterListBase.filterRow(); }
@Override public Cell getNextCellHint(Cell currentCell) throws IOException { return this.filterListBase.getNextCellHint(currentCell); }
/** * Get the filters. * @return filters */ public List<Filter> getFilters() { return filterListBase.getFilters(); }
@Override public ReturnCode filterKeyValue(final Cell c) throws IOException { return filterCell(c); }
/** * Filters that never filter by modifying the returned List of Cells can inherit this * implementation that does nothing. {@inheritDoc} */ @Override public void filterRowCells(List<Cell> cells) throws IOException { filterListBase.filterRowCells(cells); }
@Override public boolean filterRowKey(Cell firstRowCell) throws IOException { return filterListBase.filterRowKey(firstRowCell); }
@Override public String toString() { int endIndex = this.size() < MAX_LOG_FILTERS ? this.size() : MAX_LOG_FILTERS; return formatLogFilters(filters.subList(0, endIndex)); }
@Override public boolean filterRow() throws IOException { if (isEmpty()) { return super.filterRow(); } for (int i = 0, n = filters.size(); i < n; i++) { Filter filter = filters.get(i); if (filter.filterRow()) { return true; } } return false; }
@Override public Cell getNextCellHint(Cell currentCell) throws IOException { if (isEmpty()) { return super.getNextCellHint(currentCell); } Cell minKeyHint = null; // If any condition can pass, we need to keep the min hint for (int i = 0, n = filters.size(); i < n; i++) { if (filters.get(i).filterAllRemaining()) { continue; } Cell curKeyHint = filters.get(i).getNextCellHint(currentCell); if (curKeyHint == null) { // If we ever don't have a hint and this is must-pass-one, then no hint return null; } // If this is the first hint we find, set it if (minKeyHint == null) { minKeyHint = curKeyHint; continue; } if (this.compareCell(minKeyHint, curKeyHint) > 0) { minKeyHint = curKeyHint; } } return minKeyHint; }
/** * @return The filter serialized using pb */ @Override public byte[] toByteArray() throws IOException { FilterProtos.FilterList.Builder builder = FilterProtos.FilterList.newBuilder(); builder.setOperator(FilterProtos.FilterList.Operator.valueOf(operator.name())); ArrayList<Filter> filters = filterListBase.getFilters(); for (int i = 0, n = filters.size(); i < n; i++) { builder.addFilters(ProtobufUtil.toFilter(filters.get(i))); } return builder.build().toByteArray(); }
@Override public ReturnCode filterCell(final Cell c) throws IOException { return filterListBase.filterCell(c); }
/** * Filters that never filter by modifying the returned List of Cells can inherit this * implementation that does nothing. {@inheritDoc} */ @Override public void filterRowCells(List<Cell> cells) throws IOException { filterListBase.filterRowCells(cells); }
@Override public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException { if (isEmpty()) { return super.filterRowKey(rowKey, offset, length); } boolean retVal = false; for (int i = 0, n = filters.size(); i < n; i++) { Filter filter = filters.get(i); if (filter.filterAllRemaining() || filter.filterRowKey(rowKey, offset, length)) { retVal = true; } } return retVal; }
@Override public String toString() { int endIndex = this.size() < MAX_LOG_FILTERS ? this.size() : MAX_LOG_FILTERS; return formatLogFilters(filters.subList(0, endIndex)); }
@Override public boolean filterAllRemaining() throws IOException { if (isEmpty()) { return super.filterAllRemaining(); } for (int i = 0, n = filters.size(); i < n; i++) { if (filters.get(i).filterAllRemaining()) { return true; } } return false; }