blob: dceff829d88ee2244a958cd50eb2e7f13645f1d6 [file] [log] [blame]
Georgios Katsikas83600982017-05-28 20:41:45 +02001/*
2 * Copyright 2017-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 */
Georgios Katsikas2ebd8a02018-06-27 18:32:50 +020016package org.onosproject.drivers.server.devices.nic;
Georgios Katsikas83600982017-05-28 20:41:45 +020017
Georgios Katsikas6dc11c12018-12-20 08:43:29 +010018import java.util.Objects;
19
Georgios Katsikas83600982017-05-28 20:41:45 +020020/**
21 * The base class that holds the value of a NIC's Rx filter.
22 */
23public abstract class RxFilterValue {
24
Georgios Katsikas6dc11c12018-12-20 08:43:29 +010025 /* CPU id of the server this tag will lead to */
26 protected int cpuId;
27
28 /**
29 * Constructs an Rx filter value.
30 *
31 * @param cpuId CPU ID of the server this tag will lead to
32 */
33 public RxFilterValue(int cpuId) {
34 this.cpuId = cpuId;
35 }
36
37 /**
38 * Returns the CPU ID that corresponds to this Rx filter value.
39 *
40 * @return CPU ID of the server this tag will lead to
41 */
42 public int cpuId() {
43 return this.cpuId;
44 }
45
46 @Override
47 public int hashCode() {
48 return Objects.hash(this.cpuId);
49 }
50
51 @Override
52 public boolean equals(Object obj) {
53 if (this == obj) {
54 return true;
55 }
56
57 if ((obj == null) || (!(obj instanceof RxFilterValue))) {
58 return false;
59 }
60
61 return cpuId == ((RxFilterValue) obj).cpuId;
Georgios Katsikas83600982017-05-28 20:41:45 +020062 }
63
64}