Mark AD-SAL interfaces as deprecated
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / topology / TopoEdgeUpdate.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.sal.topology;
10
11 import java.util.Set;
12
13 import org.opendaylight.controller.sal.core.Edge;
14 import org.opendaylight.controller.sal.core.Property;
15 import org.opendaylight.controller.sal.core.UpdateType;
16
17 /**
18  * The class represents an Edge, the Edge's Property Set and its UpdateType.
19  * If update is on new properties added to an existing edge, appropriate type is CHANGED.
20  */
21 @Deprecated
22 public class TopoEdgeUpdate {
23     private Edge edge;
24     private Set<Property> props;
25     private UpdateType type;
26     private boolean isLocal;
27
28     /**
29      * Constructor for a topology element update. A TopologyElementUpdate is an
30      * object that summarize what has happened on an Edge and if the update is
31      * generated locally to this controller or no
32      *
33      * @param e
34      *            Edge being updated
35      * @param p
36      *            Set of Properties attached to the edge
37      * @param t
38      *            Type of update
39      */
40     public TopoEdgeUpdate(Edge e, Set<Property> p, UpdateType t) {
41         edge = e;
42         props = p;
43         type = t;
44         setLocal(true);
45     }
46
47     public Edge getEdge() {
48         return edge;
49     }
50
51     public Set<Property> getProperty() {
52         return props;
53     }
54
55     public UpdateType getUpdateType() {
56         return type;
57     }
58
59     @Override
60     public int hashCode() {
61         final int prime = 31;
62         int result = 1;
63         result = (prime * result) + ((edge == null) ? 0 : edge.hashCode());
64         result = (prime * result) + ((type == null) ? 0 : type.hashCode());
65         return result;
66     }
67
68     @Override
69     public String toString() {
70         return "TopoEdgeUpdate [edge=" + edge + ", props=" + props + ", type=" + type + ", isLocal=" + isLocal + "]";
71     }
72
73     @Override
74     public boolean equals(Object obj) {
75         if (this == obj) {
76             return true;
77         }
78         if (obj == null) {
79             return false;
80         }
81         if (getClass() != obj.getClass()) {
82             return false;
83         }
84         TopoEdgeUpdate other = (TopoEdgeUpdate) obj;
85         if (edge == null) {
86             if (other.edge != null) {
87                 return false;
88             }
89         } else if (!edge.equals(other.edge)) {
90             return false;
91         }
92         if (type != other.type) {
93             return false;
94         }
95         return true;
96     }
97
98     public boolean isLocal() {
99         return isLocal;
100     }
101
102     public void setLocal(boolean isLocal) {
103         this.isLocal = isLocal;
104     }
105 }