Charles Chan | 33f4a91 | 2018-04-19 23:35:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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 | */ |
| 16 | |
| 17 | package org.onosproject.net.flowobjective; |
| 18 | |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.flow.criteria.Criterion; |
| 21 | |
| 22 | import java.util.Objects; |
| 23 | |
| 24 | /** |
| 25 | * Filtering objective queue key. |
| 26 | */ |
Charles Chan | a724c513 | 2018-11-27 21:33:33 +0800 | [diff] [blame] | 27 | public class FilteringObjQueueKey implements ObjectiveQueueKey { |
Charles Chan | 33f4a91 | 2018-04-19 23:35:30 -0700 | [diff] [blame] | 28 | private DeviceId deviceId; |
| 29 | private int priority; |
| 30 | private Criterion key; |
| 31 | |
| 32 | public FilteringObjQueueKey(DeviceId deviceId, int priority, Criterion key) { |
| 33 | this.deviceId = deviceId; |
| 34 | this.priority = priority; |
| 35 | this.key = key; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public int hashCode() { |
| 40 | return Objects.hash(deviceId, priority, key); |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public boolean equals(Object other) { |
| 45 | if (this == other) { |
| 46 | return true; |
| 47 | } |
| 48 | if (!(other instanceof FilteringObjQueueKey)) { |
| 49 | return false; |
| 50 | } |
| 51 | FilteringObjQueueKey that = (FilteringObjQueueKey) other; |
| 52 | return Objects.equals(this.deviceId, that.deviceId) && |
| 53 | Objects.equals(this.priority, that.priority) && |
| 54 | Objects.equals(this.key, that.key); |
| 55 | } |
| 56 | } |