- All Superinterfaces:
Comparable<PsyRealNumeric>
,PsyAdditive<PsyNumeric>
,PsyArithmetic<PsyNumeric>
,PsyConvertableToInteger
,PsyConvertableToIntegral
,PsyConvertableToRational
,PsyConvertableToReal
,PsyMultiplicative<PsyNumeric>
,PsyNumeric
,PsyObject
,PsyRealNumeric
,PsyScalar<PsyRealNumeric>
,PsyValue
- All Known Subinterfaces:
PsyIntegral
- All Known Implementing Classes:
PsyBigFraction
,PsyBigInteger
,PsyFraction
,PsyInteger
@Type("rational")
public sealed interface PsyRational
extends PsyRealNumeric
permits PsyIntegral, PsyFraction, PsyBigFraction
The representation of
rational
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ContextAction
Context action of thedenominator
operator.static final ContextAction
Context action of thegcd
operator.static final ContextAction
Context action of theidiv
operator.static final ContextAction
Context action of thelcm
operator.static final ContextAction
Context action of themod
operator.static final ContextAction
Context action of thenumerator
operator.Fields inherited from interface coneforest.psylla.core.PsyAdditive
PSY_ADD, PSY_ISZERO, PSY_NEG, PSY_NONZERO, PSY_SUB
Fields inherited from interface coneforest.psylla.core.PsyConvertableToInteger
PSY_TOINTEGER
Fields inherited from interface coneforest.psylla.core.PsyConvertableToIntegral
PSY_TOINTEGRAL
Fields inherited from interface coneforest.psylla.core.PsyConvertableToRational
PSY_TORATIONAL
Fields inherited from interface coneforest.psylla.core.PsyConvertableToReal
PSY_TOREAL
Fields inherited from interface coneforest.psylla.core.PsyMultiplicative
PSY_DIV, PSY_MUL, PSY_RECIPROCAL
Fields inherited from interface coneforest.psylla.core.PsyNumeric
PSY_ABS, PSY_ACOS, PSY_ASIN, PSY_ATAN, PSY_CBRT, PSY_COS, PSY_COSH, PSY_EXP, PSY_LOG, PSY_POW, PSY_SIGNUM, PSY_SIN, PSY_SINH, PSY_SQRT, PSY_TAN, PSY_TANH
Fields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPE
Fields inherited from interface coneforest.psylla.core.PsyRealNumeric
PSY_CEILING, PSY_FLOOR, PSY_HYPOT, PSY_ROUND
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
compareTo
(PsyRealNumeric oNumeric) Compares thisscalar
with the specifiedscalar
for order.static PsyRational
of
(PsyIntegral oNumerator, PsyIntegral oDenominator) static PsyRational
parseLiteral
(String image) default PsyRational
psyAbs()
Returns thenumeric
absolute value of this object.default PsyRealNumeric
psyAdd
(PsyRealNumeric oRealNumeric) Returns anintegral
denominator of this fraction.default PsyRealNumeric
psyDiv
(PsyRealNumeric oRealNumeric) psyFloor()
default PsyRational
psyGCD
(PsyRational oRational) Returns arational
representing the greatest common divisor of this object and given object.default PsyIntegral
psyIdiv
(PsyRational oRational) Returns invalid input: 'the quotient of the integer division of this {@code rational} by the {@code rational} divisor. @param oRational the divisor. @throws PsyUndefinedResultException when the divisor is zero.'.default PsyRational
psyLCM
(PsyRational oRational) Returns arational
representing the least common multiplier of this object and given object.default PsyRational
psyMod
(PsyRational oRational) Returns anintegral
representing this object modulo given modulus.default PsyRealNumeric
psyMul
(PsyRealNumeric oRealNumeric) default PsyRational
psyNeg()
Returns theadditive
result of arithmetic negation of this object.Returns anintegral
numerator of this fraction.default PsyRational
Returns the multiplicative inverse of this object.default PsyIntegral
psyRound()
default PsyRealNumeric
psySub
(PsyRealNumeric oRealNumeric) default PsyIntegral
default PsyRational
default PsyRational
Methods inherited from interface coneforest.psylla.core.PsyAdditive
isZero, psyIsZero, psyNonZero
Methods inherited from interface coneforest.psylla.core.PsyNumeric
psySignum
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, toSyntaxString, typeName
Methods inherited from interface coneforest.psylla.core.PsyRealNumeric
doubleValue, imagValue, intValue, longValue, psyAcos, psyAdd, psyAsin, psyAtan, psyCbrt, psyCos, psyCosh, psyDiv, psyEq, psyExp, psyHypot, psyLog, psyMul, psyPow, psyPow, psySin, psySinh, psySqrt, psySub, psyTan, psyTanh, psyToInteger, psyToReal, realValue
-
Field Details
-
PSY_DENOMINATOR
Context action of thedenominator
operator. -
PSY_GCD
Context action of thegcd
operator. -
PSY_IDIV
Context action of theidiv
operator. -
PSY_LCM
Context action of thelcm
operator. -
PSY_MOD
Context action of themod
operator. -
PSY_NUMERATOR
Context action of thenumerator
operator.
-
-
Method Details
-
bigIntegerValue
BigInteger bigIntegerValue() -
rationalValue
- Specified by:
rationalValue
in interfacePsyRealNumeric
-
psyNumerator
PsyIntegral psyNumerator()Returns anintegral
numerator of this fraction.- Returns:
- an
integral
numerator of this fraction
-
psyDenominator
PsyIntegral psyDenominator()Returns anintegral
denominator of this fraction.- Returns:
- an
integral
denominator of this fraction
-
psyToRational
- Specified by:
psyToRational
in interfacePsyConvertableToRational
- Specified by:
psyToRational
in interfacePsyRealNumeric
-
psyRound
- Specified by:
psyRound
in interfacePsyRealNumeric
-
psyToIntegral
- Specified by:
psyToIntegral
in interfacePsyConvertableToIntegral
-
psyNeg
Description copied from interface:PsyAdditive
Returns theadditive
result of arithmetic negation of this object.- Specified by:
psyNeg
in interfacePsyAdditive<PsyNumeric>
- Specified by:
psyNeg
in interfacePsyRealNumeric
- Returns:
- the
additive
result of arithmetic negation of this object
-
psyAdd
- Specified by:
psyAdd
in interfacePsyRealNumeric
-
psySub
- Specified by:
psySub
in interfacePsyRealNumeric
-
psyReciprocal
Description copied from interface:PsyMultiplicative
Returns the multiplicative inverse of this object.- Specified by:
psyReciprocal
in interfacePsyMultiplicative<PsyNumeric>
- Returns:
- the multiplicative inverse of this object
- Throws:
PsyUndefinedResultException
- if this object is zero.
-
psyMul
- Specified by:
psyMul
in interfacePsyRealNumeric
-
psyDiv
- Specified by:
psyDiv
in interfacePsyRealNumeric
- Throws:
PsyUndefinedResultException
-
psyMod
default PsyRational psyMod(PsyRational oRational) throws PsyRangeCheckException, PsyUndefinedResultException Returns anintegral
representing this object modulo given modulus.- Parameters:
oRational
- the given modulus.- Returns:
- an
integral
representing this object modulo given modulus - Throws:
PsyRangeCheckException
- when the modulus is negative.PsyUndefinedResultException
- when the modulus is zero.
-
psyIdiv
Returns invalid input: 'the quotient of the integer division of this {@code rational} by the {@code rational} divisor. @param oRational the divisor. @throws PsyUndefinedResultException when the divisor is zero.'.- Returns:
- invalid input: 'the quotient of the integer division of this {@code rational} by the {@code rational} divisor. @param oRational the divisor. @throws PsyUndefinedResultException when the divisor is zero.'
- Throws:
PsyUndefinedResultException
-
psyGCD
Returns arational
representing the greatest common divisor of this object and given object.- Parameters:
oRational
- the given object.- Returns:
- a
rational
representing the greatest common divisor of this object and given object
-
psyLCM
Returns arational
representing the least common multiplier of this object and given object.- Parameters:
oRational
- the given object.- Returns:
- a
rational
representing the least common multiplier of this object and given object
-
psyCeiling
PsyIntegral psyCeiling()- Specified by:
psyCeiling
in interfacePsyRealNumeric
-
psyAbs
Description copied from interface:PsyNumeric
Returns thenumeric
absolute value of this object.- Specified by:
psyAbs
in interfacePsyNumeric
- Specified by:
psyAbs
in interfacePsyRealNumeric
- Returns:
- the
numeric
absolute value of this object
-
psyFloor
PsyIntegral psyFloor()- Specified by:
psyFloor
in interfacePsyRealNumeric
-
of
-
compareTo
Description copied from interface:PsyScalar
Compares thisscalar
with the specifiedscalar
for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specifiedscalar
.- Specified by:
compareTo
in interfaceComparable<PsyRealNumeric>
- Specified by:
compareTo
in interfacePsyRealNumeric
- Specified by:
compareTo
in interfacePsyScalar<PsyRealNumeric>
- Parameters:
oNumeric
- thescalar
to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified.
-
parseLiteral
static PsyRational parseLiteral(String image) throws PsySyntaxErrorException, PsyUndefinedResultException
-