Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -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. |
| 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.topology; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 17 | |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 18 | import org.onlab.util.Identifier; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Representation of the topology cluster identity. |
| 22 | */ |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 23 | public final class ClusterId extends Identifier<Integer> { |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 24 | |
| 25 | // Public construction is prohibit |
| 26 | private ClusterId(int id) { |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 27 | super(id); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns the cluster identifier, represented by the specified integer |
| 32 | * serial number. |
| 33 | * |
| 34 | * @param id integer serial number |
| 35 | * @return cluster identifier |
| 36 | */ |
| 37 | public static ClusterId clusterId(int id) { |
| 38 | return new ClusterId(id); |
| 39 | } |
| 40 | |
tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Returns the backing integer index. |
| 43 | * |
| 44 | * @return backing integer index |
| 45 | */ |
| 46 | public int index() { |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 47 | return identifier; |
tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 48 | } |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 49 | } |