2 * Copyright 2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.net.flow.criteria;
18 import java.util.Objects;
20 import static com.google.common.base.MoreObjects.toStringHelper;
23 * Implementation of optical signal type criterion (8 bits unsigned
26 * @deprecated in Cardinal Release
29 public final class OpticalSignalTypeCriterion implements Criterion {
30 private static final short MASK = 0xff;
31 private final short signalType; // Signal type value: 8 bits
32 private final Type type;
37 * @param signalType the optical signal type to match (8 bits unsigned
39 * @param type the match type. Should be Type.OCH_SIGTYPE
41 OpticalSignalTypeCriterion(short signalType, Type type) {
42 this.signalType = (short) (signalType & MASK);
52 * Gets the optical signal type to match.
54 * @return the optical signal type to match (8 bits unsigned integer)
56 public short signalType() {
61 public String toString() {
62 return toStringHelper(type().toString())
63 .add("signalType", signalType).toString();
67 public int hashCode() {
68 return Objects.hash(type().ordinal(), signalType);
72 public boolean equals(Object obj) {
76 if (obj instanceof OpticalSignalTypeCriterion) {
77 OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj;
78 return Objects.equals(signalType, that.signalType) &&
79 Objects.equals(type, that.type);