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;
10 import com.google.common.base.Objects;
11 import com.google.common.base.Objects.ToStringHelper;
14 * Basic structure for PCEP Objects.
16 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.2">Common Object
19 public abstract class PCEPObject {
21 private final boolean processed;
23 private final boolean ignored;
26 * Constructor is protected to prevent direct instantiation, but to allow to
27 * call this constructor via super().
34 protected PCEPObject(boolean processed, boolean ignored) {
35 this.processed = processed;
36 this.ignored = ignored;
40 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.2"> Common
43 * @return true if P flag is set and false if is not.
45 public boolean isProcessed() {
46 return this.processed;
50 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.2"> Common
53 * @return true if I flag is set and false if is not.
55 public boolean isIgnored() {
60 public int hashCode() {
63 result = prime * result + (this.ignored ? 1231 : 1237);
64 result = prime * result + (this.processed ? 1231 : 1237);
69 public boolean equals(Object obj) {
74 if (this.getClass() != obj.getClass())
76 final PCEPObject other = (PCEPObject) obj;
77 if (this.ignored != other.ignored)
79 if (this.processed != other.processed)
85 public String toString(){
86 return addToStringAttributes(Objects.toStringHelper(this)).toString();
89 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
90 toStringHelper.add("processed", this.processed);
91 toStringHelper.add("ignored", this.ignored);
92 return toStringHelper;