|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Numeric
ATNumeric is the public interface common to numbers and fractions. This interface extends ATExpression as a number or fraction can also be output by the parser as a literal.
Method Summary | |
---|---|
Numeric |
/(Numeric other)
Division infix operator ("/"). |
Boolean |
=(Numeric other)
Returns true if the receiver is equal to the numeric data type passed as argument. |
Boolean |
>=(Numeric other)
Returns true if the receiver is greater than or equal to the numeric data type passed as argument. |
Boolean |
>(Numeric other)
Returns true if the receiver is greater than the numeric data type passed as argument. |
Numeric |
<=>(Numeric other)
Generalized equality infix operator. |
Boolean |
<=(Numeric other)
Returns true if the receiver is smaller than or equal to the numeric data type passed as argument. |
Boolean |
<(Numeric other)
Returns true if the receiver is smaller than the numeric data type passed as argument. |
Numeric |
-(Numeric other)
Subtraction infix operator. |
Boolean |
!=(Object other)
Returns true if the receiver is different than the numeric data type passed as argument. |
Numeric |
+(Numeric other)
Addition infix operator. |
Numeric |
*(Numeric other)
Multiplication infix operator. |
Numeric |
addFraction(Fraction other)
Returns the value resulting of the sum of the receiver and a fraction passed as argument. |
Numeric |
addNumber(Number other)
Returns the value resulting of the sum of the receiver and a number passed as argument. |
Number |
ceiling()
Returns the closest number to negative infinity that is greater than the fraction. |
Fraction |
cos()
Returns the trigonometric cosine of the numeric data type representing an angle in radians. |
Numeric |
divideFraction(Fraction other)
Returns the value resulting of dividing a number passed as argument by the receiver. |
Numeric |
divideNumber(Number other)
Returns the value resulting of dividing a number passed as argument by the receiver. |
Fraction |
expt(Numeric pow)
Returns the numeric data type raised to the power of the argument. |
Number |
floor()
Returns the closest number to positive infinity that is smaller than the fraction. |
Numeric |
gequalsFraction(Fraction other)
Returns the value of evaluating the generalized equality between the numeric data type and a fraction. |
Numeric |
gequalsNumber(Number other)
Returns the value of evaluating the generalized equality between the numeric data type and a number. |
Fraction |
log()
Returns the natural logarithm (base e) of the numeric data type. |
Number |
round()
Returns the closest number to the fraction. |
Fraction |
sin()
Returns the trigonometric sine of the numeric data type representing an angle in radians. |
Fraction |
sqrt()
Returns the positive square root of the numeric data type. |
Numeric |
subtractFraction(Fraction other)
Returns the value resulting of the subtracting the receiver from a fraction passed as argument. |
Numeric |
subtractNumber(Number other)
Returns the value resulting of subtracting the receiver from a number passed as argument. |
Fraction |
tan()
Returns the trigonometric tangent of the numeric data type representing an angle in radians. |
Numeric |
timesFraction(Fraction other)
Returns the value resulting of multiplying the receiver by a fraction passed as argument. |
Numeric |
timesNumber(Number other)
Returns the value resulting of multiplying the receiver by a number passed as argument. |
Text |
toText()
Converts the numeric value into a text string. |
Methods inherited from interface edu.vub.at.objects.AbstractGrammar |
---|
freeVariables |
Methods inherited from interface edu.vub.at.objects.Object |
---|
super |
Method Detail |
---|
Fraction cos()
Fraction sin()
Fraction tan()
Fraction log()
Fraction sqrt()
Number round()
More specifically, rounding a number is equivalent to (fraction + 0.5).floor()
Number floor()
Number ceiling()
Fraction expt(Numeric pow)
pow
- a ATNumeric data type representing the exponent.
XTypeMismatch
- if the exponent is not an ATNumeric
object.Numeric +(Numeric other)
More specifically, this operator actually calls:
other.addNumber(this) if the receiver is a Number
other.addFraction(this) if the receiver is a Fraction
other
- a numeric data type.
Numeric addNumber(Number other)
More specifically, this method returns a Number
if both numeric data types to sum are Number
objects.
Otherwise, an Fraction
is returned.
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the addition operator.
other
- a number.
XTypeMismatch
- if other is not an ATNumber
object.Numeric addFraction(Fraction other)
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the addition operator.
other
- a fraction.
Fraction
resulting of the sum of the receiver and other.
XTypeMismatch
- if other is not an ATFraction
object.Numeric -(Numeric other)
More specifically, this operator actually calls:
other.subtractNumber(this) if the receiver is a Number
other.subtractFraction(this) if the receiver is a Fraction
other
- a numeric data type.
Numeric subtractNumber(Number other)
More specifically, this method returns a Number
if both numeric data types to subtract are Number
objects.
Otherwise, an Fraction
is returned.
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the subtraction operator.
other
- a number.
XTypeMismatch
- if other is not an ATNumber
object.Numeric subtractFraction(Fraction other)
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the subtraction operator.
other
- a fraction.
Fraction
resulting of subtracting other from the receiver.
XTypeMismatch
- if other is not an ATFraction
object.Numeric *(Numeric other)
More specifically, this operator actually calls:
other.timesNumber(this) if the receiver is a Number
other.timesFraction(this) if the receiver is a Fraction
other
- a numeric data type.
Numeric timesNumber(Number other)
More specifically, this method returns a Number
if both numeric data types to multiply are Number
objects.
Otherwise, an Fraction
is returned.
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the multiplication operator.
other
- a number.
XTypeMismatch
- if other is not an ATNumber
object.Numeric timesFraction(Fraction other)
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the multiplication operator.
other
- a fraction.
Fraction
resulting of multiplying the receiver by other.
XTypeMismatch
- if other is not an ATFraction
object.Numeric /(Numeric other)
More specifically, this operator actually calls:
other.divideNumber(this) if the receiver is a Number
other.divideFraction(this) if the receiver is a Fraction
other
- a numeric data type.
Numeric divideNumber(Number other)
More specifically, this method returns a Number
if both numeric data types to multiply are Number
objects.
Otherwise, an Fraction
is returned.
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the division operator.
other
- a number.
XTypeMismatch
- if other is not an ATNumber
object.
XIllegalArgument
- if the receiver is 0.Numeric divideFraction(Fraction other)
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the division operator.
other
- a fraction.
Fraction
resulting of dividing a given number by the receiver.
XTypeMismatch
- if other is not an ATFraction
object.
XIllegalArgument
- if the receiver is 0.Numeric <=>(Numeric other)
This method actually calls:
other.gequalsNumber(this) if the receiver is a Number
other.gequalsFraction(this) if the receiver is a Fraction
other
- a numeric data type.
Numeric gequalsNumber(Number other)
The generalized equality returns:
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the generalized equality operator.
other
- a number.
Number
resulting of applying the generalized equality between the receiver and other.
XTypeMismatch
- if other is not an ATNumber
object.Numeric gequalsFraction(Fraction other)
The generalized equality returns:
Note that this is a double-dispatch method used to determine the correct runtime type of both arguments of the generalized equality operator.
other
- a number.
Number
resulting of applying the generalized equality between the receiver and other.
XTypeMismatch
- if other is not an ATFraction
object.Boolean <(Numeric other)
other
- a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) == -1
XTypeMismatch
- if other is not an ATNumeric
object.Boolean >(Numeric other)
other
- a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) == 1
XTypeMismatch
- if other is not an ATNumeric
object.Boolean <=(Numeric other)
other
- a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) != 1
XTypeMismatch
- if other is not an ATNumeric
object.Boolean >=(Numeric other)
other
- a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) != -1
XTypeMismatch
- if other is not an ATNumeric
object.Boolean =(Numeric other)
other
- a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) == 0
XTypeMismatch
- if other is not an ATNumeric
object.Boolean !=(Object other)
other
- an object which compared to this one only if it is a numeric data type.
Boolean
resulting of evaluating (receiver <=> other) != 0
XTypeMismatch
- if other is not an ATNumeric
object.Text toText()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |