@Test public void testInPrefixRange() { PrefixRange range = new PrefixRange(Prefix.parse("1.0.0.0/8"), new SubRange(16, 24)); BDD rangeBdd = _bddPrefix.inPrefixRange(range); BDD notRangeBdd = rangeBdd.not(); Ip matchingIp = Ip.parse("1.1.1.1"); Ip nonMatchingIp = Ip.parse("2.2.2.2"); BDD matchingPrefix8 = _bddPrefix.isPrefix(Prefix.create(matchingIp, 8)); BDD matchingPrefix24 = _bddPrefix.isPrefix(Prefix.create(matchingIp, 24)); BDD matchingPrefix32 = _bddPrefix.isPrefix(matchingIp.toPrefix()); BDD nonMatchingPrefix24 = _bddPrefix.isPrefix(Prefix.create(nonMatchingIp, 24)); assertTrue(matchingPrefix24.imp(rangeBdd).isOne()); assertTrue(matchingPrefix32.imp(notRangeBdd).isOne()); assertTrue(matchingPrefix8.imp(notRangeBdd).isOne()); assertTrue(nonMatchingPrefix24.imp(notRangeBdd).isOne()); }
public @Nonnull BDD inPrefixRange(PrefixRange prefixRange) { Prefix p = prefixRange.getPrefix(); BDD prefixMatch = firstBitsEqual(p.getStartIp(), p.getPrefixLength()); SubRange r = prefixRange.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = _prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); }
BDDPrefix { public @Nonnull BDD inPrefixRange(PrefixRange prefixRange) { Prefix p = prefixRange.getPrefix(); BDD prefixMatch = firstBitsEqual(p.getStartIp(), p.getPrefixLength()); SubRange r = prefixRange.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = _prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } }
BDDPrefix { public @Nonnull BDD inPrefixRange(PrefixRange prefixRange) { Prefix p = prefixRange.getPrefix(); BDD prefixMatch = firstBitsEqual(p.getStartIp(), p.getPrefixLength()); SubRange r = prefixRange.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = _prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } BDDPrefix(BDDInteger ip, BDDInteger prefixLength); }
BDDPrefix { public @Nonnull BDD inPrefixRange(PrefixRange prefixRange) { Prefix p = prefixRange.getPrefix(); BDD prefixMatch = firstBitsEqual(p.getStartIp(), p.getPrefixLength()); SubRange r = prefixRange.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = _prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } BDDPrefix(BDDInteger ip, BDDInteger prefixLength); @Override boolean equals(Object o); @Override int hashCode(); @Nonnull BDDFactory getFactory(); @Nonnull BDDInteger getIp(); @Nonnull BDDInteger getPrefixLength(); @Nonnull BDD inPrefixRange(PrefixRange prefixRange); @Nonnull BDD isPrefix(Prefix prefix); @Nonnull BDD permittedByRouteFilterList(RouteFilterList routeFilterList); }
BDDPrefix { public @Nonnull BDD inPrefixRange(PrefixRange prefixRange) { Prefix p = prefixRange.getPrefix(); BDD prefixMatch = firstBitsEqual(p.getStartIp(), p.getPrefixLength()); SubRange r = prefixRange.getLengthRange(); int lower = r.getStart(); int upper = r.getEnd(); BDD lenMatch = _prefixLength.range(lower, upper); return lenMatch.and(prefixMatch); } BDDPrefix(BDDInteger ip, BDDInteger prefixLength); @Override boolean equals(Object o); @Override int hashCode(); @Nonnull BDDFactory getFactory(); @Nonnull BDDInteger getIp(); @Nonnull BDDInteger getPrefixLength(); @Nonnull BDD inPrefixRange(PrefixRange prefixRange); @Nonnull BDD isPrefix(Prefix prefix); @Nonnull BDD permittedByRouteFilterList(RouteFilterList routeFilterList);  }