@Test public void testToClosedRange() { Range<Long> r1 = toClosedRange(Range.closed(5L, 10L)); Range<Long> r2 = toClosedRange(Range.closedOpen(5L, 11L)); Range<Long> r3 = toClosedRange(Range.openClosed(4L, 10L)); Range<Long> r4 = toClosedRange(Range.open(4L, 11L)); assertEquals(BoundType.CLOSED, r1.lowerBoundType()); assertThat(r1.lowerEndpoint(), equalTo(5L)); assertEquals(BoundType.CLOSED, r1.upperBoundType()); assertThat(r1.upperEndpoint(), equalTo(10L)); assertEquals(BoundType.CLOSED, r2.lowerBoundType()); assertThat(r2.lowerEndpoint(), equalTo(5L)); assertEquals(BoundType.CLOSED, r2.upperBoundType()); assertThat(r2.upperEndpoint(), equalTo(10L)); assertEquals(BoundType.CLOSED, r3.lowerBoundType()); assertThat(r3.lowerEndpoint(), equalTo(5L)); assertEquals(BoundType.CLOSED, r3.upperBoundType()); assertThat(r3.upperEndpoint(), equalTo(10L)); assertEquals(BoundType.CLOSED, r4.lowerBoundType()); assertThat(r4.lowerEndpoint(), equalTo(5L)); assertEquals(BoundType.CLOSED, r4.upperBoundType()); assertThat(r4.upperEndpoint(), equalTo(10L)); }
@VisibleForTesting static Range<Long> toClosedRange(Range<Long> r) { BoundType lowerType = r.lowerBoundType(); Long lowerBound = r.lowerEndpoint(); BoundType upperType = r.upperBoundType(); Long upperBound = r.upperEndpoint(); return Range.range( lowerType == BoundType.CLOSED ? lowerBound : lowerBound + 1, BoundType.CLOSED, upperType == BoundType.CLOSED ? upperBound : upperBound - 1, BoundType.CLOSED); }
SearchRoutePoliciesAnswerer extends Answerer { @VisibleForTesting static Range<Long> toClosedRange(Range<Long> r) { BoundType lowerType = r.lowerBoundType(); Long lowerBound = r.lowerEndpoint(); BoundType upperType = r.upperBoundType(); Long upperBound = r.upperEndpoint(); return Range.range( lowerType == BoundType.CLOSED ? lowerBound : lowerBound + 1, BoundType.CLOSED, upperType == BoundType.CLOSED ? upperBound : upperBound - 1, BoundType.CLOSED); } }
SearchRoutePoliciesAnswerer extends Answerer { @VisibleForTesting static Range<Long> toClosedRange(Range<Long> r) { BoundType lowerType = r.lowerBoundType(); Long lowerBound = r.lowerEndpoint(); BoundType upperType = r.upperBoundType(); Long upperBound = r.upperEndpoint(); return Range.range( lowerType == BoundType.CLOSED ? lowerBound : lowerBound + 1, BoundType.CLOSED, upperType == BoundType.CLOSED ? upperBound : upperBound - 1, BoundType.CLOSED); } SearchRoutePoliciesAnswerer(SearchRoutePoliciesQuestion question, IBatfish batfish); }
SearchRoutePoliciesAnswerer extends Answerer { @VisibleForTesting static Range<Long> toClosedRange(Range<Long> r) { BoundType lowerType = r.lowerBoundType(); Long lowerBound = r.lowerEndpoint(); BoundType upperType = r.upperBoundType(); Long upperBound = r.upperEndpoint(); return Range.range( lowerType == BoundType.CLOSED ? lowerBound : lowerBound + 1, BoundType.CLOSED, upperType == BoundType.CLOSED ? upperBound : upperBound - 1, BoundType.CLOSED); } SearchRoutePoliciesAnswerer(SearchRoutePoliciesQuestion question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); static TableMetadata metadata(); }
SearchRoutePoliciesAnswerer extends Answerer { @VisibleForTesting static Range<Long> toClosedRange(Range<Long> r) { BoundType lowerType = r.lowerBoundType(); Long lowerBound = r.lowerEndpoint(); BoundType upperType = r.upperBoundType(); Long upperBound = r.upperEndpoint(); return Range.range( lowerType == BoundType.CLOSED ? lowerBound : lowerBound + 1, BoundType.CLOSED, upperType == BoundType.CLOSED ? upperBound : upperBound - 1, BoundType.CLOSED); } SearchRoutePoliciesAnswerer(SearchRoutePoliciesQuestion question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); static TableMetadata metadata(); static final String COL_NODE; static final String COL_POLICY_NAME; static final String COL_INPUT_ROUTE; static final String COL_ACTION; static final String COL_OUTPUT_ROUTE; static final String COL_DIFF; }