@Test public void testSupersetOf() { IpWildcard wc1 = IpWildcard.parse("1.2.0.0/16"); IpWildcard wc2 = IpWildcard.parse("1.2.3.0/24"); assertTrue("IpWildcard.supersetOf should not be strict", wc1.supersetOf(wc1)); assertTrue("wc1 should be a superset of wc2", wc1.supersetOf(wc2)); assertFalse("wc2 should not be a superset of wc1", wc2.supersetOf(wc1)); wc1 = IpWildcard.ipWithWildcardMask(Ip.create(0x12005600L), Ip.create(0xFF00FF00L).inverted()); wc2 = IpWildcard.ipWithWildcardMask(Ip.create(0x12345600L), Ip.create(0xFFFFFF00L).inverted()); assertTrue("wc1 should be a superset of wc2", wc1.supersetOf(wc2)); assertFalse("wc2 should not be a superset of wc1", wc2.supersetOf(wc1)); }
public boolean supersetOf(IpWildcard other) { long wildToThis = _wildcardMask; long wildToOther = other._wildcardMask; long differentIpBits = _ip.asLong() ^ other._ip.asLong(); return (wildToThis & wildToOther) == wildToOther && (wildToThis & differentIpBits) == differentIpBits; }
IpWildcard implements Serializable, Comparable<IpWildcard> { public boolean supersetOf(IpWildcard other) { long wildToThis = _wildcardMask; long wildToOther = other._wildcardMask; long differentIpBits = _ip.asLong() ^ other._ip.asLong(); return (wildToThis & wildToOther) == wildToOther && (wildToThis & differentIpBits) == differentIpBits; } }
IpWildcard implements Serializable, Comparable<IpWildcard> { public boolean supersetOf(IpWildcard other) { long wildToThis = _wildcardMask; long wildToOther = other._wildcardMask; long differentIpBits = _ip.asLong() ^ other._ip.asLong(); return (wildToThis & wildToOther) == wildToOther && (wildToThis & differentIpBits) == differentIpBits; } private  IpWildcard(Ip address, long wildcardMask); }
IpWildcard implements Serializable, Comparable<IpWildcard> { public boolean supersetOf(IpWildcard other) { long wildToThis = _wildcardMask; long wildToOther = other._wildcardMask; long differentIpBits = _ip.asLong() ^ other._ip.asLong(); return (wildToThis & wildToOther) == wildToOther && (wildToThis & differentIpBits) == differentIpBits; } private  IpWildcard(Ip address, long wildcardMask); static IpWildcard ipWithWildcardMask(Ip address, long wildcardMask); static IpWildcard ipWithWildcardMask(Ip address, Ip wildcardMask); static IpWildcard create(Prefix prefix); static IpWildcard create(Ip ip); @JsonCreator static IpWildcard parse(String str); boolean containsIp(Ip ip); @Override int compareTo(IpWildcard o); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Nonnull Ip getIp(); @Nonnull Ip getWildcardMaskAsIp(); long getWildcardMask(); long getMask(); boolean intersects(IpWildcard other); boolean isPrefix(); boolean subsetOf(IpWildcard other); boolean supersetOf(IpWildcard other); @Nonnull IpWildcardIpSpace toIpSpace(); Prefix toPrefix(); @JsonValue @Override String toString(); }
IpWildcard implements Serializable, Comparable<IpWildcard> { public boolean supersetOf(IpWildcard other) { long wildToThis = _wildcardMask; long wildToOther = other._wildcardMask; long differentIpBits = _ip.asLong() ^ other._ip.asLong(); return (wildToThis & wildToOther) == wildToOther && (wildToThis & differentIpBits) == differentIpBits; } private  IpWildcard(Ip address, long wildcardMask); static IpWildcard ipWithWildcardMask(Ip address, long wildcardMask); static IpWildcard ipWithWildcardMask(Ip address, Ip wildcardMask); static IpWildcard create(Prefix prefix); static IpWildcard create(Ip ip); @JsonCreator static IpWildcard parse(String str); boolean containsIp(Ip ip); @Override int compareTo(IpWildcard o); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Nonnull Ip getIp(); @Nonnull Ip getWildcardMaskAsIp(); long getWildcardMask(); long getMask(); boolean intersects(IpWildcard other); boolean isPrefix(); boolean subsetOf(IpWildcard other); boolean supersetOf(IpWildcard other); @Nonnull IpWildcardIpSpace toIpSpace(); Prefix toPrefix(); @JsonValue @Override String toString(); static final IpWildcard ANY; }