OFPortBitMap: add functionality to iterate over the Ports
+ a factory function from a OFBitMask
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java
index b9c2b75..18ab8b0 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java
@@ -1,5 +1,7 @@
package org.projectfloodlight.openflow.types;
+import java.util.ArrayList;
+
import javax.annotation.concurrent.Immutable;
@@ -61,6 +63,20 @@
return builder.build();
}
+ public static OFPortBitMap of(OFBitMask128 mask) {
+ return new OFPortBitMap(mask);
+ }
+
+ public Iterable<OFPort> getOnPorts() {
+ ArrayList<OFPort> ports = new ArrayList<>();
+ for(int i=0; i < 127; i++) {
+ if(!(this.mask.isOn(i))) {
+ ports.add(OFPort.of(i));
+ }
+ }
+ return ports;
+ }
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof OFPortBitMap))