Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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'Connor | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame] | 16 | package org.onosproject.net.resource.link; |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 17 | |
Ayaka Koshibe | e114f04 | 2015-05-01 11:43:00 -0700 | [diff] [blame] | 18 | import java.util.Objects; |
| 19 | |
Brian O'Connor | fe0f4b1 | 2014-10-30 21:19:02 -0700 | [diff] [blame] | 20 | import com.google.common.base.MoreObjects; |
Brian O'Connor | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame] | 21 | import org.onosproject.net.resource.ResourceRequest; |
| 22 | import org.onosproject.net.resource.ResourceType; |
Brian O'Connor | fe0f4b1 | 2014-10-30 21:19:02 -0700 | [diff] [blame] | 23 | |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Representation of a request for bandwidth resource. |
Sho SHIMIZU | 364cbac | 2015-10-29 15:47:35 -0700 | [diff] [blame] | 26 | * |
| 27 | * @deprecated in Emu Release |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 28 | */ |
Sho SHIMIZU | 364cbac | 2015-10-29 15:47:35 -0700 | [diff] [blame] | 29 | @Deprecated |
Toshio Koide | fa0dff6 | 2014-10-23 11:46:44 -0700 | [diff] [blame] | 30 | public class BandwidthResourceRequest implements ResourceRequest { |
Sho SHIMIZU | 63feca7 | 2015-05-07 10:44:25 -0700 | [diff] [blame] | 31 | private final BandwidthResource bandwidth; |
Toshio Koide | 569ca70 | 2014-10-23 11:37:44 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
Sho SHIMIZU | 63feca7 | 2015-05-07 10:44:25 -0700 | [diff] [blame] | 34 | * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource} |
Toshio Koide | 569ca70 | 2014-10-23 11:37:44 -0700 | [diff] [blame] | 35 | * object. |
| 36 | * |
Sho SHIMIZU | 63feca7 | 2015-05-07 10:44:25 -0700 | [diff] [blame] | 37 | * @param bandwidth {@link BandwidthResource} object to be requested |
Toshio Koide | 569ca70 | 2014-10-23 11:37:44 -0700 | [diff] [blame] | 38 | */ |
Sho SHIMIZU | 63feca7 | 2015-05-07 10:44:25 -0700 | [diff] [blame] | 39 | public BandwidthResourceRequest(BandwidthResource bandwidth) { |
Toshio Koide | 569ca70 | 2014-10-23 11:37:44 -0700 | [diff] [blame] | 40 | this.bandwidth = bandwidth; |
| 41 | } |
| 42 | |
| 43 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 44 | * Returns the bandwidth resource. |
| 45 | * |
| 46 | * @return the bandwidth resource |
| 47 | */ |
Sho SHIMIZU | 63feca7 | 2015-05-07 10:44:25 -0700 | [diff] [blame] | 48 | public BandwidthResource bandwidth() { |
Toshio Koide | 569ca70 | 2014-10-23 11:37:44 -0700 | [diff] [blame] | 49 | return bandwidth; |
| 50 | } |
Toshio Koide | ca0fcff | 2014-10-23 14:08:36 -0700 | [diff] [blame] | 51 | |
| 52 | @Override |
| 53 | public ResourceType type() { |
| 54 | return ResourceType.BANDWIDTH; |
| 55 | } |
Brian O'Connor | fe0f4b1 | 2014-10-30 21:19:02 -0700 | [diff] [blame] | 56 | |
| 57 | @Override |
Ayaka Koshibe | e114f04 | 2015-05-01 11:43:00 -0700 | [diff] [blame] | 58 | public int hashCode() { |
HIGUCHI Yuta | ca9cc8e | 2015-10-29 23:26:51 -0700 | [diff] [blame] | 59 | return bandwidth.hashCode(); |
Ayaka Koshibe | e114f04 | 2015-05-01 11:43:00 -0700 | [diff] [blame] | 60 | } |
| 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 Yuta | c7c1d35 | 2015-10-07 16:14:20 -0700 | [diff] [blame] | 70 | final BandwidthResourceRequest other = (BandwidthResourceRequest) obj; |
Ayaka Koshibe | e114f04 | 2015-05-01 11:43:00 -0700 | [diff] [blame] | 71 | return Objects.equals(this.bandwidth, other.bandwidth()); |
| 72 | } |
| 73 | |
| 74 | @Override |
Brian O'Connor | fe0f4b1 | 2014-10-30 21:19:02 -0700 | [diff] [blame] | 75 | public String toString() { |
| 76 | return MoreObjects.toStringHelper(this) |
| 77 | .add("bandwidth", bandwidth) |
| 78 | .toString(); |
| 79 | } |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 80 | } |