public final class MathInteger extends java.lang.Object implements java.lang.Comparable, Ring.Member
IntegerRing,
Serialized Form| Constructor and Description |
|---|
MathInteger(int num)
Constructs an integer number.
|
MathInteger(java.lang.String s)
Constructs the integer number represented by a string.
|
| Modifier and Type | Method and Description |
|---|---|
AbelianGroup.Member |
add(AbelianGroup.Member n)
Returns the addition of this number and another.
|
MathInteger |
add(MathInteger n)
Returns the addition of this integer number and another.
|
int |
compareTo(java.lang.Object obj)
Compares two integer numbers.
|
boolean |
equals(java.lang.Object obj)
Compares two integer numbers for equality.
|
boolean |
isEven()
Returns true if this number is even.
|
boolean |
isOdd()
Returns true if this number is odd.
|
MathInteger |
multiply(MathInteger n)
Returns the multiplication of this integer number and another.
|
Ring.Member |
multiply(Ring.Member n)
Returns the multiplication of this number and another.
|
AbelianGroup.Member |
negate()
Returns the negative of this number.
|
MathInteger |
pow(MathInteger n)
Returns this integer number raised to the power of another.
|
AbelianGroup.Member |
subtract(AbelianGroup.Member n)
Returns the subtraction of this number and another.
|
MathInteger |
subtract(MathInteger n)
Returns the subtraction of this integer number and another.
|
java.lang.String |
toString()
Returns a string representing the value of this integer number.
|
int |
value()
Returns the integer value.
|
public MathInteger(int num)
public MathInteger(java.lang.String s)
throws java.lang.NumberFormatException
s - a string representing an integer number.java.lang.NumberFormatException - if the string does not contain a parsable number.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - an integer number.public int compareTo(java.lang.Object obj)
throws java.lang.IllegalArgumentException
compareTo in interface java.lang.Comparableobj - an integer number.this<obj,
zero if this==obj,
and a positive value if this>obj.java.lang.IllegalArgumentExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int value()
public boolean isEven()
public boolean isOdd()
public AbelianGroup.Member negate()
negate in interface AbelianGroup.Memberpublic AbelianGroup.Member add(AbelianGroup.Member n)
add in interface AbelianGroup.Membern - a group memberpublic MathInteger add(MathInteger n)
public AbelianGroup.Member subtract(AbelianGroup.Member n)
subtract in interface AbelianGroup.Membern - a group memberpublic MathInteger subtract(MathInteger n)
n - an integer number.public Ring.Member multiply(Ring.Member n)
multiply in interface Ring.Membern - a ring memberpublic MathInteger multiply(MathInteger n)
n - an integer number.public MathInteger pow(MathInteger n)
n - an integer number.