f3fe561329265be1b7629de88300fef77c814f54
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / type / lisp / address / LispASAddress.java
1 /*
2  * Copyright (c) 2014 Contextream, 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.lispflowmapping.type.lisp.address;
10
11 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
12
13 public class LispASAddress extends LispAddress {
14     private int asNum;
15
16     public LispASAddress(int num) {
17         super(AddressFamilyNumberEnum.AS);
18         this.asNum = num;
19     }
20
21
22     public int getAS() {
23         return asNum;
24     }
25
26
27     @Override
28     public int hashCode() {
29         final int prime = 31;
30         int result = super.hashCode();
31         result = prime * result + asNum;
32         return result;
33     }
34
35     @Override
36     public boolean equals(Object obj) {
37         if (this == obj)
38             return true;
39         if (!super.equals(obj))
40             return false;
41         if (getClass() != obj.getClass())
42             return false;
43         LispASAddress other = (LispASAddress) obj;
44         if (asNum != other.asNum)
45             return false;
46         return true;
47     }
48
49     @Override
50     public String toString() {
51         return "" + asNum;
52     }
53 }