- 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 ContextActionContext action of thedenominatoroperator.static final ContextActionContext action of thegcdoperator.static final ContextActionContext action of theidivoperator.static final ContextActionContext action of thelcmoperator.static final ContextActionContext action of themodoperator.static final ContextActionContext action of thenumeratoroperator.Fields inherited from interface coneforest.psylla.core.PsyAdditive
PSY_ADD, PSY_ISZERO, PSY_NEG, PSY_NONZERO, PSY_SUBFields inherited from interface coneforest.psylla.core.PsyConvertableToInteger
PSY_TOINTEGERFields inherited from interface coneforest.psylla.core.PsyConvertableToIntegral
PSY_TOINTEGRALFields inherited from interface coneforest.psylla.core.PsyConvertableToRational
PSY_TORATIONALFields inherited from interface coneforest.psylla.core.PsyConvertableToReal
PSY_TOREALFields inherited from interface coneforest.psylla.core.PsyMultiplicative
PSY_DIV, PSY_MUL, PSY_RECIPROCALFields 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_TANHFields inherited from interface coneforest.psylla.core.PsyObject
PSY_CLONE, PSY_EQ, PSY_HASHCODE, PSY_INSTANCEOF, PSY_NE, PSY_TOSTRING, PSY_TOSTRINGBUFFER, PSY_TYPEFields inherited from interface coneforest.psylla.core.PsyRealNumeric
PSY_CEILING, PSY_FLOOR, PSY_HYPOT, PSY_ROUND -
Method Summary
Modifier and TypeMethodDescriptiondefault intcompareTo(PsyRealNumeric oNumeric) Compares thisscalarwith the specifiedscalarfor order.static PsyRationalof(PsyIntegral oNumerator, PsyIntegral oDenominator) static PsyRationalparseLiteral(String image) default PsyRationalpsyAbs()Returns thenumericabsolute value of this object.default PsyRealNumericpsyAdd(PsyRealNumeric oRealNumeric) Returns anintegraldenominator of this fraction.default PsyRealNumericpsyDiv(PsyRealNumeric oRealNumeric) psyFloor()default PsyRationalpsyGCD(PsyRational oRational) Returns arationalrepresenting the greatest common divisor of this object and given object.default PsyIntegralpsyIdiv(PsyRational oRational) Returns the quotient of the integer division of thisrationalby therationaldivisor.default PsyRationalpsyLCM(PsyRational oRational) Returns arationalrepresenting the least common multiplier of this object and given object.default PsyRationalpsyMod(PsyRational oRational) Returns anintegralrepresenting this object modulo given modulus.default PsyRealNumericpsyMul(PsyRealNumeric oRealNumeric) default PsyRationalpsyNeg()Returns theadditiveresult of arithmetic negation of this object.Returns anintegralnumerator of this fraction.default PsyRationalReturns the multiplicative inverse of this object.default PsyIntegralpsyRound()default PsyRealNumericpsySub(PsyRealNumeric oRealNumeric) default PsyIntegraldefault PsyRationaldefault PsyRationalMethods inherited from interface coneforest.psylla.core.PsyAdditive
isZero, psyIsZero, psyNonZeroMethods inherited from interface coneforest.psylla.core.PsyNumeric
psySignumMethods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, toSyntaxString, typeNameMethods 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 thedenominatoroperator. -
PSY_GCD
Context action of thegcdoperator. -
PSY_IDIV
Context action of theidivoperator. -
PSY_LCM
Context action of thelcmoperator. -
PSY_MOD
Context action of themodoperator. -
PSY_NUMERATOR
Context action of thenumeratoroperator.
-
-
Method Details
-
bigIntegerValue
BigInteger bigIntegerValue() -
rationalValue
- Specified by:
rationalValuein interfacePsyRealNumeric
-
psyNumerator
PsyIntegral psyNumerator()Returns anintegralnumerator of this fraction.- Returns:
- an
integralnumerator of this fraction
-
psyDenominator
PsyIntegral psyDenominator()Returns anintegraldenominator of this fraction.- Returns:
- an
integraldenominator of this fraction
-
psyToRational
- Specified by:
psyToRationalin interfacePsyConvertableToRational- Specified by:
psyToRationalin interfacePsyRealNumeric
-
psyRound
- Specified by:
psyRoundin interfacePsyRealNumeric
-
psyToIntegral
- Specified by:
psyToIntegralin interfacePsyConvertableToIntegral
-
psyNeg
Description copied from interface:PsyAdditiveReturns theadditiveresult of arithmetic negation of this object.- Specified by:
psyNegin interfacePsyAdditive<PsyNumeric>- Specified by:
psyNegin interfacePsyRealNumeric- Returns:
- the
additiveresult of arithmetic negation of this object
-
psyAdd
- Specified by:
psyAddin interfacePsyRealNumeric
-
psySub
- Specified by:
psySubin interfacePsyRealNumeric
-
psyReciprocal
Description copied from interface:PsyMultiplicativeReturns the multiplicative inverse of this object.- Specified by:
psyReciprocalin interfacePsyMultiplicative<PsyNumeric>- Returns:
- the multiplicative inverse of this object
- Throws:
PsyUndefinedResultException- if this object is zero.
-
psyMul
- Specified by:
psyMulin interfacePsyRealNumeric
-
psyDiv
- Specified by:
psyDivin interfacePsyRealNumeric- Throws:
PsyUndefinedResultException
-
psyMod
default PsyRational psyMod(PsyRational oRational) throws PsyRangeCheckException, PsyUndefinedResultException Returns anintegralrepresenting this object modulo given modulus.- Parameters:
oRational- the given modulus.- Returns:
- an
integralrepresenting this object modulo given modulus - Throws:
PsyRangeCheckException- when the modulus is negative.PsyUndefinedResultException- when the modulus is zero.
-
psyIdiv
Returns the quotient of the integer division of thisrationalby therationaldivisor.- Parameters:
oRational- the divisor.- Returns:
- the quotient of the integer division of this
rationalby therationaldivisor - Throws:
PsyUndefinedResultException- when the divisor is zero.
-
psyGCD
Returns arationalrepresenting the greatest common divisor of this object and given object.- Parameters:
oRational- the given object.- Returns:
- a
rationalrepresenting the greatest common divisor of this object and given object
-
psyLCM
Returns arationalrepresenting the least common multiplier of this object and given object.- Parameters:
oRational- the given object.- Returns:
- a
rationalrepresenting the least common multiplier of this object and given object
-
psyCeiling
PsyIntegral psyCeiling()- Specified by:
psyCeilingin interfacePsyRealNumeric
-
psyAbs
Description copied from interface:PsyNumericReturns thenumericabsolute value of this object.- Specified by:
psyAbsin interfacePsyNumeric- Specified by:
psyAbsin interfacePsyRealNumeric- Returns:
- the
numericabsolute value of this object
-
psyFloor
PsyIntegral psyFloor()- Specified by:
psyFloorin interfacePsyRealNumeric
-
of
-
compareTo
Description copied from interface:PsyScalarCompares thisscalarwith the specifiedscalarfor 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:
compareToin interfaceComparable<PsyRealNumeric>- Specified by:
compareToin interfacePsyRealNumeric- Specified by:
compareToin interfacePsyScalar<PsyRealNumeric>- Parameters:
oNumeric- thescalarto 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
-