2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.pcep.tlv;
10 import org.opendaylight.protocol.pcep.PCEPTlv;
13 * Structure of PCE Stateful Capability Tlv.
16 * href="http://tools.ietf.org/html/draft-crabbe-pce-stateful-pce-02#section-8.6">STATEFUL-PCE-CAPABILITY
19 * href="http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt#section-4.1">Stateful PCE Capability
23 public class PCEStatefulCapabilityTlv implements PCEPTlv {
25 private static final long serialVersionUID = 5567589958323130325L;
27 private final boolean update;
29 private final boolean versioned;
31 private final boolean instantiated;
34 * Constructs PCE Stateful Capability Tlv
41 public PCEStatefulCapabilityTlv(boolean instantiated, boolean update, boolean versioned) {
42 this.instantiated = instantiated;
44 this.versioned = versioned;
48 * Setting of Instantiated flag.
52 public boolean isInstantiated() {
53 return this.instantiated;
57 * Setting of Update flag.
61 public boolean isUpdate() {
66 * Setting of Versioned flag.
70 public boolean isVersioned() {
71 return this.versioned;
75 * @see java.lang.Object#hashCode()
78 public int hashCode() {
81 result = prime * result + (this.instantiated ? 1231 : 1237);
82 result = prime * result + (this.update ? 1231 : 1237);
83 result = prime * result + (this.versioned ? 1231 : 1237);
88 * @see java.lang.Object#equals(java.lang.Object)
91 public boolean equals(Object obj) {
96 if (!(obj instanceof PCEStatefulCapabilityTlv))
98 final PCEStatefulCapabilityTlv other = (PCEStatefulCapabilityTlv) obj;
99 if (this.instantiated != other.instantiated)
101 if (this.update != other.update)
103 if (this.versioned != other.versioned)
109 * @see java.lang.Object#toString()
112 public String toString() {
113 final StringBuilder builder = new StringBuilder();
114 builder.append("PCEStatefulCapabilityTlv [update=");
115 builder.append(this.update);
116 builder.append(", versioned=");
117 builder.append(this.versioned);
118 builder.append(", instantiated=");
119 builder.append(this.instantiated);
121 return builder.toString();