blob: e09d915c7fa5af8b908b2c87aa7c3d8578836a90 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 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 */
Toshio Koidec9051db2014-10-20 15:18:37 -070016package org.onlab.onos.net.resource;
17
18import java.util.Objects;
19
20/**
21 * Representation of lambda resource.
22 */
23public final class Lambda extends LinkResource {
24
25 private final int lambda;
26
27 /**
28 * Creates a new instance with given lambda.
29 *
30 * @param lambda lambda value to be assigned
31 */
32 private Lambda(int lambda) {
33 this.lambda = lambda;
34 }
35
36 /**
37 * Creates a new instance with given lambda.
38 *
39 * @param lambda lambda value to be assigned
40 * @return {@link Lambda} instance with given lambda
41 */
42 public static Lambda valueOf(int lambda) {
43 return new Lambda(lambda);
44 }
45
46 /**
47 * Returns lambda as an int value.
Toshio Koide485b4782014-10-20 19:34:21 -070048 *
Toshio Koidec9051db2014-10-20 15:18:37 -070049 * @return lambda as an int value
50 */
51 public int toInt() {
52 return lambda;
53 }
54
55 @Override
56 public boolean equals(Object obj) {
57 if (obj instanceof Lambda) {
58 Lambda that = (Lambda) obj;
59 return Objects.equals(this.lambda, that.lambda);
60 }
61 return false;
62 }
63
64 @Override
65 public int hashCode() {
66 return Objects.hashCode(this.lambda);
67 }
68
69 @Override
70 public String toString() {
71 return String.valueOf(this.lambda);
72 }
73
74}