blob: ff26e81ec3b667020059dfe3f5aac684b44092a9 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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
Ayaka Koshibee114f042015-05-01 11:43:00 -070018import java.util.Objects;
19
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070020import com.google.common.base.MoreObjects;
Brian O'Connor6de2e202015-05-21 14:30:41 -070021import org.onosproject.net.resource.ResourceRequest;
22import org.onosproject.net.resource.ResourceType;
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070023
Toshio Koide485b4782014-10-20 19:34:21 -070024/**
25 * Representation of a request for 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
Toshio Koidefa0dff62014-10-23 11:46:44 -070030public class BandwidthResourceRequest implements ResourceRequest {
Sho SHIMIZU63feca72015-05-07 10:44:25 -070031 private final BandwidthResource bandwidth;
Toshio Koide569ca702014-10-23 11:37:44 -070032
33 /**
Sho SHIMIZU63feca72015-05-07 10:44:25 -070034 * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
Toshio Koide569ca702014-10-23 11:37:44 -070035 * object.
36 *
Sho SHIMIZU63feca72015-05-07 10:44:25 -070037 * @param bandwidth {@link BandwidthResource} object to be requested
Toshio Koide569ca702014-10-23 11:37:44 -070038 */
Sho SHIMIZU63feca72015-05-07 10:44:25 -070039 public BandwidthResourceRequest(BandwidthResource bandwidth) {
Toshio Koide569ca702014-10-23 11:37:44 -070040 this.bandwidth = bandwidth;
41 }
42
43 /**
Toshio Koide485b4782014-10-20 19:34:21 -070044 * Returns the bandwidth resource.
45 *
46 * @return the bandwidth resource
47 */
Sho SHIMIZU63feca72015-05-07 10:44:25 -070048 public BandwidthResource bandwidth() {
Toshio Koide569ca702014-10-23 11:37:44 -070049 return bandwidth;
50 }
Toshio Koideca0fcff2014-10-23 14:08:36 -070051
52 @Override
53 public ResourceType type() {
54 return ResourceType.BANDWIDTH;
55 }
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070056
57 @Override
Ayaka Koshibee114f042015-05-01 11:43:00 -070058 public int hashCode() {
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -070059 return bandwidth.hashCode();
Ayaka Koshibee114f042015-05-01 11:43:00 -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 }
HIGUCHI Yutac7c1d352015-10-07 16:14:20 -070070 final BandwidthResourceRequest other = (BandwidthResourceRequest) obj;
Ayaka Koshibee114f042015-05-01 11:43:00 -070071 return Objects.equals(this.bandwidth, other.bandwidth());
72 }
73
74 @Override
Brian O'Connorfe0f4b12014-10-30 21:19:02 -070075 public String toString() {
76 return MoreObjects.toStringHelper(this)
77 .add("bandwidth", bandwidth)
78 .toString();
79 }
Toshio Koide485b4782014-10-20 19:34:21 -070080}