java.lang.Object
coneforest.psylla.core.PsyInteger
- All Implemented Interfaces:
PsyAdditive<PsyNumeric>,PsyArithmetic<PsyNumeric>,PsyBitwise<PsyIntegral>,PsyConvertableToInteger,PsyConvertableToIntegral,PsyConvertableToRational,PsyConvertableToReal,PsyIntegral,PsyLogical<PsyIntegral>,PsyMultiplicative<PsyNumeric>,PsyNumeric,PsyObject,PsyRational,PsyRealNumeric,PsyScalar<PsyRealNumeric>,PsyValue,Comparable<PsyRealNumeric>
@Type("integer")
public final class PsyInteger
extends Object
implements PsyBitwise<PsyIntegral>, PsyIntegral
The representation of
integer.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PsyIntegerAnintegerrepresenting the maximum representable value.static final PsyIntegerAnintegerrepresenting the minimum representable value.static final PsyIntegerAnintegerrepresenting the number −1.static final PsyIntegerAnintegerrepresenting the number 1.static final PsyIntegerAnintegerrepresenting the number 2.static final PsyIntegerAnintegerrepresenting the number 0.Fields inherited from interface coneforest.psylla.core.PsyAdditive
PSY_ADD, PSY_ISZERO, PSY_NEG, PSY_NONZERO, PSY_SUBFields inherited from interface coneforest.psylla.core.PsyBitwise
PSY_BITSHIFT, PSY_CLEARBIT, PSY_FLIPBIT, PSY_SETBIT, PSY_TESTBITFields 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.PsyLogical
PSY_AND, PSY_NOT, PSY_OR, PSY_XORFields 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.PsyRational
PSY_DENOMINATOR, PSY_GCD, PSY_IDIV, PSY_LCM, PSY_MOD, PSY_NUMERATORFields inherited from interface coneforest.psylla.core.PsyRealNumeric
PSY_CEILING, PSY_FLOOR, PSY_HYPOT, PSY_ROUND -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(PsyRealNumeric oRealNumeric) Compares thisscalarwith the specifiedscalarfor order.doublebooleaninthashCode()intintValue()booleanisZero()longstatic PsyIntegerof(long longValue) Returns aintegerrepresenting the specified value.psyAbs()Returns thenumericabsolute value of this object.psyAdd(PsyRealNumeric oRealNumeric) psyAnd(PsyIntegral oIntegral) Returns a result of logical conjunction of this object and given object.psyBitShift(PsyInteger oShift) Returns abitwisewhose value is equivalent to this value with bits shifted at the given distance.psyClearBit(PsyInteger oBit) Returns abitwisewhose value is equivalent to this value with the designated bit cleared.psyDiv(PsyRealNumeric oRealNumeric) Returns abooleanresult of equality test of thisobjectand givenobject.psyFlipBit(PsyInteger oBit) Returns abitwisewhose value is equivalent to this value with the designated bit flipped.psyIdiv(PsyRational oRational) Returns the quotient of the integer division of thisrationalby therationaldivisor.psyInUnicodeBlock(PsyTextual oTextual) psyMod(PsyRational oRational) Returns anintegralrepresenting this object modulo given modulus.psyMul(PsyRealNumeric oRealNumeric) psyNeg()Returns theadditiveresult of arithmetic negation of this object.psyNot()Returns a result of logical negation of this object.psyOr(PsyIntegral oIntegral) Returns a result of logical disjunction of this object and given object.psySetBit(PsyInteger oBit) Returns abitwisewhose value is equivalent to this value with the designated bit set.Returns thenumericsignum of this object.psySub(PsyRealNumeric oRealNumeric) psyTestBit(PsyInteger oBit) Returns abooleanindicating if the designated bit is set.psyXor(PsyIntegral oIntegral) Returns a result of logical exclusive disjunction of this object and given object.Returns the syntactic representation of this object.Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface coneforest.psylla.core.PsyAdditive
psyIsZero, psyNonZeroMethods inherited from interface coneforest.psylla.core.PsyIntegral
psyCeiling, psyDenominator, psyFloor, psyGCD, psyLCM, psyNumerator, psyRound, psyToIntegralMethods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, typeNameMethods inherited from interface coneforest.psylla.core.PsyRational
psyLCM, psyReciprocal, psyToRational, rationalValueMethods inherited from interface coneforest.psylla.core.PsyRealNumeric
imagValue, psyAcos, psyAdd, psyAsin, psyAtan, psyCbrt, psyCos, psyCosh, psyDiv, psyExp, psyHypot, psyLog, psyMul, psyPow, psyPow, psySin, psySinh, psySqrt, psySub, psyTan, psyTanh, psyToInteger, psyToReal, realValue
-
Field Details
-
ZERO
Anintegerrepresenting the number 0. -
ONE
Anintegerrepresenting the number 1. -
TWO
Anintegerrepresenting the number 2. -
MINUS_ONE
Anintegerrepresenting the number −1. -
MAX_VALUE
Anintegerrepresenting the maximum representable value. -
MIN_VALUE
Anintegerrepresenting the minimum representable value.
-
-
Method Details
-
isZero
public boolean isZero()- Specified by:
isZeroin interfacePsyAdditive<PsyNumeric>
-
intValue
public int intValue()- Specified by:
intValuein interfacePsyRealNumeric
-
longValue
public long longValue()- Specified by:
longValuein interfacePsyRealNumeric
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein interfacePsyRealNumeric
-
bigIntegerValue
- Specified by:
bigIntegerValuein interfacePsyRational
-
toSyntaxString
Description copied from interface:PsyObjectReturns the syntactic representation of this object.- Specified by:
toSyntaxStringin interfacePsyObject- Returns:
- the syntactic representation of this object
-
psyNot
Description copied from interface:PsyLogicalReturns a result of logical negation of this object.- Specified by:
psyNotin interfacePsyLogical<PsyIntegral>- Returns:
- a result of logical negation of this object
-
psyOr
Description copied from interface:PsyLogicalReturns a result of logical disjunction of this object and given object.- Specified by:
psyOrin interfacePsyLogical<PsyIntegral>- Parameters:
oIntegral- given object.- Returns:
- a result of logical disjunction of this object and given object
-
psyAnd
Description copied from interface:PsyLogicalReturns a result of logical conjunction of this object and given object.- Specified by:
psyAndin interfacePsyLogical<PsyIntegral>- Parameters:
oIntegral- given object.- Returns:
- a result of logical conjunction of this object and given object
-
psyXor
Description copied from interface:PsyLogicalReturns a result of logical exclusive disjunction of this object and given object.- Specified by:
psyXorin interfacePsyLogical<PsyIntegral>- Parameters:
oIntegral- given object.- Returns:
- a result of logical exclusive disjunction of this object and given object
-
psyNeg
Description copied from interface:PsyAdditiveReturns theadditiveresult of arithmetic negation of this object.- Specified by:
psyNegin interfacePsyAdditive<PsyNumeric>- Specified by:
psyNegin interfacePsyIntegral- Specified by:
psyNegin interfacePsyRational- Specified by:
psyNegin interfacePsyRealNumeric- Returns:
- the
additiveresult of arithmetic negation of this object
-
psyAbs
Description copied from interface:PsyNumericReturns thenumericabsolute value of this object.- Specified by:
psyAbsin interfacePsyIntegral- Specified by:
psyAbsin interfacePsyNumeric- Specified by:
psyAbsin interfacePsyRational- Specified by:
psyAbsin interfacePsyRealNumeric- Returns:
- the
numericabsolute value of this object
-
psyTestBit
Description copied from interface:PsyBitwiseReturns abooleanindicating if the designated bit is set.- Specified by:
psyTestBitin interfacePsyBitwise<PsyIntegral>- Parameters:
oBit- the index of bit to test.- Returns:
- a
booleanindicating if the designated bit is set - Throws:
PsyRangeCheckException- if the index is out of range.
-
psyClearBit
Description copied from interface:PsyBitwiseReturns abitwisewhose value is equivalent to this value with the designated bit cleared.- Specified by:
psyClearBitin interfacePsyBitwise<PsyIntegral>- Parameters:
oBit- the index of bit to clear.- Returns:
- a
bitwisewhose value is equivalent to this value with the designated bit cleared - Throws:
PsyRangeCheckException- if the index is out of range.
-
psySetBit
Description copied from interface:PsyBitwiseReturns abitwisewhose value is equivalent to this value with the designated bit set.- Specified by:
psySetBitin interfacePsyBitwise<PsyIntegral>- Parameters:
oBit- the index of bit to set.- Returns:
- a
bitwisewhose value is equivalent to this value with the designated bit set - Throws:
PsyRangeCheckException- if the index is out of range.
-
psyFlipBit
Description copied from interface:PsyBitwiseReturns abitwisewhose value is equivalent to this value with the designated bit flipped.- Specified by:
psyFlipBitin interfacePsyBitwise<PsyIntegral>- Parameters:
oBit- the index of bit to flip.- Returns:
- a
bitwisewhose value is equivalent to this value with the designated bit flipped - Throws:
PsyRangeCheckException- if the index is out of range.
-
psySignum
Description copied from interface:PsyNumericReturns thenumericsignum of this object.- Specified by:
psySignumin interfacePsyNumeric- Returns:
- the
numericsignum of this object
-
psyAdd
- Specified by:
psyAddin interfacePsyRational- Specified by:
psyAddin interfacePsyRealNumeric
-
psySub
- Specified by:
psySubin interfacePsyRational- Specified by:
psySubin interfacePsyRealNumeric
-
psyMul
- Specified by:
psyMulin interfacePsyRational- Specified by:
psyMulin interfacePsyRealNumeric
-
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 interfacePsyRational- Specified by:
compareToin interfacePsyRealNumeric- Specified by:
compareToin interfacePsyScalar<PsyRealNumeric>- Parameters:
oRealNumeric- 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.
-
psyDiv
- Specified by:
psyDivin interfacePsyRational- Specified by:
psyDivin interfacePsyRealNumeric- Throws:
PsyUndefinedResultException
-
psyMod
public PsyIntegral psyMod(PsyRational oRational) throws PsyUndefinedResultException, PsyRangeCheckException Description copied from interface:PsyRationalReturns anintegralrepresenting this object modulo given modulus.- Specified by:
psyModin interfacePsyIntegral- Specified by:
psyModin interfacePsyRational- Parameters:
oRational- the given modulus.- Returns:
- an
integralrepresenting this object modulo given modulus - Throws:
PsyUndefinedResultException- when the modulus is zero.PsyRangeCheckException- when the modulus is negative.
-
psyIdiv
Description copied from interface:PsyRationalReturns the quotient of the integer division of thisrationalby therationaldivisor.- Specified by:
psyIdivin interfacePsyIntegral- Specified by:
psyIdivin interfacePsyRational- Parameters:
oRational- the divisor.- Returns:
- the quotient of the integer division of this
rationalby therationaldivisor - Throws:
PsyUndefinedResultException- when the divisor is zero.
-
psyBitShift
Description copied from interface:PsyBitwiseReturns abitwisewhose value is equivalent to this value with bits shifted at the given distance. If the distance is negative, the left shift is preformed. If the distance is positive, the right shift is preformed. If the distance is zero, returns this.- Specified by:
psyBitShiftin interfacePsyBitwise<PsyIntegral>- Parameters:
oShift- the shift distance.- Returns:
- a
bitwisewhose value is equivalent to this value with bits shifted at the given distance
-
psyInUnicodeBlock
-
psyEq
Description copied from interface:PsyObjectReturns abooleanresult of equality test of thisobjectand givenobject.- Specified by:
psyEqin interfacePsyObject- Specified by:
psyEqin interfacePsyRealNumeric- Parameters:
o- theobjectto be compared for equality.- Returns:
- a
booleanresult of equality test of thisobjectand givenobject
-
hashCode
public int hashCode() -
equals
-
of
Returns aintegerrepresenting the specified value. This method will cache values in the range -128 to 127, inclusive.- Parameters:
longValue- the specified value.- Returns:
- a
integerrepresenting the specified value
-