@Test public void addPrefixRangeTest() { PrefixRange range = PrefixRange.fromString("10.10.10.0/32:16-24"); _ps = new PrefixSpace(range); assertThat(_ps.containsPrefixRange(range), equalTo(true)); assertThat( "Shorter prefixes not included", _ps.containsPrefix(Prefix.parse("10.10.10.0/15")), equalTo(false)); assertThat( "Shortest prefix is included", _ps.containsPrefix(Prefix.parse("10.10.10.0/16")), equalTo(true)); assertThat( "Longest prefix is included", _ps.containsPrefix(Prefix.parse("10.10.10.0/24")), equalTo(true)); assertThat( "Longer prefixes not included", _ps.containsPrefix(Prefix.parse("10.10.10.0/25")), equalTo(false)); assertThat( "Prefixes with mismatch in masked bits not included", _ps.containsPrefix(Prefix.parse("10.10.11.0/24")), equalTo(false)); assertThat( "Prefixes with mismatch in unmasked bits included", _ps.containsPrefix(Prefix.parse("10.10.10.255/24")), equalTo(true)); }
public void addPrefixRange(PrefixRange prefixRange) { _trie.addPrefixRange(prefixRange); }
PrefixSpace implements Serializable { public void addPrefixRange(PrefixRange prefixRange) { _trie.addPrefixRange(prefixRange); } }
PrefixSpace implements Serializable { public void addPrefixRange(PrefixRange prefixRange) { _trie.addPrefixRange(prefixRange); } PrefixSpace(); @JsonCreator  PrefixSpace(Iterable<PrefixRange> prefixRanges);  PrefixSpace(PrefixRange... prefixRanges); }
PrefixSpace implements Serializable { public void addPrefixRange(PrefixRange prefixRange) { _trie.addPrefixRange(prefixRange); } PrefixSpace(); @JsonCreator  PrefixSpace(Iterable<PrefixRange> prefixRanges);  PrefixSpace(PrefixRange... prefixRanges); void addPrefix(Prefix prefix); void addPrefixRange(PrefixRange prefixRange); void addSpace(PrefixSpace prefixSpace); boolean containsPrefix(Prefix prefix); boolean containsPrefixRange(PrefixRange prefixRange); @Override boolean equals(Object obj); Set<PrefixRange> getPrefixRanges(); @Override int hashCode(); PrefixSpace intersection(PrefixSpace intersectSpace); @JsonIgnore boolean isEmpty(); boolean overlaps(PrefixSpace intersectSpace); @Override String toString(); }
PrefixSpace implements Serializable { public void addPrefixRange(PrefixRange prefixRange) { _trie.addPrefixRange(prefixRange); } PrefixSpace(); @JsonCreator  PrefixSpace(Iterable<PrefixRange> prefixRanges);  PrefixSpace(PrefixRange... prefixRanges); void addPrefix(Prefix prefix); void addPrefixRange(PrefixRange prefixRange); void addSpace(PrefixSpace prefixSpace); boolean containsPrefix(Prefix prefix); boolean containsPrefixRange(PrefixRange prefixRange); @Override boolean equals(Object obj); Set<PrefixRange> getPrefixRanges(); @Override int hashCode(); PrefixSpace intersection(PrefixSpace intersectSpace); @JsonIgnore boolean isEmpty(); boolean overlaps(PrefixSpace intersectSpace); @Override String toString();  }