@Test public void testLegalRightChildPrefix() { Prefix parent = Prefix.parse("1.0.0.0/8"); assertFalse(legalRightChildPrefix(parent, parent)); Prefix child = Prefix.parse("1.128.0.0/9"); assertTrue(legalRightChildPrefix(parent, child)); child = Prefix.parse("1.0.0.0/9"); assertFalse(legalRightChildPrefix(parent, child)); child = Prefix.parse("1.255.255.0/24"); assertTrue(legalRightChildPrefix(parent, child)); }
@VisibleForTesting static boolean legalRightChildPrefix(Prefix parentPrefix, Prefix childPrefix) { return parentPrefix.containsPrefix(childPrefix) && parentPrefix.getPrefixLength() < childPrefix.getPrefixLength() && Ip.getBitAtPosition(childPrefix.getStartIp(), parentPrefix.getPrefixLength()); }
PrefixTrieMultiMap implements Serializable { @VisibleForTesting static boolean legalRightChildPrefix(Prefix parentPrefix, Prefix childPrefix) { return parentPrefix.containsPrefix(childPrefix) && parentPrefix.getPrefixLength() < childPrefix.getPrefixLength() && Ip.getBitAtPosition(childPrefix.getStartIp(), parentPrefix.getPrefixLength()); } }
PrefixTrieMultiMap implements Serializable { @VisibleForTesting static boolean legalRightChildPrefix(Prefix parentPrefix, Prefix childPrefix) { return parentPrefix.containsPrefix(childPrefix) && parentPrefix.getPrefixLength() < childPrefix.getPrefixLength() && Ip.getBitAtPosition(childPrefix.getStartIp(), parentPrefix.getPrefixLength()); } PrefixTrieMultiMap(Prefix prefix);  PrefixTrieMultiMap(); }
PrefixTrieMultiMap implements Serializable { @VisibleForTesting static boolean legalRightChildPrefix(Prefix parentPrefix, Prefix childPrefix) { return parentPrefix.containsPrefix(childPrefix) && parentPrefix.getPrefixLength() < childPrefix.getPrefixLength() && Ip.getBitAtPosition(childPrefix.getStartIp(), parentPrefix.getPrefixLength()); } PrefixTrieMultiMap(Prefix prefix);  PrefixTrieMultiMap(); void traverseEntries(BiConsumer<Prefix, Set<T>> consumer); R fold(FoldOperator<T, R> operator); @Override boolean equals(Object o); @Nonnull Set<T> get(Prefix p); @Nonnull Set<T> getAllElements(); @Override int hashCode(); @Nonnull Set<T> longestPrefixMatch(Ip address); @Nonnull Set<T> longestPrefixMatch(Ip address, int maxPrefixLength); boolean put(Prefix p, T e); boolean putAll(Prefix p, Collection<T> elements); boolean remove(Prefix p, T e); boolean replaceAll(Prefix p, T e); void clear(); }
PrefixTrieMultiMap implements Serializable { @VisibleForTesting static boolean legalRightChildPrefix(Prefix parentPrefix, Prefix childPrefix) { return parentPrefix.containsPrefix(childPrefix) && parentPrefix.getPrefixLength() < childPrefix.getPrefixLength() && Ip.getBitAtPosition(childPrefix.getStartIp(), parentPrefix.getPrefixLength()); } PrefixTrieMultiMap(Prefix prefix);  PrefixTrieMultiMap(); void traverseEntries(BiConsumer<Prefix, Set<T>> consumer); R fold(FoldOperator<T, R> operator); @Override boolean equals(Object o); @Nonnull Set<T> get(Prefix p); @Nonnull Set<T> getAllElements(); @Override int hashCode(); @Nonnull Set<T> longestPrefixMatch(Ip address); @Nonnull Set<T> longestPrefixMatch(Ip address, int maxPrefixLength); boolean put(Prefix p, T e); boolean putAll(Prefix p, Collection<T> elements); boolean remove(Prefix p, T e); boolean replaceAll(Prefix p, T e); void clear();  }