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.subobject;
10 import com.google.common.base.Objects;
11 import com.google.common.base.Objects.ToStringHelper;
14 * Base class for Explicit route subobjects.
16 * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3">4.3. Explicit
19 public abstract class ExplicitRouteSubobject {
20 protected final boolean loose;
22 protected ExplicitRouteSubobject() {
26 protected ExplicitRouteSubobject(boolean loose) {
31 * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.1">Strict
32 * and Loose Subobjects</a>
34 * @return true if L flag is set and false if is not.
36 public boolean isLoose() {
41 public String toString(){
42 return this.addToStringAttributes(Objects.toStringHelper(this)).toString();
45 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
46 toStringHelper.add("loose", this.loose);
47 return toStringHelper;
51 public int hashCode() {
54 result = prime * result + (this.loose ? 1231 : 1237);
59 public boolean equals(Object obj) {
64 if (this.getClass() != obj.getClass())
66 final ExplicitRouteSubobject other = (ExplicitRouteSubobject) obj;
67 if (this.loose != other.loose)