public boolean equals(Object value1, Object value2, Object mask1, Object mask2) {
switch (this) {
case NW_SRC:
case NW_DST:
InetAddress thisIP = (InetAddress) value1;
int thisMaskLen = (mask1 == null) ? ((thisIP instanceof Inet4Address) ? 32 : 128) : NetUtils
.getSubnetMaskLength((InetAddress) mask1);
InetAddress otherIP = (InetAddress) value2;
int otherMaskLen = (mask2 == null) ? ((otherIP instanceof Inet4Address) ? 32 : 128) : NetUtils
.getSubnetMaskLength((InetAddress) mask2);
return NetUtils.getSubnetPrefix(thisIP, thisMaskLen)
.equals(NetUtils.getSubnetPrefix(otherIP, otherMaskLen));
default:
return (this.equalValues(value1, value2) && this.equalMasks(mask1, mask2));
}
}