Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 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 Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | package org.onosproject.ui.topo; |
| 18 | |
| 19 | import 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 | */ |
| 27 | public 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 | } |