add bitwise logical operators and broadcast check

AND, OR, NOT and isBroadcast added to IPAddress
getSubnetBroadcastAddress added to IPAddressWithMask with
convenience method isSubnetBroadcastAddress
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
index c96be83..996aba2 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
@@ -20,6 +20,33 @@
      */
     public abstract int asCidrMaskLength();
 
+    /**
+     * Checks if the IPAddress is the global broadcast address
+     * 255.255.255.255 in case of IPv4
+     * @return boolean true or false
+     */
+    public abstract boolean isBroadcast();
+
+    /**
+     * Perform a low level AND operation on the bits of two IPAddress<?> objects
+     * @param   IPAddress<?> other
+     * @return  new IPAddress<?> object after the AND oper
+     */
+    public abstract IPAddress<?> and(IPAddress<?> other);
+
+    /**
+     * Perform a low level OR operation on the bits of two IPAddress<?> objects
+     * @param   IPAddress<?> other
+     * @return  new IPAddress<?> object after the AND oper
+     */
+    public abstract IPAddress<?> or(IPAddress<?> other);
+
+    /**
+     * Returns a new IPAddress object with the bits inverted
+     * @return  IPAddress<?>
+     */
+    public abstract IPAddress<?> not();
+
     @Override
     public abstract boolean equals(Object other);
 
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
index 2087ab4..ada2d38 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
@@ -9,6 +9,14 @@
 
     public abstract IPVersion getIpVersion();
 
+    public IPAddress<?> getSubnetBroadcastAddress() {
+        return value.or(mask.not());
+    }
+
+    public boolean isSubnetBroadcastAddress(IPAddress<?> candidate) {
+        return getSubnetBroadcastAddress().equals(candidate);
+    }
+
     public static IPAddressWithMask<?> of(String ip) {
         if (ip == null) {
             throw new NullPointerException("String ip must not be null");
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
index 43a7a17..677fb38 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -69,6 +69,34 @@
         }
     }
 
+    @Override
+    public boolean isBroadcast() {
+        return this.equals(NO_MASK);
+    }
+
+    @Override
+    public IPv4Address and(IPAddress<?> other) {
+        if (other == null) {
+            throw new NullPointerException("Other IP Address must not be null");
+        }
+        IPv4Address otherIp = (IPv4Address) other;
+        return IPv4Address.of(rawValue & otherIp.rawValue);
+    }
+
+    @Override
+    public IPv4Address or(IPAddress<?> other) {
+        if (other == null) {
+            throw new NullPointerException("Other IP Address must not be null");
+        }
+        IPv4Address otherIp = (IPv4Address) other;
+        return IPv4Address.of(rawValue | otherIp.rawValue);
+    }
+
+    @Override
+    public IPv4Address not() {
+        return IPv4Address.of(~rawValue);
+    }
+
     public static IPv4Address of(final byte[] address) {
         if (address == null) {
             throw new NullPointerException("Address must not be null");
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index c9dea13..5dcaa6e 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -93,6 +93,34 @@
         }
     }
 
+    @Override
+    public boolean isBroadcast() {
+        return this.equals(NO_MASK);
+    }
+
+    @Override
+    public IPv6Address and(IPAddress<?> other) {
+        if (other == null) {
+            throw new NullPointerException("Other IP Address must not be null");
+        }
+        IPv6Address otherIp = (IPv6Address) other;
+        return IPv6Address.of((raw1 & otherIp.raw1), (raw2 & otherIp.raw2));
+    }
+
+    @Override
+    public IPv6Address or(IPAddress<?> other) {
+        if (other == null) {
+            throw new NullPointerException("Other IP Address must not be null");
+        }
+        IPv6Address otherIp = (IPv6Address) other;
+        return IPv6Address.of((raw1 | otherIp.raw1), (raw2 | otherIp.raw2));
+    }
+
+    @Override
+    public IPv6Address not() {
+        return IPv6Address.of(~raw1, ~raw2);
+    }
+
     public static IPv6Address of(final byte[] address) {
         if (address == null) {
             throw new NullPointerException("Address must not be null");
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
index 334ec0d..bd2c945 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv4AddressTest.java
@@ -104,6 +104,29 @@
     };
 
     @Test
+    public void testLogicalOperatorsBroadcast() {
+        assertTrue(IPv4Address.NO_MASK.not().equals(IPv4Address.FULL_MASK));
+        assertTrue(IPv4Address.NO_MASK.or(IPv4Address.FULL_MASK).
+                   equals(IPv4Address.NO_MASK));
+        assertTrue(IPv4Address.NO_MASK.and(IPv4Address.FULL_MASK).
+                   equals(IPv4Address.FULL_MASK));
+
+        assertTrue(IPv4Address.NO_MASK.isBroadcast());
+        assertTrue(!IPv4Address.FULL_MASK.isBroadcast());
+    }
+
+    @Test
+    public void testMaskedSubnetBroadcast() {
+        assertTrue(IPv4AddressWithMask.of("10.10.10.1/24")
+                   .getSubnetBroadcastAddress()
+                   .equals(IPv4Address.of("10.10.10.255")));
+        assertTrue(IPv4AddressWithMask.of("10.10.10.1/24")
+                   .isSubnetBroadcastAddress(IPv4Address.of("10.10.10.255")));
+        assertTrue(!IPv4AddressWithMask.of("10.10.10.1/24")
+                   .isSubnetBroadcastAddress(IPv4Address.of("10.10.10.254")));
+    }
+
+    @Test
     public void testMaskedMatchesCidr() {
         IPv4AddressWithMask slash28 = IPv4AddressWithMask.of("10.0.42.16/28");
 
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
index c521292..da31470 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPv6AddressTest.java
@@ -76,6 +76,29 @@
     };
 
     @Test
+    public void testLogicalOperatorsBroadcast() {
+        assertTrue(IPv6Address.NO_MASK.not().equals(IPv6Address.FULL_MASK));
+        assertTrue(IPv6Address.NO_MASK.or(IPv6Address.FULL_MASK).
+                   equals(IPv6Address.NO_MASK));
+        assertTrue(IPv6Address.NO_MASK.and(IPv6Address.FULL_MASK).
+                   equals(IPv6Address.FULL_MASK));
+
+        assertTrue(IPv6Address.NO_MASK.isBroadcast());
+        assertTrue(!IPv6Address.FULL_MASK.isBroadcast());
+    }
+
+    @Test
+    public void testMaskedSubnetBroadcast() {
+        assertTrue(IPv6AddressWithMask.of("10:10::1/112")
+                   .getSubnetBroadcastAddress()
+                   .equals(IPv6Address.of("10:10::ffff")));
+        assertTrue(IPv6AddressWithMask.of("10:10::1/112")
+                   .isSubnetBroadcastAddress(IPv6Address.of("10:10::ffff")));
+        assertTrue(!IPv6AddressWithMask.of("10:10::1/112")
+                   .isSubnetBroadcastAddress(IPv6Address.of("10:10::fffd")));
+    }
+
+    @Test
     public void testConstants() {
         byte[] zeros = { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
                          (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,