diff --git a/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java b/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java index 0b08655425daddfe1dd0b206366e680f6190852e..c4777294c66f0167b976724a590fa96c12397a97 100644 --- a/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java +++ b/src/main/java/net/floodlightcontroller/flowcache/OFMatchReconcile.java @@ -100,4 +100,76 @@ public class OFMatchReconcile { " cookie=" + cookie + " appInstName=" + appInstName + " newAppInstName=" + newAppInstName + " ReconcileAction=" + rcAction + "outPort=" + outPort + "]"; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + action; + result = prime * result + + ((appInstName == null) ? 0 : appInstName.hashCode()); + result = prime * result + (int) (cookie ^ (cookie >>> 32)); + result = prime + * result + + ((newAppInstName == null) ? 0 : newAppInstName.hashCode()); + result = prime * result + + ((ofmWithSwDpid == null) ? 0 : ofmWithSwDpid.hashCode()); + result = prime * result + outPort; + result = prime * result + priority; + result = prime * result + + ((rcAction == null) ? 0 : rcAction.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof OFMatchReconcile)) { + return false; + } + OFMatchReconcile other = (OFMatchReconcile) obj; + if (action != other.action) { + return false; + } + if (appInstName == null) { + if (other.appInstName != null) { + return false; + } + } else if (!appInstName.equals(other.appInstName)) { + return false; + } + if (cookie != other.cookie) { + return false; + } + if (newAppInstName == null) { + if (other.newAppInstName != null) { + return false; + } + } else if (!newAppInstName.equals(other.newAppInstName)) { + return false; + } + if (ofmWithSwDpid == null) { + if (other.ofmWithSwDpid != null) { + return false; + } + } else if (!ofmWithSwDpid.equals(other.ofmWithSwDpid)) { + return false; + } + if (outPort != other.outPort) { + return false; + } + if (priority != other.priority) { + return false; + } + if (rcAction != other.rcAction) { + return false; + } + return true; + } + } \ No newline at end of file diff --git a/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java b/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java index 0caf9ff165102435f9f5ec9a650e47d607415c3e..3fe094717d1484b943cb7355579f3a71cfce594d 100644 --- a/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java +++ b/src/main/java/org/openflow/protocol/OFMatchWithSwDpid.java @@ -47,9 +47,45 @@ public class OFMatchWithSwDpid { this.switchDataPathId = dpid; return this; } - + @Override public String toString() { return "OFMatchWithSwDpid [" + HexString.toHexString(switchDataPathId) + ofMatch + "]"; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((ofMatch == null) ? 0 : ofMatch.hashCode()); + result = prime * result + + (int) (switchDataPathId ^ (switchDataPathId >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof OFMatchWithSwDpid)) { + return false; + } + OFMatchWithSwDpid other = (OFMatchWithSwDpid) obj; + if (ofMatch == null) { + if (other.ofMatch != null) { + return false; + } + } else if (!ofMatch.equals(other.ofMatch)) { + return false; + } + if (switchDataPathId != other.switchDataPathId) { + return false; + } + return true; + } }