|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectJSci.maths.MathInteger
public final class MathInteger
The MathInteger class encapsulates integer numbers.
IntegerRing,
Serialized Form| Constructor Summary | |
|---|---|
MathInteger(int num)
Constructs an integer number. |
|
MathInteger(java.lang.String s)
Constructs the integer number represented by a string. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||