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 PsyInteger
Aninteger
representing the maximum representable value.static final PsyInteger
Aninteger
representing the minimum representable value.static final PsyInteger
Aninteger
representing the number −1.static final PsyInteger
Aninteger
representing the number 1.static final PsyInteger
Aninteger
representing the number 2.static final PsyInteger
Aninteger
representing the number 0.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.PsyBitwise
PSY_BITSHIFT, PSY_CLEARBIT, PSY_FLIPBIT, PSY_SETBIT, PSY_TESTBIT
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.PsyLogical
PSY_AND, PSY_NOT, PSY_OR, PSY_XOR
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.PsyRational
PSY_DENOMINATOR, PSY_GCD, PSY_IDIV, PSY_LCM, PSY_MOD, PSY_NUMERATOR
Fields inherited from interface coneforest.psylla.core.PsyRealNumeric
PSY_CEILING, PSY_FLOOR, PSY_HYPOT, PSY_ROUND
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(PsyRealNumeric oRealNumeric) Compares thisscalar
with the specifiedscalar
for order.double
boolean
int
hashCode()
int
intValue()
boolean
isZero()
long
static PsyInteger
of
(long longValue) Returns ainteger
representing the specified value.psyAbs()
Returns thenumeric
absolute 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 abitwise
whose value is equivalent to this value with bits shifted at the given distance.psyClearBit
(PsyInteger oBit) Returns abitwise
whose value is equivalent to this value with the designated bit cleared.psyDiv
(PsyRealNumeric oRealNumeric) Returns aboolean
result of equality test of thisobject
and givenobject
.psyFlipBit
(PsyInteger oBit) Returns abitwise
whose value is equivalent to this value with the designated bit flipped.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.'.psyInUnicodeBlock
(PsyTextual oTextual) psyMod
(PsyRational oRational) Returns anintegral
representing this object modulo given modulus.psyMul
(PsyRealNumeric oRealNumeric) psyNeg()
Returns theadditive
result 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 abitwise
whose value is equivalent to this value with the designated bit set.Returns thenumeric
signum of this object.psySub
(PsyRealNumeric oRealNumeric) psyTestBit
(PsyInteger oBit) Returns aboolean
indicating 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, wait
Methods inherited from interface coneforest.psylla.core.PsyAdditive
psyIsZero, psyNonZero
Methods inherited from interface coneforest.psylla.core.PsyIntegral
psyCeiling, psyDenominator, psyFloor, psyGCD, psyLCM, psyNumerator, psyRound, psyToIntegral
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToString, psyToStringBuffer, psyType, typeName
Methods inherited from interface coneforest.psylla.core.PsyRational
psyLCM, psyReciprocal, psyToRational, rationalValue
Methods 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
Aninteger
representing the number 0. -
ONE
Aninteger
representing the number 1. -
TWO
Aninteger
representing the number 2. -
MINUS_ONE
Aninteger
representing the number −1. -
MAX_VALUE
Aninteger
representing the maximum representable value. -
MIN_VALUE
Aninteger
representing the minimum representable value.
-
-
Method Details
-
isZero
public boolean isZero()- Specified by:
isZero
in interfacePsyAdditive<PsyNumeric>
-
intValue
public int intValue()- Specified by:
intValue
in interfacePsyRealNumeric
-
longValue
public long longValue()- Specified by:
longValue
in interfacePsyRealNumeric
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in interfacePsyRealNumeric
-
bigIntegerValue
- Specified by:
bigIntegerValue
in interfacePsyRational
-
toSyntaxString
Description copied from interface:PsyObject
Returns the syntactic representation of this object.- Specified by:
toSyntaxString
in interfacePsyObject
- Returns:
- the syntactic representation of this object
-
psyNot
Description copied from interface:PsyLogical
Returns a result of logical negation of this object.- Specified by:
psyNot
in interfacePsyLogical<PsyIntegral>
- Returns:
- a result of logical negation of this object
-
psyOr
Description copied from interface:PsyLogical
Returns a result of logical disjunction of this object and given object.- Specified by:
psyOr
in interfacePsyLogical<PsyIntegral>
- Parameters:
oIntegral
- given object.- Returns:
- a result of logical disjunction of this object and given object
-
psyAnd
Description copied from interface:PsyLogical
Returns a result of logical conjunction of this object and given object.- Specified by:
psyAnd
in interfacePsyLogical<PsyIntegral>
- Parameters:
oIntegral
- given object.- Returns:
- a result of logical conjunction of this object and given object
-
psyXor
Description copied from interface:PsyLogical
Returns a result of logical exclusive disjunction of this object and given object.- Specified by:
psyXor
in interfacePsyLogical<PsyIntegral>
- Parameters:
oIntegral
- given object.- Returns:
- a result of logical exclusive disjunction of this object and given object
-
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 interfacePsyIntegral
- Specified by:
psyNeg
in interfacePsyRational
- Specified by:
psyNeg
in interfacePsyRealNumeric
- Returns:
- the
additive
result of arithmetic negation of this object
-
psyAbs
Description copied from interface:PsyNumeric
Returns thenumeric
absolute value of this object.- Specified by:
psyAbs
in interfacePsyIntegral
- Specified by:
psyAbs
in interfacePsyNumeric
- Specified by:
psyAbs
in interfacePsyRational
- Specified by:
psyAbs
in interfacePsyRealNumeric
- Returns:
- the
numeric
absolute value of this object
-
psyTestBit
Description copied from interface:PsyBitwise
Returns aboolean
indicating if the designated bit is set.- Specified by:
psyTestBit
in interfacePsyBitwise<PsyIntegral>
- Parameters:
oBit
- the index of bit to test.- Returns:
- a
boolean
indicating if the designated bit is set - Throws:
PsyRangeCheckException
- if the index is out of range.
-
psyClearBit
Description copied from interface:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit cleared.- Specified by:
psyClearBit
in interfacePsyBitwise<PsyIntegral>
- Parameters:
oBit
- the index of bit to clear.- Returns:
- a
bitwise
whose 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:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit set.- Specified by:
psySetBit
in interfacePsyBitwise<PsyIntegral>
- Parameters:
oBit
- the index of bit to set.- Returns:
- a
bitwise
whose 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:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit flipped.- Specified by:
psyFlipBit
in interfacePsyBitwise<PsyIntegral>
- Parameters:
oBit
- the index of bit to flip.- Returns:
- a
bitwise
whose 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:PsyNumeric
Returns thenumeric
signum of this object.- Specified by:
psySignum
in interfacePsyNumeric
- Returns:
- the
numeric
signum of this object
-
psyAdd
- Specified by:
psyAdd
in interfacePsyRational
- Specified by:
psyAdd
in interfacePsyRealNumeric
-
psySub
- Specified by:
psySub
in interfacePsyRational
- Specified by:
psySub
in interfacePsyRealNumeric
-
psyMul
- Specified by:
psyMul
in interfacePsyRational
- Specified by:
psyMul
in interfacePsyRealNumeric
-
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 interfacePsyRational
- Specified by:
compareTo
in interfacePsyRealNumeric
- Specified by:
compareTo
in interfacePsyScalar<PsyRealNumeric>
- Parameters:
oRealNumeric
- 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.
-
psyDiv
- Specified by:
psyDiv
in interfacePsyRational
- Specified by:
psyDiv
in interfacePsyRealNumeric
- Throws:
PsyUndefinedResultException
-
psyMod
public PsyIntegral psyMod(PsyRational oRational) throws PsyUndefinedResultException, PsyRangeCheckException Description copied from interface:PsyRational
Returns anintegral
representing this object modulo given modulus.- Specified by:
psyMod
in interfacePsyIntegral
- Specified by:
psyMod
in interfacePsyRational
- Parameters:
oRational
- the given modulus.- Returns:
- an
integral
representing this object modulo given modulus - Throws:
PsyUndefinedResultException
- when the modulus is zero.PsyRangeCheckException
- when the modulus is negative.
-
psyIdiv
Description copied from interface:PsyRational
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.'.- Specified by:
psyIdiv
in interfacePsyIntegral
- Specified by:
psyIdiv
in interfacePsyRational
- 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
-
psyBitShift
Description copied from interface:PsyBitwise
Returns abitwise
whose 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:
psyBitShift
in interfacePsyBitwise<PsyIntegral>
- Parameters:
oShift
- the shift distance.- Returns:
- a
bitwise
whose value is equivalent to this value with bits shifted at the given distance
-
psyInUnicodeBlock
-
psyEq
Description copied from interface:PsyObject
Returns aboolean
result of equality test of thisobject
and givenobject
.- Specified by:
psyEq
in interfacePsyObject
- Specified by:
psyEq
in interfacePsyRealNumeric
- Parameters:
o
- theobject
to be compared for equality.- Returns:
- a
boolean
result of equality test of thisobject
and givenobject
-
hashCode
public int hashCode() -
equals
-
of
Returns ainteger
representing the specified value. This method will cache values in the range -128 to 127, inclusive.- Parameters:
longValue
- the specified value.- Returns:
- a
integer
representing the specified value
-