Renamed types IPv4, IPv6 to IPv4Address, IPv6Address
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
similarity index 75%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
index 401d79b..ad454eb 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -5,38 +5,38 @@
/**
- * Wrapper around an IPv4 address
+ * Wrapper around an IPv4Address address
*
* @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
*/
-public class IPv4 implements OFValueType<IPv4> {
+public class IPv4Address implements OFValueType<IPv4Address> {
static final int LENGTH = 4;
private final int rawValue;
-
- public static final IPv4 NO_MASK = IPv4.of(0xFFFFFFFF);
- public static final IPv4 FULL_MASK = IPv4.of(0x00000000);
- private IPv4(final int rawValue) {
+ public static final IPv4Address NO_MASK = IPv4Address.of(0xFFFFFFFF);
+ public static final IPv4Address FULL_MASK = IPv4Address.of(0x00000000);
+
+ private IPv4Address(final int rawValue) {
this.rawValue = rawValue;
}
- public static IPv4 of(final byte[] address) {
+ public static IPv4Address of(final byte[] address) {
if (address.length != LENGTH) {
throw new IllegalArgumentException(
- "Invalid byte array length for IPv4 address: " + address);
+ "Invalid byte array length for IPv4Address address: " + address);
}
int raw =
(address[0] & 0xFF) << 24 | (address[1] & 0xFF) << 16
| (address[2] & 0xFF) << 8 | (address[3] & 0xFF) << 0;
- return IPv4.of(raw);
+ return IPv4Address.of(raw);
}
- public static IPv4 of(final int raw) {
- return new IPv4(raw);
+ public static IPv4Address of(final int raw) {
+ return new IPv4Address(raw);
}
- public static IPv4 of(final String string) {
+ public static IPv4Address of(final String string) {
int start = 0;
int shift = 24;
@@ -57,7 +57,7 @@
shift -= 8;
start = end + 1;
}
- return IPv4.of(raw);
+ return IPv4Address.of(raw);
}
public int getInt() {
@@ -112,24 +112,24 @@
return false;
if (getClass() != obj.getClass())
return false;
- IPv4 other = (IPv4) obj;
+ IPv4Address other = (IPv4Address) obj;
if (rawValue != other.rawValue)
return false;
return true;
}
-
+
public void write4Bytes(ChannelBuffer c) {
c.writeInt(rawValue);
}
-
- public static IPv4 read4Bytes(ChannelBuffer c) {
- return IPv4.of(c.readInt());
+
+ public static IPv4Address read4Bytes(ChannelBuffer c) {
+ return IPv4Address.of(c.readInt());
}
@Override
- public IPv4 applyMask(IPv4 mask) {
- return IPv4.of(this.rawValue & mask.rawValue);
+ public IPv4Address applyMask(IPv4Address mask) {
+ return IPv4Address.of(this.rawValue & mask.rawValue);
}
-
+
}
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/IPv4WithMask.java
index d2f2cc7..dadbac2 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/IPv4WithMask.java
@@ -1,12 +1,12 @@
package org.projectfloodlight.openflow.types;
-public class IPv4WithMask extends Masked<IPv4> {
+public class IPv4WithMask extends Masked<IPv4Address> {
private IPv4WithMask(int rawValue, int rawMask) {
- super(IPv4.of(rawValue), IPv4.of(rawMask));
+ super(IPv4Address.of(rawValue), IPv4Address.of(rawMask));
}
- private IPv4WithMask(IPv4 value, IPv4 mask) {
+ private IPv4WithMask(IPv4Address value, IPv4Address mask) {
super(value, mask);
}
@@ -14,23 +14,23 @@
return new IPv4WithMask(rawValue, rawMask);
}
- public static IPv4WithMask of(IPv4 value, IPv4 mask) {
+ public static IPv4WithMask of(IPv4Address value, IPv4Address mask) {
return new IPv4WithMask(value, mask);
}
@Override
public String toString() {
StringBuilder res = new StringBuilder();
- res.append(((IPv4)value).toString());
+ res.append(((IPv4Address)value).toString());
- int maskint = ((IPv4)mask).getInt();
+ int maskint = ((IPv4Address)mask).getInt();
res.append('/');
if (Integer.bitCount((~maskint) + 1) == 1) {
// CIDR notation
res.append(Integer.bitCount(maskint));
} else {
// Full address mask
- res.append(((IPv4)mask).toString());
+ res.append(((IPv4Address)mask).toString());
}
return res.toString();
@@ -40,7 +40,7 @@
int slashPos;
String ip = string;
int maskBits = 0;
- IPv4 maskAddress = null;
+ IPv4Address maskAddress = null;
// Read mask suffix
if ((slashPos = string.indexOf('/')) != -1) {
@@ -51,7 +51,7 @@
throw new IllegalArgumentException("IP Address not well formed: " + string);
if (suffix.indexOf('.') != -1) {
// Full mask
- maskAddress = IPv4.of(suffix);
+ maskAddress = IPv4Address.of(suffix);
} else {
// CIDR Suffix
maskBits = Integer.parseInt(suffix);
@@ -65,18 +65,18 @@
}
// Read IP
- IPv4 ipv4 = IPv4.of(ip);
+ IPv4Address ipv4 = IPv4Address.of(ip);
if (maskAddress != null) {
// Full address mask
return IPv4WithMask.of(ipv4, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv4WithMask.of(ipv4, IPv4.NO_MASK);
+ return IPv4WithMask.of(ipv4, IPv4Address.NO_MASK);
} else {
// With mask
int mask = (-1) << (32 - maskBits);
- return IPv4WithMask.of(ipv4, IPv4.of(mask));
+ return IPv4WithMask.of(ipv4, IPv4Address.of(mask));
}
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
similarity index 90%
rename from java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
rename to java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index 0907d17..001f185 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -11,20 +11,20 @@
*
* @author Andreas Wundsam <andreas.wundsam@teleteach.de>
*/
-public class IPv6 implements OFValueType<IPv6> {
+public class IPv6Address implements OFValueType<IPv6Address> {
static final int LENGTH = 16;
private final long raw1;
private final long raw2;
- public static final IPv6 NO_MASK = IPv6.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
- public static final IPv6 FULL_MASK = IPv6.of(0x0, 0x0);
+ public static final IPv6Address NO_MASK = IPv6Address.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
+ public static final IPv6Address FULL_MASK = IPv6Address.of(0x0, 0x0);
- private IPv6(final long raw1, final long raw2) {
+ private IPv6Address(final long raw1, final long raw2) {
this.raw1 = raw1;
this.raw2 = raw2;
}
- public static IPv6 of(final byte[] address) {
+ public static IPv6Address of(final byte[] address) {
if (address.length != LENGTH) {
throw new IllegalArgumentException(
"Invalid byte array length for IPv6 address: " + address);
@@ -42,7 +42,7 @@
| (address[12] & 0xFFL) << 24 | (address[13] & 0xFFL) << 16
| (address[14] & 0xFFL) << 8 | (address[15]);
- return IPv6.of(raw1, raw2);
+ return IPv6Address.of(raw1, raw2);
}
private static class IPv6Builder {
@@ -62,14 +62,14 @@
throw new IllegalArgumentException("16 bit word index must be in [0,7]");
}
- public IPv6 getIPv6() {
- return IPv6.of(raw1, raw2);
+ public IPv6Address getIPv6() {
+ return IPv6Address.of(raw1, raw2);
}
}
private final static Pattern colonPattern = Pattern.compile(":");
- public static IPv6 of(final String string) {
+ public static IPv6Address of(final String string) {
IPv6Builder builder = new IPv6Builder();
String[] parts = colonPattern.split(string, -1);
@@ -122,8 +122,8 @@
return builder.getIPv6();
}
- public static IPv6 of(final long raw1, final long raw2) {
- return new IPv6(raw1, raw2);
+ public static IPv6Address of(final long raw1, final long raw2) {
+ return new IPv6Address(raw1, raw2);
}
volatile byte[] bytesCache = null;
@@ -265,7 +265,7 @@
return false;
if (getClass() != obj.getClass())
return false;
- IPv6 other = (IPv6) obj;
+ IPv6Address other = (IPv6Address) obj;
if (raw1 != other.raw1)
return false;
if (raw2 != other.raw2)
@@ -278,12 +278,12 @@
c.writeLong(this.raw2);
}
- public static IPv6 read16Bytes(ChannelBuffer c) throws OFParseError {
- return IPv6.of(c.readLong(), c.readLong());
+ public static IPv6Address read16Bytes(ChannelBuffer c) throws OFParseError {
+ return IPv6Address.of(c.readLong(), c.readLong());
}
@Override
- public IPv6 applyMask(IPv6 mask) {
- return IPv6.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
+ public IPv6Address applyMask(IPv6Address mask) {
+ return IPv6Address.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
}
}
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/IPv6WithMask.java
index 894a6dd..1ab4042 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/IPv6WithMask.java
@@ -3,29 +3,29 @@
import java.math.BigInteger;
import java.util.Arrays;
-public class IPv6WithMask extends Masked<IPv6> {
+public class IPv6WithMask extends Masked<IPv6Address> {
- private IPv6WithMask(IPv6 value, IPv6 mask) {
+ private IPv6WithMask(IPv6Address value, IPv6Address mask) {
super(value, mask);
}
- public static IPv6WithMask of(IPv6 value, IPv6 mask) {
+ public static IPv6WithMask of(IPv6Address value, IPv6Address mask) {
return new IPv6WithMask(value, mask);
}
@Override
public String toString() {
StringBuilder res = new StringBuilder();
- res.append(((IPv6)value).toString());
+ res.append(((IPv6Address)value).toString());
res.append('/');
- BigInteger maskint = new BigInteger(((IPv6)mask).getBytes());
+ BigInteger maskint = new BigInteger(((IPv6Address)mask).getBytes());
if (maskint.not().add(BigInteger.ONE).bitCount() == 1) {
// CIDR notation
res.append(maskint.bitCount());
} else {
// Full address mask
- res.append(((IPv6)mask).toString());
+ res.append(((IPv6Address)mask).toString());
}
return res.toString();
@@ -35,7 +35,7 @@
int slashPos;
String ip = string;
int maskBits = 0;
- IPv6 maskAddress = null;
+ IPv6Address maskAddress = null;
// Read mask suffix
if ((slashPos = string.indexOf('/')) != -1) {
@@ -46,7 +46,7 @@
throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
if (suffix.indexOf(':') != -1) {
// Full mask
- maskAddress = IPv6.of(suffix);
+ maskAddress = IPv6Address.of(suffix);
} else {
// CIDR Suffix
maskBits = Integer.parseInt(suffix);
@@ -60,14 +60,14 @@
}
// Read IP
- IPv6 ipv6 = IPv6.of(ip);
+ IPv6Address ipv6 = IPv6Address.of(ip);
if (maskAddress != null) {
// Full address mask
return IPv6WithMask.of(ipv6, maskAddress);
} else if (maskBits == 0) {
// No mask
- return IPv6WithMask.of(ipv6, IPv6.NO_MASK);
+ return IPv6WithMask.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, IPv6.of(maskBytes));
+ return IPv6WithMask.of(ipv6, IPv6Address.of(maskBytes));
}
}