3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.switchmanager;
12 import java.io.Serializable;
15 * The class describes a switch configuration including node identifier, node
16 * name, tier number and proactive/reactive mode.
18 public class SwitchConfig implements Serializable {
19 private static final long serialVersionUID = 1L;
25 public SwitchConfig(String nodeId, String description, String tier, String mode) {
28 this.description = description;
33 public String getNodeId() {
37 public String getNodeDescription() {
41 public String getTier() {
45 public String getMode() {
49 public boolean isProactive() {
50 return Integer.parseInt(mode) != 0;
53 public static long getSerialversionuid() {
54 return serialVersionUID;
58 public int hashCode() {
61 result = prime * result
62 + ((description == null) ? 0 : description.hashCode());
63 result = prime * result + ((mode == null) ? 0 : mode.hashCode());
64 result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
65 result = prime * result + ((tier == null) ? 0 : tier.hashCode());
70 public boolean equals(Object obj) {
75 if (getClass() != obj.getClass())
77 SwitchConfig other = (SwitchConfig) obj;
78 if (description == null) {
79 if (other.description != null)
81 } else if (!description.equals(other.description))
84 if (other.mode != null)
86 } else if (!mode.equals(other.mode))
89 if (other.nodeId != null)
91 } else if (!nodeId.equals(other.nodeId))
94 if (other.tier != null)
96 } else if (!tier.equals(other.tier))
102 public String toString() {
103 return ("Switch Config [Node=" + nodeId + " Description=" + description +
104 " Tier=" + tier + " Mode=" + mode + "]");