Merge "Randomize port to allow concurrent execution"
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / tlv / LSPStateDBVersionTlv.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.protocol.pcep.tlv;
10
11 import org.opendaylight.protocol.pcep.PCEPTlv;
12
13 /**
14  * Structure of LSP State DB Version TLV.
15  * 
16  * @see <a
17  *      href="http://tools.ietf.org/html/draft-crabbe-pce-stateful-pce-02#section-7.1.2">LSP
18  *      State Database Version TLV</a>
19  */
20 public class LSPStateDBVersionTlv implements PCEPTlv {
21         private static final long serialVersionUID = 3165807743418210453L;
22         private final long dbVersion;
23
24         /**
25          * Construct new LSP State DB Version TLV.
26          * 
27          * @param dbVersion
28          *            long
29          */
30         public LSPStateDBVersionTlv(long dbVersion) {
31                 this.dbVersion = dbVersion;
32         }
33
34         /**
35          * Gets long representation of DB Version.
36          * 
37          * @return long
38          */
39         public long getDbVersion() {
40                 return this.dbVersion;
41         }
42
43         @Override
44         public int hashCode() {
45                 final int prime = 31;
46                 int result = 1;
47                 result = prime * result + (int) (this.dbVersion ^ (this.dbVersion >>> 32));
48                 return result;
49         }
50
51         @Override
52         public boolean equals(Object obj) {
53                 if (this == obj)
54                         return true;
55                 if (obj == null)
56                         return false;
57                 if (this.getClass() != obj.getClass())
58                         return false;
59                 final LSPStateDBVersionTlv other = (LSPStateDBVersionTlv) obj;
60                 if (this.dbVersion != other.dbVersion)
61                         return false;
62                 return true;
63         }
64
65         @Override
66         public String toString() {
67                 final StringBuilder builder = new StringBuilder();
68                 builder.append("LSPStateDBVersionTlv [dbVersion=");
69                 builder.append(this.dbVersion);
70                 builder.append("]");
71                 return builder.toString();
72         }
73 }