|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Number
org.jmlspecs.models.resolve.NaturalNumber
The natural numbers. These are essentially unlimited in size.
BigInteger,
JMLFiniteInteger| Field Summary | |
private static NaturalNumber |
intMaxVal
The maximum integer as a natural number. |
static NaturalNumber |
ONE
The natural number one. |
private BigInteger |
value
The value of this natural number. |
static NaturalNumber |
ZERO
The natural number zero. |
| Fields inherited from class java.lang.Number |
|
| Constructor Summary | |
NaturalNumber()
Initialize this natural number to zero. |
|
NaturalNumber(BigInteger val)
Initialize this natural number to the given BigInteger value. |
|
NaturalNumber(long val)
Initialize this natural number to the given long value. |
|
| Method Summary | |
NaturalNumber |
add(NaturalNumber val)
Return the sum of this natural number and the given one. |
BigInteger |
bigIntegerValue()
Return the BigInteger value of this natural number. |
Object |
clone()
Return a clone of this object. |
int |
compareTo(Object o)
Compare this to obj, returning negative if this is strictly less than obj, 0 if they are equal, and positive otherwise. |
int |
compareTo(NaturalNumber val)
Return negative if this natural numbers strictly less than the given one, 0 if they are equal, and positive if this natural numbers is strictly greater than the given one. |
NaturalNumber |
divide(NaturalNumber val)
Return the quotient of this natural number divided by the given one. |
boolean |
divides(NaturalNumber val)
Tell if this natural number divides the given one evenly. |
double |
doubleValue()
|
boolean |
equals(Object x)
Tell if this object is equal to the given argument. |
float |
floatValue()
|
NaturalNumber |
gcd(NaturalNumber val)
Return the greatest common denominator of this number and the given number. |
int |
hashCode()
Return a hash code for this object. |
int |
intValue()
|
boolean |
isZero()
Tell if this object is equal to zero. |
long |
longValue()
|
NaturalNumber |
max(NaturalNumber val)
Return the smaller of the given natural number and this one. |
NaturalNumber |
min(NaturalNumber val)
Return the smaller of the given natural number and this one. |
NaturalNumber |
mod(NaturalNumber m)
Return this natural number modulo the given one. |
NaturalNumber |
multiply(NaturalNumber val)
Return the product of this natural number and the given one. |
NaturalNumber |
pow(int exponent)
Return this natural number multiplied by itself the given number of times. |
NaturalNumber |
pow(NaturalNumber exponent)
Return this natural number multiplied by itself the given number of times. |
NaturalNumber |
remainder(NaturalNumber val)
Return the remainder of this natural number divided by the given one. |
NaturalNumber |
shiftLeft(int n)
Return this natural number left shifted the given number of bits. |
NaturalNumber |
shiftRight(int n)
Return this natural number right shifted the given number of bits. |
NaturalNumber |
suc()
Return the successor of this natural number. |
static NaturalNumber |
suc(NaturalNumber v)
Return the successor of the given natural number. |
String |
toString()
|
static NaturalNumber |
valueOf(long val)
Return a natural number with the given value. |
| Methods inherited from class java.lang.Number |
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private final BigInteger value
public static final NaturalNumber ZERO
NaturalNumber(),
ONEpublic static final NaturalNumber ONE
NaturalNumber(long),
valueOf(long),
ZEROprivate static final NaturalNumber intMaxVal
| Constructor Detail |
public NaturalNumber()
ZERO,
NaturalNumber(long),
NaturalNumber(BigInteger)
public NaturalNumber(long val)
throws IllegalArgumentException
IllegalArgumentExceptionNaturalNumber(),
NaturalNumber(BigInteger),
valueOf(long)
public NaturalNumber(BigInteger val)
throws IllegalArgumentException
BigInteger value.
IllegalArgumentExceptionNaturalNumber(),
NaturalNumber(BigInteger)| Method Detail |
public static NaturalNumber valueOf(long val)
NaturalNumber(long),
NaturalNumber(BigInteger)public NaturalNumber suc()
suc(NaturalNumber),
add(org.jmlspecs.models.resolve.NaturalNumber),
ONEpublic static NaturalNumber suc(NaturalNumber v)
suc(),
add(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber add(NaturalNumber val)
suc(),
add(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber multiply(NaturalNumber val)
divide(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber divide(NaturalNumber val)
multiply(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber remainder(NaturalNumber val)
divide(org.jmlspecs.models.resolve.NaturalNumber)
public NaturalNumber pow(NaturalNumber exponent)
throws OutOfMemoryError
OutOfMemoryErrormultiply(org.jmlspecs.models.resolve.NaturalNumber),
pow(int)public NaturalNumber pow(int exponent)
multiply(org.jmlspecs.models.resolve.NaturalNumber),
pow(NaturalNumber)public NaturalNumber gcd(NaturalNumber val)
public NaturalNumber mod(NaturalNumber m)
remainder(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber shiftLeft(int n)
shiftRight(int),
pow(int)public NaturalNumber shiftRight(int n)
shiftLeft(int),
pow(int)public int compareTo(NaturalNumber val)
compareTo(Object),
equals(java.lang.Object)
public int compareTo(Object o)
throws ClassCastException
CompareTo
compareTo in interface CompareToClassCastExceptionpublic boolean equals(Object x)
equals in interface JMLTypeequals in class ObjectcompareTo(Object),
compareTo(NaturalNumber),
equals(java.lang.Object)public Object clone()
JMLType
clone in interface JMLTypeclone in class Objectpublic boolean isZero()
ZERO,
compareTo(NaturalNumber),
equals(java.lang.Object)public boolean divides(NaturalNumber val)
remainder(org.jmlspecs.models.resolve.NaturalNumber),
mod(org.jmlspecs.models.resolve.NaturalNumber)public NaturalNumber min(NaturalNumber val)
max(org.jmlspecs.models.resolve.NaturalNumber),
compareTo(NaturalNumber)public NaturalNumber max(NaturalNumber val)
max(org.jmlspecs.models.resolve.NaturalNumber),
compareTo(NaturalNumber)public int hashCode()
JMLType
hashCode in interface JMLTypehashCode in class Objectpublic String toString()
toString in class Objectpublic BigInteger bigIntegerValue()
intValue(),
longValue()public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||