slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015-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.xran.identifiers; |
| 18 | |
| 19 | import com.google.common.base.Objects; |
| 20 | import javafx.util.Pair; |
| 21 | import org.onosproject.xran.codecs.api.CRNTI; |
| 22 | import org.onosproject.xran.codecs.api.ECGI; |
| 23 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Class to maintain pair of ECGI and CRNTI. |
| 26 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 27 | public class EcgiCrntiPair extends Pair<ECGI, CRNTI> { |
| 28 | |
| 29 | /** |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame] | 30 | * Creates a new pair. |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 31 | * |
| 32 | * @param key The key for this pair |
| 33 | * @param value The value to use for this pair |
| 34 | */ |
| 35 | public EcgiCrntiPair(ECGI key, CRNTI value) { |
| 36 | super(key, value); |
| 37 | } |
| 38 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame] | 39 | /** |
| 40 | * Return a new EcgiCrntiPair. |
| 41 | * |
| 42 | * @param key ECGI |
| 43 | * @param value CRNTI |
| 44 | * @return EcgiCrntiPair |
| 45 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 46 | public static EcgiCrntiPair valueOf(ECGI key, CRNTI value) { |
| 47 | return new EcgiCrntiPair(key, value); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public int hashCode() { |
| 52 | return Objects.hashCode(getKey(), getValue()); |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public boolean equals(Object o) { |
| 57 | if (o instanceof EcgiCrntiPair) { |
| 58 | return ((EcgiCrntiPair) o).getKey().equals(getKey()) && |
| 59 | ((EcgiCrntiPair) o).getValue().equals(getValue()); |
| 60 | } |
| 61 | return super.equals(o); |
| 62 | } |
| 63 | } |