Merge "Add IfNewHostNotify to DeviceManager"
[controller.git] / opendaylight / 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  */
20
21 public class TopoEdgeUpdate {
22     private Edge edge;
23     private Set<Property> props;
24     private UpdateType type;
25
26     public TopoEdgeUpdate(Edge e, Set<Property> p, UpdateType t) {
27         edge = e;
28         props = p;
29         type = t;
30     }
31
32     public Edge getEdge() {
33         return edge;
34     }
35
36     public Set<Property> getProperty() {
37         return props;
38     }
39
40     public UpdateType getUpdateType() {
41         return type;
42     }
43
44     @Override
45     public int hashCode() {
46         final int prime = 31;
47         int result = 1;
48         result = prime * result + ((edge == null) ? 0 : edge.hashCode());
49         result = prime * result + ((props == null) ? 0 : props.hashCode());
50         result = prime * result + ((type == null) ? 0 : type.hashCode());
51         return result;
52     }
53
54     @Override
55     public String toString() {
56         return "TopoEdgeUpdate [edge=" + edge + ", props=" + props + ", type="
57                 + type + "]";
58     }
59
60     @Override
61     public boolean equals(Object obj) {
62         if (this == obj)
63             return true;
64         if (obj == null)
65             return false;
66         if (getClass() != obj.getClass())
67             return false;
68         TopoEdgeUpdate other = (TopoEdgeUpdate) obj;
69         if (edge == null) {
70             if (other.edge != null)
71                 return false;
72         } else if (!edge.equals(other.edge))
73             return false;
74         if (props == null) {
75             if (other.props != null)
76                 return false;
77         } else if (!props.equals(other.props))
78             return false;
79         if (type != other.type)
80             return false;
81         return true;
82     }
83 }