aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/function/UnsignedInteger.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-05-01 13:05:27 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-05-01 13:05:27 +0100
commit36f4393bcc9e55afa2334baa33e603ce839741a1 (patch)
treed9a1d55d0d3553193a3fc11a92f11515762d202f /src/jcgp/backend/function/UnsignedInteger.java
parent4c8de2402f2878cde7587c7f3bbf4ffaea86efd4 (diff)
Did more commenting, implemented reflection and statistics
Diffstat (limited to 'src/jcgp/backend/function/UnsignedInteger.java')
-rw-r--r--src/jcgp/backend/function/UnsignedInteger.java20
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);
}
}