Support for bitwise AND/OR/XOR in ImmutableByteSequence
Also, minor refactoring of the fit() method to improve code readability
Change-Id: I826650c3fc45573c723d9d2dd8692da174d9ae08
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java b/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
index 36e9068..9b2b4a0 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
@@ -23,7 +23,6 @@
import java.util.Optional;
import static org.onlab.util.ImmutableByteSequence.ByteSequenceTrimException;
-import static org.onlab.util.ImmutableByteSequence.fit;
/**
* Abstract implementation of a criterion translator that opportunistically tries to generate different types of match
@@ -48,7 +47,7 @@
void initAsExactMatch(ImmutableByteSequence value, int bitWidth)
throws ByteSequenceTrimException {
this.initType = PiMatchType.EXACT;
- this.value = fit(value, bitWidth);
+ this.value = value.fit(bitWidth);
this.bitWidth = bitWidth;
}
@@ -63,8 +62,8 @@
void initAsTernaryMatch(ImmutableByteSequence value, ImmutableByteSequence mask, int bitWidth)
throws ByteSequenceTrimException {
this.initType = PiMatchType.TERNARY;
- this.value = fit(value, bitWidth);
- this.mask = fit(mask, bitWidth);
+ this.value = value.fit(bitWidth);
+ this.mask = mask.fit(bitWidth);
this.bitWidth = bitWidth;
}
@@ -79,7 +78,7 @@
void initAsLpm(ImmutableByteSequence value, int prefixLength, int bitWidth)
throws ByteSequenceTrimException {
this.initType = PiMatchType.LPM;
- this.value = fit(value, bitWidth);
+ this.value = value.fit(bitWidth);
this.prefixLength = prefixLength;
this.bitWidth = bitWidth;
}