@Test public void filterRows() { Filter filter = new Filter("col >= 42"); Rows rows = new Rows(); rows.add(Row.builder().put("col", null).build()); rows.add(Row.builder().put("col", 41).build()); rows.add(Row.builder().put("col", 42).build()); rows.add(Row.builder().put("col", 43).build()); Multiset<Row> filteredRows = FilterTableAnswerer.filterRows(filter, rows.getData()); assertThat( filteredRows, equalTo( new ImmutableMultiset.Builder<Row>() .add(Row.builder().put("col", 42).build()) .add(Row.builder().put("col", 43).build()) .build())); }
@VisibleForTesting static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) { return inputRows.stream() .filter(filter::matches) .collect(ImmutableMultiset.toImmutableMultiset()); }
FilterTableAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) { return inputRows.stream() .filter(filter::matches) .collect(ImmutableMultiset.toImmutableMultiset()); } }
FilterTableAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) { return inputRows.stream() .filter(filter::matches) .collect(ImmutableMultiset.toImmutableMultiset()); } FilterTableAnswerer(Question question, IBatfish batfish); }
FilterTableAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) { return inputRows.stream() .filter(filter::matches) .collect(ImmutableMultiset.toImmutableMultiset()); } FilterTableAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
FilterTableAnswerer extends Answerer { @VisibleForTesting static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) { return inputRows.stream() .filter(filter::matches) .collect(ImmutableMultiset.toImmutableMultiset()); } FilterTableAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }