Open Kilda Java Documentation
PortQueue.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.topo;
17 
21 public class PortQueue implements ITopoSlug {
22 
23  private final Port parent;
24  private final String id;
25  private int priority = -1;
26  private String slug;
27 
28  public PortQueue(Port parent, String id) {
29  this.parent = parent;
30  this.id = id;
31  }
32 
33  public PortQueue(Port parent, String id, int priority) {
34  this.parent = parent;
35  this.id = id;
36  this.priority = priority;
37  }
38 
39  public Port getParent() {
40  return parent;
41  }
42 
43  public String getId() {
44  return id;
45  }
46 
47  public int getPriority() {
48  return priority;
49  }
50 
51  public void setPriority(int priority) {
52  this.priority = priority;
53  }
54 
55  @Override
56  public String getSlug() {
57  if (slug == null)
58  slug = TopoSlug.toString(this);
59  return slug;
60  }
61 
62  @Override
63  public boolean equals(Object o) {
64  if (this == o) return true;
65  if (o == null || getClass() != o.getClass()) return false;
66 
67  PortQueue portQueue = (PortQueue) o;
68 
69  if (priority != portQueue.priority) return false;
70  if (!parent.equals(portQueue.parent)) return false;
71  return id.equals(portQueue.id);
72  }
73 
74  @Override
75  public int hashCode() {
76  int result = parent.hashCode();
77  result = 31 * result + id.hashCode();
78  result = 31 * result + priority;
79  return result;
80  }
81 
82  @Override
83  public String toString() {
84  return "PortQueue{" +
85  "parent=" + parent +
86  ", id='" + id + '\'' +
87  ", priority=" + priority +
88  '}';
89  }
90 }
void setPriority(int priority)
Definition: PortQueue.java:51
PortQueue(Port parent, String id, int priority)
Definition: PortQueue.java:33
boolean equals(Object o)
Definition: Port.java:48
static final String toString(Switch aSwitch)
Definition: TopoSlug.java:34
boolean equals(Object o)
Definition: PortQueue.java:63
list result
Definition: plan-d.py:72
PortQueue(Port parent, String id)
Definition: PortQueue.java:28