BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / adsal / arphandler / src / main / java / org / opendaylight / controller / arphandler / ARPEvent.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.arphandler;
11
12 import java.io.Serializable;
13 import java.net.InetAddress;
14 /*
15  * ARP Event base class
16  */
17 public abstract class ARPEvent implements Serializable{
18
19     private static final long serialVersionUID = 1L;
20     private final InetAddress tIP;
21
22
23     @Override
24     public int hashCode() {
25         final int prime = 31;
26         int result = prime + ((tIP == null) ? 0 : tIP.hashCode());
27         return result;
28     }
29
30     @Override
31     public boolean equals(Object obj) {
32         if (this == obj) {
33             return true;
34         }
35         if (obj == null) {
36             return false;
37         }
38         if (!(obj instanceof ARPEvent)) {
39             return false;
40         }
41         ARPEvent other = (ARPEvent) obj;
42         if (tIP == null) {
43             if (other.tIP != null) {
44                 return false;
45             }
46         } else if (!tIP.equals(other.tIP)) {
47             return false;
48         }
49         return true;
50     }
51
52     public ARPEvent(InetAddress ip) {
53         this.tIP = ip;
54     }
55
56     public InetAddress getTargetIP() {
57         return tIP;
58     }
59
60     /*
61      * (non-Javadoc)
62      *
63      * @see java.lang.Object#toString()
64      */
65     @Override
66     public String toString() {
67         StringBuilder builder = new StringBuilder();
68         builder.append("ARPEvent [");
69         if (tIP != null) {
70             builder.append("tIP=")
71                     .append(tIP);
72         }
73         builder.append("]");
74         return builder.toString();
75     }
76 }