blob: 4dc5a796aa13b9a9a79f5c1a61647e4a709af1a6 [file] [log] [blame]
Sho SHIMIZU91210a72015-04-29 12:54:28 -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.
15 */
16package org.onosproject.net;
17
18import com.google.common.base.MoreObjects;
19
20/**
21 * Implementation of Lambda simply designated by an index number of wavelength.
Marc De Leenheer2c305302015-12-07 21:37:44 -080022 *
23 * @deprecated in Emu (ONOS 1.4).
Sho SHIMIZU91210a72015-04-29 12:54:28 -070024 */
Marc De Leenheer2c305302015-12-07 21:37:44 -080025@Deprecated
Sho SHIMIZU91210a72015-04-29 12:54:28 -070026public class IndexedLambda implements Lambda {
27
Sho SHIMIZU2e7ac842015-05-05 15:45:38 -070028 private final long index;
Sho SHIMIZU91210a72015-04-29 12:54:28 -070029
30 /**
31 * Creates an instance representing the wavelength specified by the given index number.
32 *
Sho SHIMIZU2e7ac842015-05-05 15:45:38 -070033 * @param index index number of wavelength
Sho SHIMIZU91210a72015-04-29 12:54:28 -070034 */
Sho SHIMIZU4fea4fd2015-05-07 11:50:23 -070035 public IndexedLambda(long index) {
Sho SHIMIZU2e7ac842015-05-05 15:45:38 -070036 this.index = index;
37 }
38
39 /**
40 * Returns the index number of lambda.
41 *
42 * @return the index number of lambda
43 */
44 public long index() {
45 return index;
Sho SHIMIZU91210a72015-04-29 12:54:28 -070046 }
47
48 @Override
49 public int hashCode() {
Sho SHIMIZUa5b5c3e2015-05-07 12:04:49 -070050 return Long.hashCode(index);
Sho SHIMIZU91210a72015-04-29 12:54:28 -070051 }
52
53 @Override
54 public boolean equals(Object obj) {
55 if (this == obj) {
56 return true;
57 }
58 if (!(obj instanceof IndexedLambda)) {
59 return false;
60 }
61
62 final IndexedLambda that = (IndexedLambda) obj;
Sho SHIMIZU2e7ac842015-05-05 15:45:38 -070063 return this.index == that.index;
Sho SHIMIZU91210a72015-04-29 12:54:28 -070064 }
65
66 @Override
67 public String toString() {
68 return MoreObjects.toStringHelper(this)
Sho SHIMIZU2e7ac842015-05-05 15:45:38 -070069 .add("lambda", index)
Sho SHIMIZU91210a72015-04-29 12:54:28 -070070 .toString();
71 }
72}