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.bgp.parser.impl;
10 import org.opendaylight.protocol.bgp.linkstate.SourceProtocol;
15 public abstract class AbstractLinkstateMP<T> implements MPReach<T> {
17 private final boolean reachable;
19 private final long identifier;
21 private final SourceProtocol sourceProtocol;
23 protected AbstractLinkstateMP(final long identifier, final SourceProtocol sourceProtocol, final boolean reachable) {
24 this.identifier = identifier;
25 this.sourceProtocol = sourceProtocol;
26 this.reachable = reachable;
30 public boolean isReachable() {
31 return this.reachable;
34 public long getIdentifier() {
35 return this.identifier;
38 public SourceProtocol getSourceProtocol() {
39 return this.sourceProtocol;
43 * @see java.lang.Object#hashCode()
46 public int hashCode() {
49 result = prime * result + (int) (this.identifier ^ (this.identifier >>> 32));
50 result = prime * result + (this.reachable ? 1231 : 1237);
51 result = prime * result + ((this.sourceProtocol == null) ? 0 : this.sourceProtocol.hashCode());
56 * @see java.lang.Object#equals(java.lang.Object)
59 public boolean equals(final Object obj) {
64 if (this.getClass() != obj.getClass())
66 final AbstractLinkstateMP<?> other = (AbstractLinkstateMP<?>) obj;
67 if (this.identifier != other.identifier)
69 if (this.reachable != other.reachable)
71 if (this.sourceProtocol != other.sourceProtocol)
77 * @see java.lang.Object#toString()
80 public String toString() {
81 final StringBuilder builder = new StringBuilder();
82 builder.append("AbstractLinkstateMP [reachable=");
83 builder.append(this.reachable);
84 builder.append(", identifier=");
85 builder.append(this.identifier);
86 builder.append(", sourceProtocol=");
87 builder.append(this.sourceProtocol);
89 return builder.toString();