Merge into master from pull request #269:
java/OFMatchV3Ver13: bugfix for MatchFieldIterator (https://github.com/floodlight/loxigen/pull/269)
diff --git a/java_gen/templates/_imports.java b/java_gen/templates/_imports.java
index 0c95916..dde3ac0 100644
--- a/java_gen/templates/_imports.java
+++ b/java_gen/templates/_imports.java
@@ -26,6 +26,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
+import com.google.common.collect.AbstractIterator;
import com.google.common.collect.UnmodifiableIterator;
import com.google.common.hash.Funnel;
import com.google.common.hash.PrimitiveSink;
diff --git a/java_gen/templates/custom/OFMatchV3Ver13.java b/java_gen/templates/custom/OFMatchV3Ver13.java
index 24cab5b..dc8e637 100644
--- a/java_gen/templates/custom/OFMatchV3Ver13.java
+++ b/java_gen/templates/custom/OFMatchV3Ver13.java
@@ -83,7 +83,7 @@
return oxm != null && oxm.isMasked();
}
- private class MatchFieldIterator extends UnmodifiableIterator<MatchField<?>> {
+ private class MatchFieldIterator extends AbstractIterator<MatchField<?>> {
private Iterator<OFOxm<?>> oxmIterator;
MatchFieldIterator() {
@@ -91,14 +91,14 @@
}
@Override
- public boolean hasNext() {
- return oxmIterator.hasNext();
- }
-
- @Override
- public MatchField<?> next() {
- OFOxm<?> next = oxmIterator.next();
- return next.getMatchField();
+ protected MatchField<?> computeNext() {
+ while(oxmIterator.hasNext()) {
+ OFOxm<?> oxm = oxmIterator.next();
+ if(oxm.getMatchField().arePrerequisitesOK(OFMatchV3Ver13.this))
+ return oxm.getMatchField();
+ }
+ endOfData();
+ return null;
}
}