2 * Copyright 2014 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.net.resource.link;
18 import com.google.common.base.MoreObjects;
19 import org.onosproject.net.resource.ResourceAllocation;
20 import org.onosproject.net.resource.ResourceType;
22 import java.util.Objects;
25 * Representation of allocated lambda resource.
27 public class LambdaResourceAllocation implements ResourceAllocation {
28 private final LambdaResource lambda;
31 public ResourceType type() {
32 return ResourceType.LAMBDA;
36 * Creates a new {@link LambdaResourceAllocation} with {@link LambdaResource}
39 * @param lambda allocated lambda
41 public LambdaResourceAllocation(LambdaResource lambda) {
46 * Returns the lambda resource.
48 * @return the lambda resource
50 public LambdaResource lambda() {
55 public int hashCode() {
56 return Objects.hashCode(lambda);
60 public boolean equals(Object obj) {
64 if (obj == null || getClass() != obj.getClass()) {
67 final LambdaResourceAllocation other = (LambdaResourceAllocation) obj;
68 return Objects.equals(this.lambda, other.lambda);
72 public String toString() {
73 return MoreObjects.toStringHelper(this)
74 .add("lambda", lambda)