|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Number JSci.maths.MathInteger
The MathInteger class encapsulates integer numbers.
IntegerRing
,
Serialized FormConstructor 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. |
double |
doubleValue()
|
boolean |
equals(java.lang.Object obj)
Compares two integer numbers for equality. |
float |
floatValue()
|
int |
intValue()
|
boolean |
isEven()
Returns true if this number is even. |
boolean |
isOdd()
Returns true if this number is odd. |
long |
longValue()
|
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.Number |
byteValue, shortValue |
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)
obj
- an integer number.public int compareTo(java.lang.Object obj) throws java.lang.IllegalArgumentException
compareTo
in interface java.lang.Comparable
obj
- an integer number.
this<obj
,
zero if this==obj
,
and a positive value if this>obj
.
java.lang.IllegalArgumentException
public java.lang.String toString()
public int value()
public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()
public boolean isEven()
public boolean isOdd()
public AbelianGroup.Member negate()
negate
in interface AbelianGroup.Member
public AbelianGroup.Member add(AbelianGroup.Member n)
add
in interface AbelianGroup.Member
n
- a group memberpublic MathInteger add(MathInteger n)
public AbelianGroup.Member subtract(AbelianGroup.Member n)
subtract
in interface AbelianGroup.Member
n
- a group memberpublic MathInteger subtract(MathInteger n)
n
- an integer number.public Ring.Member multiply(Ring.Member n)
multiply
in interface Ring.Member
n
- 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 |