Renamed types IPv4WithMask/IPv6WithMask to IPv4AddressWithMask/IPv6AddressWithMask.
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
similarity index 68%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
index dadbac2..a6ec439 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
@@ -1,42 +1,42 @@
package org.projectfloodlight.openflow.types;
-public class IPv4WithMask extends Masked<IPv4Address> {
+public class IPv4AddressWithMask extends Masked<IPv4Address> {
- private IPv4WithMask(int rawValue, int rawMask) {
+ private IPv4AddressWithMask(int rawValue, int rawMask) {
super(IPv4Address.of(rawValue), IPv4Address.of(rawMask));
}
-
- private IPv4WithMask(IPv4Address value, IPv4Address mask) {
+
+ private IPv4AddressWithMask(IPv4Address value, IPv4Address mask) {
super(value, mask);
}
-
- public static IPv4WithMask of(int rawValue, int rawMask) {
- return new IPv4WithMask(rawValue, rawMask);
+
+ public static IPv4AddressWithMask of(int rawValue, int rawMask) {
+ return new IPv4AddressWithMask(rawValue, rawMask);
}
-
- public static IPv4WithMask of(IPv4Address value, IPv4Address mask) {
- return new IPv4WithMask(value, mask);
+
+ public static IPv4AddressWithMask of(IPv4Address value, IPv4Address mask) {
+ return new IPv4AddressWithMask(value, mask);
}
-
+
@Override
public String toString() {
StringBuilder res = new StringBuilder();
- res.append(((IPv4Address)value).toString());
-
- int maskint = ((IPv4Address)mask).getInt();
+ res.append(value.toString());
+
+ int maskint = mask.getInt();
res.append('/');
if (Integer.bitCount((~maskint) + 1) == 1) {
// CIDR notation
res.append(Integer.bitCount(maskint));
} else {
// Full address mask
- res.append(((IPv4Address)mask).toString());
+ res.append(mask.toString());
}
-
+
return res.toString();
}
-
- public static IPv4WithMask of(final String string) {
+
+ public static IPv4AddressWithMask of(final String string) {
int slashPos;
String ip = string;
int maskBits = 0;
@@ -63,20 +63,20 @@
throw new IllegalArgumentException("IP Address not well formed: " + string);
}
}
-
+
// Read IP
IPv4Address ipv4 = IPv4Address.of(ip);
-
+
if (maskAddress != null) {
// Full address mask
- return IPv4WithMask.of(ipv4, maskAddress);
+ return IPv4AddressWithMask.of(ipv4, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv4WithMask.of(ipv4, IPv4Address.NO_MASK);
+ return IPv4AddressWithMask.of(ipv4, IPv4Address.NO_MASK);
} else {
// With mask
int mask = (-1) << (32 - maskBits);
- return IPv4WithMask.of(ipv4, IPv4Address.of(mask));
+ return IPv4AddressWithMask.of(ipv4, IPv4Address.of(mask));
}
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
similarity index 83%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
index 1ab4042..16ff5b1 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
@@ -3,14 +3,14 @@
import java.math.BigInteger;
import java.util.Arrays;
-public class IPv6WithMask extends Masked<IPv6Address> {
+public class IPv6AddressWithMask extends Masked<IPv6Address> {
- private IPv6WithMask(IPv6Address value, IPv6Address mask) {
+ private IPv6AddressWithMask(IPv6Address value, IPv6Address mask) {
super(value, mask);
}
- public static IPv6WithMask of(IPv6Address value, IPv6Address mask) {
- return new IPv6WithMask(value, mask);
+ public static IPv6AddressWithMask of(IPv6Address value, IPv6Address mask) {
+ return new IPv6AddressWithMask(value, mask);
}
@Override
@@ -31,7 +31,7 @@
return res.toString();
}
- public static IPv6WithMask of(final String string) {
+ public static IPv6AddressWithMask of(final String string) {
int slashPos;
String ip = string;
int maskBits = 0;
@@ -64,10 +64,10 @@
if (maskAddress != null) {
// Full address mask
- return IPv6WithMask.of(ipv6, maskAddress);
+ return IPv6AddressWithMask.of(ipv6, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv6WithMask.of(ipv6, IPv6Address.NO_MASK);
+ return IPv6AddressWithMask.of(ipv6, IPv6Address.NO_MASK);
} else {
// With mask
BigInteger mask = BigInteger.ONE.negate().shiftLeft(128 - maskBits);
@@ -83,7 +83,7 @@
} else {
maskBytes = maskBytesTemp;
}
- return IPv6WithMask.of(ipv6, IPv6Address.of(maskBytes));
+ return IPv6AddressWithMask.of(ipv6, IPv6Address.of(maskBytes));
}
}
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 871b3ef..4f3f968 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
@@ -110,7 +110,7 @@
@Test
public void testOfMasked() throws OFParseError {
for (int i = 0; i < ipsWithMask.length; i++) {
- IPv4WithMask value = IPv4WithMask.of(ipsWithMask[i]);
+ IPv4AddressWithMask value = IPv4AddressWithMask.of(ipsWithMask[i]);
if (!hasMask[i]) {
IPv4Address ip = value.getValue();
assertArrayEquals(ipsWithMaskValues[i][0], ip.getBytes());
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 fba4d9e..3fcfe23 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
@@ -57,14 +57,14 @@
@Test
public void testMasked() throws UnknownHostException {
for(int i=0; i < ipsWithMask.length; i++ ) {
- IPv6WithMask value = IPv6WithMask.of(ipsWithMask[i]);
+ IPv6AddressWithMask value = IPv6AddressWithMask.of(ipsWithMask[i]);
if (!hasMask[i]) {
IPv6Address ip = value.getValue();
InetAddress inetAddress = InetAddress.getByName(ipsWithMask[i]);
assertArrayEquals(ip.getBytes(), inetAddress.getAddress());
assertEquals(ipsWithMask[i], ip.toString());
- } else if (value instanceof IPv6WithMask && hasMask[i]) {
+ } else if (value instanceof IPv6AddressWithMask && hasMask[i]) {
InetAddress inetAddress = InetAddress.getByName(ipsWithMask[i].substring(0, ipsWithMask[i].indexOf('/')));
byte[] address = inetAddress.getAddress();