blob: f12f62a9dde472d6f4c4846815386c22fff21d70 [file] [log] [blame]
slowrc86750e2017-08-22 17:26:47 -07001/*
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
17package org.onosproject.xran.identifiers;
18
19import com.google.common.base.Objects;
20import javafx.util.Pair;
21import org.onosproject.xran.codecs.api.CRNTI;
22import org.onosproject.xran.codecs.api.ECGI;
23
slowr577f3222017-08-28 10:49:08 -070024/**
25 * Class to maintain pair of ECGI and CRNTI.
26 */
slowrc86750e2017-08-22 17:26:47 -070027public class EcgiCrntiPair extends Pair<ECGI, CRNTI> {
28
29 /**
slowr577f3222017-08-28 10:49:08 -070030 * Creates a new pair.
slowrc86750e2017-08-22 17:26:47 -070031 *
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
slowr577f3222017-08-28 10:49:08 -070039 /**
40 * Return a new EcgiCrntiPair.
41 *
42 * @param key ECGI
43 * @param value CRNTI
44 * @return EcgiCrntiPair
45 */
slowrc86750e2017-08-22 17:26:47 -070046 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}