blob: b11ddecdd29f11abd469d44b88f929687df064b3 [file] [log] [blame]
Simon Hunt4fc86852015-08-20 17:57:52 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Simon Hunt4fc86852015-08-20 17:57:52 -070015 */
16
17package org.onosproject.ui.topo;
18
19import static com.google.common.base.Preconditions.checkNotNull;
20
21/**
22 * Highlighting modification.
23 * <p>
24 * Note that (for link highlights) this translates to a CSS class name
25 * that is applied to the link in the Topology UI.
26 */
27public final class Mod implements Comparable<Mod> {
28 private final String modId;
29
30 /**
31 * Constructs a mod with the given identifier.
32 *
33 * @param modId modification identifier
34 */
35 public Mod(String modId) {
36 this.modId = checkNotNull(modId);
37 }
38
39 @Override
40 public String toString() {
41 return modId;
42 }
43
44 @Override
45 public boolean equals(Object o) {
46 if (this == o) {
47 return true;
48 }
49 if (o == null || getClass() != o.getClass()) {
50 return false;
51 }
52 Mod mod = (Mod) o;
53 return modId.equals(mod.modId);
54 }
55
56 @Override
57 public int hashCode() {
58 return modId.hashCode();
59 }
60
61 @Override
62 public int compareTo(Mod o) {
63 return this.modId.compareTo(o.modId);
64 }
65}