2 * Copyright (c) 2015 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.rib.impl;
10 import com.google.common.base.MoreObjects;
11 import com.google.common.base.MoreObjects.ToStringHelper;
12 import com.google.common.base.Preconditions;
13 import com.google.common.primitives.UnsignedInteger;
14 import javax.annotation.Nonnull;
16 final class BestPath {
17 private final UnsignedInteger routerId;
18 private final BestPathState state;
20 BestPath(@Nonnull final UnsignedInteger routerId, @Nonnull final BestPathState state) {
21 this.routerId = Preconditions.checkNotNull(routerId);
22 this.state = Preconditions.checkNotNull(state);
25 UnsignedInteger getRouterId() {
29 BestPathState getState() {
33 private ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
34 toStringHelper.add("routerId", this.routerId);
35 toStringHelper.add("state", this.state);
36 return toStringHelper;
40 public String toString() {
41 return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
45 public int hashCode() {
48 result = prime * result + this.routerId.hashCode();
49 result = prime * result + this.state.hashCode();
54 public boolean equals(final Object obj) {
58 if (!(obj instanceof BestPath)) {
61 final BestPath other = (BestPath) obj;
62 if (!this.routerId.equals(other.routerId)) {
65 if (!this.state.equals(other.state)) {