X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Ftopology%2FTopoEdgeUpdate.java;h=f972ae6a6679b9b1d4cc55afe39a63b276d17ce0;hp=d8da9c301bb17d0c62848ec29baccfc9ee4edfc7;hb=f9aae7377704eed8a43c9a984f585165042ce5f7;hpb=6ce68c7d4d71586d027668df5d9427d663d6b210 diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java index d8da9c301b..f972ae6a66 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/topology/TopoEdgeUpdate.java @@ -10,26 +10,37 @@ package org.opendaylight.controller.sal.topology; import java.util.Set; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.opendaylight.controller.sal.core.Edge; import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** * The class represents an Edge, the Edge's Property Set and its UpdateType. + * If update is on new properties added to an existing edge, appropriate type is CHANGED. */ - public class TopoEdgeUpdate { private Edge edge; private Set props; private UpdateType type; + private boolean isLocal; + /** + * Constructor for a topology element update. A TopologyElementUpdate is an + * object that summarize what has happened on an Edge and if the update is + * generated locally to this controller or no + * + * @param e + * Edge being updated + * @param p + * Set of Properties attached to the edge + * @param t + * Type of update + */ public TopoEdgeUpdate(Edge e, Set p, UpdateType t) { edge = e; props = p; type = t; + setLocal(true); } public Edge getEdge() { @@ -46,17 +57,48 @@ public class TopoEdgeUpdate { @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + final int prime = 31; + int result = 1; + result = (prime * result) + ((edge == null) ? 0 : edge.hashCode()); + result = (prime * result) + ((type == null) ? 0 : type.hashCode()); + return result; } @Override public String toString() { - return "TopoEdgeUpdate[" + ReflectionToStringBuilder.toString(this) - + "]"; + return "TopoEdgeUpdate [edge=" + edge + ", props=" + props + ", type=" + type + ", isLocal=" + isLocal + "]"; } @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; + } + TopoEdgeUpdate other = (TopoEdgeUpdate) obj; + if (edge == null) { + if (other.edge != null) { + return false; + } + } else if (!edge.equals(other.edge)) { + return false; + } + if (type != other.type) { + return false; + } + return true; + } + + public boolean isLocal() { + return isLocal; + } + + public void setLocal(boolean isLocal) { + this.isLocal = isLocal; } }