diff options
Diffstat (limited to 'src/jcgp/backend/function/UnsignedInteger.java')
-rw-r--r-- | src/jcgp/backend/function/UnsignedInteger.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/jcgp/backend/function/UnsignedInteger.java b/src/jcgp/backend/function/UnsignedInteger.java index 7feb33f..d23862c 100644 --- a/src/jcgp/backend/function/UnsignedInteger.java +++ b/src/jcgp/backend/function/UnsignedInteger.java @@ -14,7 +14,12 @@ package jcgp.backend.function; * signed and will behave as such for all arithmetic operations. * Bitwise operations can still be performed as they work at the bit * level, making this data type particularly suitable for circuit design. - * + * <br><br> + * TODO in the unlikely event that unsigned integers are natively + * implemented in Java, they should be used instead of this class. + * <br><br> + * Why are unsigned integers not supported?<br> + * http://stackoverflow.com/questions/430346/why-doesnt-java-support-unsigned-ints * * @author Eduardo Pedroni * @see Integer @@ -27,7 +32,7 @@ public class UnsignedInteger { /** * Makes a new instance of UnsignedInteger with a specified value. * - * @param i the value with which to initialise + * @param i the value with which to initialise. */ public UnsignedInteger(int i) { value = new Integer(i); @@ -36,7 +41,7 @@ public class UnsignedInteger { /** * Makes a new instance of UnsignedInteger with a specified value. * - * @param i the value with which to initialise + * @param i the value with which to initialise. */ public UnsignedInteger(Integer i) { value = i; @@ -46,14 +51,14 @@ public class UnsignedInteger { * Makes a new instance of UnsignedInteger from the string representation * of an unsigned integer. * - * @param i the string with which to initialise + * @param i the string with which to initialise. */ public UnsignedInteger(String i) { value = Integer.parseUnsignedInt(i); } /** - * @return the wrapped Integer object + * @return the wrapped Integer object. */ public Integer get() { return value; @@ -61,6 +66,11 @@ public class UnsignedInteger { @Override public String toString() { + /* + * It is important to override this so that + * the visual representation of the integer + * is unsigned as well. + */ return Integer.toUnsignedString(value); } } |