blob: 930a6b271272d9f2def8a5307e9ace509a04b2e0 [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 */
Brian O'Connor6de2e202015-05-21 14:30:41 -070016package org.onosproject.net.resource.link;
Toshio Koide485b4782014-10-20 19:34:21 -070017
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070018import com.google.common.base.MoreObjects;
Brian O'Connor6de2e202015-05-21 14:30:41 -070019import org.onosproject.net.resource.ResourceAllocation;
20import org.onosproject.net.resource.ResourceType;
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070021
Brian O'Connor41718fc2014-10-30 16:57:21 -070022import java.util.Objects;
23
Toshio Koide485b4782014-10-20 19:34:21 -070024/**
25 * Representation of allocated lambda resource.
Sho SHIMIZU364cbac2015-10-29 15:47:35 -070026 *
27 * @deprecated in Emu Release
Toshio Koide485b4782014-10-20 19:34:21 -070028 */
Sho SHIMIZU364cbac2015-10-29 15:47:35 -070029@Deprecated
Sho SHIMIZUc4d56612015-07-02 13:54:09 -070030public class LambdaResourceAllocation implements ResourceAllocation {
Sho SHIMIZU94b7ff42015-05-06 17:51:49 -070031 private final LambdaResource lambda;
Toshio Koidefa0dff62014-10-23 11:46:44 -070032
Toshio Koided1865a42014-10-23 12:44:55 -070033 @Override
34 public ResourceType type() {
35 return ResourceType.LAMBDA;
36 }
37
Toshio Koidefa0dff62014-10-23 11:46:44 -070038 /**
Sho SHIMIZU94b7ff42015-05-06 17:51:49 -070039 * Creates a new {@link LambdaResourceAllocation} with {@link LambdaResource}
Toshio Koidefa0dff62014-10-23 11:46:44 -070040 * object.
41 *
42 * @param lambda allocated lambda
43 */
Sho SHIMIZU94b7ff42015-05-06 17:51:49 -070044 public LambdaResourceAllocation(LambdaResource lambda) {
Toshio Koidefa0dff62014-10-23 11:46:44 -070045 this.lambda = lambda;
46 }
47
Toshio Koide485b4782014-10-20 19:34:21 -070048 /**
49 * Returns the lambda resource.
50 *
51 * @return the lambda resource
52 */
Sho SHIMIZU94b7ff42015-05-06 17:51:49 -070053 public LambdaResource lambda() {
Toshio Koidefa0dff62014-10-23 11:46:44 -070054 return lambda;
55 }
Brian O'Connor41718fc2014-10-30 16:57:21 -070056
57 @Override
58 public int hashCode() {
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -070059 return Objects.hashCode(lambda);
Brian O'Connor41718fc2014-10-30 16:57:21 -070060 }
61
62 @Override
63 public boolean equals(Object obj) {
64 if (this == obj) {
65 return true;
66 }
67 if (obj == null || getClass() != obj.getClass()) {
68 return false;
69 }
70 final LambdaResourceAllocation other = (LambdaResourceAllocation) obj;
71 return Objects.equals(this.lambda, other.lambda);
72 }
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070073
74 @Override
75 public String toString() {
76 return MoreObjects.toStringHelper(this)
77 .add("lambda", lambda)
78 .toString();
79 }
Toshio Koide485b4782014-10-20 19:34:21 -070080}