|
|||||||||
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
public final class 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(int y)
|
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()
|
java.lang.Object |
getSet()
|
int |
hashCode()
|
int |
intValue()
|
boolean |
isEven()
Returns true if this number is even. |
boolean |
isOdd()
Returns true if this number is odd. |
long |
longValue()
|
MathInteger |
multiply(int y)
|
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(int y)
|
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, 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.Object
obj
- an integer number.public int hashCode()
hashCode
in class java.lang.Object
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()
toString
in class java.lang.Object
public int value()
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public boolean isEven()
public boolean isOdd()
public java.lang.Object getSet()
getSet
in interface Member
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 MathInteger add(int y)
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 MathInteger subtract(int y)
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 multiply(int y)
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 |