X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Freader%2FFlowOnNode.java;h=994ee4533e077ab3ad74e65f08306d10a9910320;hb=refs%2Fchanges%2F52%2F752%2F3;hp=431f5895638d52a1f14abcb515db65fb17d4b48e;hpb=42210c03b0a4c54706320ba9f55794c0abd4d201;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java index 431f589563..994ee4533e 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/FlowOnNode.java @@ -9,6 +9,8 @@ package org.opendaylight.controller.sal.reader; +import java.io.Serializable; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -23,7 +25,9 @@ import org.opendaylight.controller.sal.flowprogrammer.Flow; @XmlRootElement (name="FlowStat") @XmlAccessorType(XmlAccessType.NONE) -public class FlowOnNode { +public class FlowOnNode implements Serializable{ + private static final long serialVersionUID = 1L; + @XmlElement private Flow flow; // Flow descriptor @XmlElement @@ -38,9 +42,10 @@ public class FlowOnNode { private long byteCount; /* Dummy constructor for JAXB */ + @SuppressWarnings("unused") private FlowOnNode () { } - + public FlowOnNode(Flow flow) { this.flow = flow; } @@ -109,6 +114,56 @@ public class FlowOnNode { this.durationNanoseconds = durationNanoseconds; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (byteCount ^ (byteCount >>> 32)); + result = prime * result + durationNanoseconds; + result = prime * result + durationSeconds; + result = prime * result + ((flow == null) ? 0 : flow.hashCode()); + result = prime * result + (int) (packetCount ^ (packetCount >>> 32)); + result = prime * result + tableId; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof FlowOnNode)) { + return false; + } + FlowOnNode other = (FlowOnNode) obj; + if (byteCount != other.byteCount) { + return false; + } + if (durationNanoseconds != other.durationNanoseconds) { + return false; + } + if (durationSeconds != other.durationSeconds) { + return false; + } + if (flow == null) { + if (other.flow != null) { + return false; + } + } else if (!flow.equals(other.flow)) { + return false; + } + if (packetCount != other.packetCount) { + return false; + } + if (tableId != other.tableId) { + return false; + } + return true; + } + @Override public String toString() { return "FlowOnNode[flow =" + flow + ", tableId = " + tableId