Class RealInfinity
java.lang.Object
edu.udel.cis.vsl.sarl.number.real.RealNumber
edu.udel.cis.vsl.sarl.number.real.RealInfinity
- All Implemented Interfaces:
Number,Comparable<Number>
- Direct Known Subclasses:
RealIntegerInfinity,RealRationalInfinity
An abstract class represents the infinite real number.
According to the data-type (integer/rational), it has two derived sub-class:
According to the data-type (integer/rational), it has two derived sub-class:
RealIntegerInfinity and RealRationalInfinity-
Method Summary
Modifier and TypeMethodDescriptionThe string representation used when this number appears inside of another expression.booleanIs this number infinite?booleanisOne()Is this number equal to 1?booleanisZero()Is this number equal to 0? Same as signum() == 0, but sometimes more convenient.intnumericalCompareTo(Number other) This is a numerical comparison, so the order is a numerical order based on the value of this and other.intsignum()Returns 0 if this number equals 0, -1 if this number is negative, 1 if this number is positive.toString()Methods inherited from class edu.udel.cis.vsl.sarl.number.real.RealNumber
compareTo
-
Method Details
-
signum
public int signum()Description copied from interface:NumberReturns 0 if this number equals 0, -1 if this number is negative, 1 if this number is positive. -
isZero
public boolean isZero()Description copied from interface:NumberIs this number equal to 0? Same as signum() == 0, but sometimes more convenient. -
isOne
public boolean isOne()Description copied from interface:NumberIs this number equal to 1? -
isInfinite
public boolean isInfinite()Description copied from interface:NumberIs this number infinite?- Returns:
true, if it is positive/negative infinity;
false, if it is finite.
-
toString
-
atomString
Description copied from interface:NumberThe string representation used when this number appears inside of another expression. For example if the number is 3/4, this method could return (3/4), because in the expression 10*(3/4) you really need the parentheses. On the other hand, if the representation is 0.75, the parens probably are not necessary, and this method might return the same thing as the toString() method. -
numericalCompareTo
Description copied from interface:NumberThis is a numerical comparison, so the order is a numerical order based on the value of this and other.- Parameters:
other- a non-nullNumberwith the same type with this.- Returns:
- Returns a positive value if this is greater than other, 0 if this equals other, a negative value if this is less than other.
-