package org.opendaylight.controller.sal.match;
+import java.io.Serializable;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.opendaylight.controller.sal.utils.EtherTypes;
import org.opendaylight.controller.sal.utils.IPProtocols;
import org.opendaylight.controller.sal.utils.NetUtils;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class Match implements Cloneable {
- private static final Map<MatchType, MatchType> reversableMatches;
+public class Match implements Cloneable, Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final Map<MatchType, MatchType> reversableMatches;
static {
Map<MatchType, MatchType> map = new HashMap<MatchType, MatchType>();
map.put(MatchType.DL_SRC, MatchType.DL_DST);
&& filterAddress instanceof Inet4Address) {
return true;
}
- InetAddress thisMask = (InetAddress) filter.getField(type)
- .getMask();
- InetAddress filterMask = (InetAddress) filter.getField(type)
- .getMask();
+ InetAddress thisMask = (InetAddress) thisField.getMask();
+ InetAddress filterMask = (InetAddress) filterField.getMask();
// thisAddress has to be in same subnet of filterAddress
if (NetUtils.inetAddressConflict(thisAddress, filterAddress,
thisMask, filterMask)) {
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fields == null) ? 0 : fields.hashCode());
+ result = prime * result + matches;
+ return result;
}
@Override
public boolean equals(Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Match other = (Match) obj;
+ if (fields == null) {
+ if (other.fields != null)
+ return false;
+ } else if (!fields.equals(other.fields))
+ return false;
+ if (matches != other.matches)
+ return false;
+ return true;
}
@Override