blob: 5f36d5f8bd0915a631516bdee6b18c41022328a3 [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
Sho SHIMIZUc4d56612015-07-02 13:54:09 -070022import java.util.Objects;
23
Toshio Koide485b4782014-10-20 19:34:21 -070024/**
25 * Representation of allocated bandwidth 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 BandwidthResourceAllocation implements ResourceAllocation {
31 private final BandwidthResource bandwidth;
32
33 /**
34 * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
35 * object.
36 *
37 * @param bandwidth {@link BandwidthResource} object to be requested
38 */
39 public BandwidthResourceAllocation(BandwidthResource bandwidth) {
40 this.bandwidth = bandwidth;
41 }
42
43 /**
44 * Returns the bandwidth resource.
45 *
46 * @return the bandwidth resource
47 */
48 public BandwidthResource bandwidth() {
49 return bandwidth;
50 }
Toshio Koidea363f432014-10-23 12:49:40 -070051
52 @Override
53 public ResourceType type() {
54 return ResourceType.BANDWIDTH;
55 }
56
Sho SHIMIZUc4d56612015-07-02 13:54:09 -070057 @Override
58 public int hashCode() {
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -070059 return bandwidth.hashCode();
Sho SHIMIZUc4d56612015-07-02 13:54:09 -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 BandwidthResourceAllocation other = (BandwidthResourceAllocation) obj;
71 return Objects.equals(this.bandwidth, other.bandwidth());
Toshio Koidefa0dff62014-10-23 11:46:44 -070072 }
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070073
74 @Override
75 public String toString() {
76 return MoreObjects.toStringHelper(this)
Sho SHIMIZUc4d56612015-07-02 13:54:09 -070077 .add("bandwidth", bandwidth)
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070078 .toString();
79 }
Toshio Koide485b4782014-10-20 19:34:21 -070080}