Merge "Bug:4995 vAdd molude: nemo-tools and remove the depency of cliche repositoty...
[nemo.git] / nemo-tools / sandbox / src / main / java / org / opendaylight / nemo / tool / sandbox / models / Connector.java
1 /*
2  * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.nemo.tool.sandbox.models;
10
11 /**
12  * Created by hj on 12/8/15.
13  */
14 public class Connector implements Comparable<Connector> {
15     private final int order;
16     private final String nodeName;
17
18     public Connector(String nodeName, int order) {
19         this.order = order;
20         this.nodeName = nodeName;
21     }
22
23     public String getConnectorName() {
24         return  nodeName + "-" + order;
25     }
26
27     public int getOrder() {
28         return order;
29     }
30
31     public String getNodeName() {
32         return nodeName;
33     }
34
35     @Override
36     public boolean equals(Object o) {
37         if (this == o) return true;
38         if (o == null || getClass() != o.getClass()) return false;
39
40         Connector that = (Connector) o;
41
42         if (order != that.order) return false;
43         if (nodeName != null ? !nodeName.equals(that.nodeName) : that.nodeName != null)
44             return false;
45
46         return true;
47     }
48
49     @Override
50     public int hashCode() {
51         int result = order;
52         result = 31 * result + (nodeName != null ? nodeName.hashCode() : 0);
53         return result;
54     }
55
56     @Override
57     public String toString() {
58         return "SwitchInterface{" +
59                 "order=" + order +
60                 ", nodeName='" + nodeName + '\'' +
61                 '}';
62     }
63
64     @Override
65     public int compareTo(Connector o) {
66         return order - o.order;
67     }
68 }