Top Description Fields Constructors Methods
org.jruby

public abstract Class RubyInteger

extends RubyNumeric
Class Inheritance
Known Direct Subclasses
org.jruby.RubyBignum, org.jruby.RubyFixnum
Annotations
@JRubyClass
name:Integer
parent:Numeric
overrides:RubyFixnum, RubyBignum
Imports
org.jcodings.Encoding, org.jcodings.specific.ASCIIEncoding, .USASCIIEncoding, .UTF8Encoding, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.api.Convert, .JRubyAPI, org.jruby.ast.util.ArgsUtil, org.jruby.runtime.Arity, .Block, .CallSite, .ClassIndex, .JavaSites, .Signature, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ByteList, .Numeric, .TypeConverter, org.jruby.util.io.EncodingUtils, java.math.BigInteger, .RoundingMode

Implementation of the Integer class.
Author
jpetersen

Field Summary

Modifier and TypeField and Description
private static final int
private static final long
private static final long
public static final int
public static final int
public static final int
pack-priv static final ByteList[]
pack-priv static final byte[][]
pack-priv static final ByteList[]
pack-priv static final ByteList[]
Inherited from org.jruby.RubyNumeric:
DBL_EPSILON

Constructor Summary

AccessConstructor and Description
public
RubyInteger(Ruby runtime, RubyClass rubyClass)

public
public
RubyInteger(Ruby runtime, RubyClass rubyClass, boolean useObjectSpace)

public
RubyInteger(Ruby runtime, RubyClass rubyClass, boolean useObjectSpace, boolean canBeTainted)
Deprecated

Method Summary

Modifier and TypeMethod and Description
public abstract IRubyObject
abs(ThreadContext context)

Overrides org.jruby.RubyNumeric.abs.

num_abs

public IRubyObject
public IRubyObject
public abstract IRubyObject
public IRubyObject
ceil(ThreadContext context)

Overrides org.jruby.RubyNumeric.ceil.

MRI: num_ceil

public abstract IRubyObject
public IRubyObject
ceil()

Overrides org.jruby.RubyNumeric.ceil.

Deprecated

public RubyString
chr(ThreadContext context)

int_chr

public RubyString
private RubyString
chrCommon(ThreadContext context, long value, Encoding enc)

private static long
public RubyInteger
convertToInteger()

Overrides org.jruby.RubyBasicObject.convertToInteger.

Implements org.jruby.runtime.builtin.IRubyObject.convertToInteger.

Tries to convert this object to a Ruby Integer using the "to_int" method.

public static RubyClass
public IRubyObject
denominator(ThreadContext context)

Overrides org.jruby.RubyNumeric.denominator.

numeric_denominator

public RubyArray<T extends IRubyObject>
public abstract RubyArray<T extends IRubyObject>
public final IRubyObject
public IRubyObject
divmod(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.divmod.

num_divmod

private static long
doRound(ThreadContext context, RoundingMode roundingMode, long n, long f)

private static boolean
public IRubyObject
downto(ThreadContext context, IRubyObject to, Block block)

int_downto

private static IRubyObject
downtoSize(ThreadContext context, IRubyObject recv, IRubyObject[] args)

A downto size method suitable for lambda method reference implementation of SizeFn#size(ThreadContext, IRubyObject, IRubyObject[])

private static void
pack-priv static void
public RubyBoolean
public IRubyObject
public abstract IRubyObject
private static void
fixnumDownto(ThreadContext context, long from, long to, Block block)

pack-priv static void
fixnumUpto(ThreadContext context, long from, long to, Block block)

public IRubyObject
floor(ThreadContext context)

Overrides org.jruby.RubyNumeric.floor.

MRI: num_floor

public abstract IRubyObject
public IRubyObject
floor()

Overrides org.jruby.RubyNumeric.floor.

Deprecated

public static final long
floorSqrt(final long x)

public static final BigInteger
public IRubyObject
gcd(ThreadContext context, IRubyObject other)

rb_gcd

public IRubyObject
gcdlcm(ThreadContext context, IRubyObject other)

rb_gcdlcm

pack-priv RubyInteger
public abstract IRubyObject
idiv(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyNumeric.idiv.

MRI: rb_int_idiv and overrides

public static IRubyObject
induced_from(ThreadContext context, IRubyObject recv, IRubyObject other)
Deprecated

rb_int_induced_from

protected static boolean
protected static boolean
protected static boolean
protected static long
int_round_half_down(long x, long y)

protected static long
int_round_half_even(long x, long y)

protected static long
int_round_half_up(long x, long y)

protected boolean
int_round_zero_p(ThreadContext context, int ndigits)

public IRubyObject
private static CallSite
protected RubyNumeric
protected RubyNumeric
protected IRubyObject
intPowTmp3(ThreadContext context, RubyInteger y, RubyBignum m, boolean negaFlg)

pack-priv static RubyInteger
public IRubyObject
isNegative(ThreadContext context)

Overrides org.jruby.RubyNumeric.isNegative.

num_negative_p

public boolean
pack-priv boolean
isOne()
Deprecated since 10.0.

pack-priv boolean
public IRubyObject
isPositive(ThreadContext context)

Overrides org.jruby.RubyNumeric.isPositive.

num_positive_p

public boolean
public IRubyObject
lcm(ThreadContext context, IRubyObject other)

rb_lcm

public IRubyObject
public RubyInteger
negate()
Deprecated since 10.0.

public RubyInteger
public IRubyObject
public IRubyObject
numerator(ThreadContext context)

Overrides org.jruby.RubyNumeric.numerator.

numeric_numerator

public static long

Returns:

""
numToUint
(IRubyObject val)

public static long

Returns:

the value and result code, with the top four bytes being the result code (zero if no error)
numToUint
(ThreadContext context, IRubyObject
the object to convert to a uint
val
)

Simulate CRuby's rb_num_to_uint by returning a single long; the top 4 bytes will be the uint and the bottom four bytes will be the result code.

public RubyBoolean
public abstract IRubyObject
public IRubyObject
public IRubyObject
op_aref(ThreadContext context, IRubyObject index, IRubyObject length)

public IRubyObject
op_aref(IRubyObject other)
Deprecated since 10.0.

protected abstract IRubyObject
public abstract IRubyObject
public abstract IRubyObject
public abstract IRubyObject
op_equal(ThreadContext context, IRubyObject other)

Redeclares org.jruby.runtime.builtin.IRubyObject.op_equal.

Overrides org.jruby.RubyBasicObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public IRubyObject
public IRubyObject
public final IRubyObject
op_idiv(ThreadContext context, IRubyObject arg)
Deprecated

public IRubyObject
public abstract IRubyObject
public RubyInteger
op_lshift(ThreadContext context, long other)

public IRubyObject
op_lshift(IRubyObject other)
Deprecated

public IRubyObject
public abstract IRubyObject
public IRubyObject
op_minus(ThreadContext context, long other)

public abstract IRubyObject
public IRubyObject
op_mod(ThreadContext context, long other)

private static long
public abstract IRubyObject
public IRubyObject
op_mul(ThreadContext context, long other)

public abstract IRubyObject
public IRubyObject
op_neg()
Deprecated since 10.0.

public abstract IRubyObject
public abstract IRubyObject
public IRubyObject
op_plus(ThreadContext context, long other)

public abstract IRubyObject
public abstract IRubyObject
public RubyInteger
op_rshift(ThreadContext context, long other)

public IRubyObject
op_rshift(IRubyObject other)
Deprecated

public abstract IRubyObject
public IRubyObject
op_uminus()
Deprecated since 10.0.

public abstract IRubyObject
public IRubyObject
ord(ThreadContext context)

int_ord

public IRubyObject
pow(ThreadContext context, IRubyObject other)

public IRubyObject
public IRubyObject
public IRubyObject
rationalize(ThreadContext context, IRubyObject[] args)

integer_rationalize

public IRubyObject
remainder(ThreadContext context, IRubyObject dividend)

Overrides org.jruby.RubyNumeric.remainder.

num_remainder

public IRubyObject
round(ThreadContext context)

Overrides org.jruby.RubyNumeric.round.

MRI: num_round

public IRubyObject
round(ThreadContext context, IRubyObject _digits)

public IRubyObject
round(ThreadContext context, IRubyObject digits, IRubyObject _opts)

public IRubyObject
round(ThreadContext context, int ndigits)

public IRubyObject
round()

Overrides org.jruby.RubyNumeric.round.

Deprecated

public RubyNumeric
roundShared(ThreadContext context, int ndigits, RoundingMode roundingMode)

public int
signum()
Deprecated since 10.0.

public int
pack-priv static ByteList
singleCharASCII8BITByteList(final byte index)

public static ByteList
singleCharByteList(final byte index)

public static RubyString

Returns:

a new single-character RubyString
singleCharString
(Ruby runtime, byte
the byte
b
,
RubyClass meta, Encoding
the encoding
enc
)

Return a single-character ByteList, possibly cached, corresponding to the given byte and encoding.

pack-priv static ByteList
singleCharUSASCIIByteList(final byte index)

public static ByteList

Returns:

a cached single-character ByteList
singleCharUTF8ByteList
(final byte
the byte
index
)

Return a low ASCII single-character bytelist with UTF-8 encoding, using cached values.

private static JavaSites.IntegerSites
sites(ThreadContext context)

Hides org.jruby.RubyNumeric.sites.

Retrieve the call sites for this class.

public abstract IRubyObject
public IRubyObject
size()
Deprecated since 10.0.

public static IRubyObject
sqrt(ThreadContext context, IRubyObject self, IRubyObject num)

rb_int_s_isqrt

public abstract IRubyObject
public IRubyObject
succ(ThreadContext context)

int_succ

public IRubyObject
times(ThreadContext context, Block block)

protected static IRubyObject
timesSize(ThreadContext context, RubyInteger recv, IRubyObject[] args)

A times size method suitable for lambda method reference implementation of SizeFn#size(ThreadContext, IRubyObject, IRubyObject[])

public abstract IRubyObject
public IRubyObject
to_f()
Deprecated since 10.0.

public IRubyObject
to_i()
Deprecated since 10.0.

public IRubyObject
public IRubyObject
to_r(ThreadContext context)

integer_to_r

public RubyString
to_s()

Overrides org.jruby.RubyBasicObject.to_s.

Deprecated since 10.0.

public RubyString
public RubyString
to_s(IRubyObject x)
Deprecated since 10.0.

public RubyString
protected RubyFloat
pack-priv static RubyInteger
private long
public IRubyObject
truncate(ThreadContext context)

Overrides org.jruby.RubyNumeric.truncate.

MRI: num_truncate

public abstract IRubyObject
public IRubyObject
truncate()

Overrides org.jruby.RubyNumeric.truncate.

Deprecated

num_truncate

public static IRubyObject
public IRubyObject
upto(ThreadContext context, IRubyObject to, Block block)

int_upto

private static IRubyObject
uptoSize(ThreadContext context, IRubyObject from, IRubyObject[] args)

An upto size method suitable for lambda method reference implementation of SizeFn#size(ThreadContext, IRubyObject, IRubyObject[])

public abstract IRubyObject
zero_p(ThreadContext context)

Overrides org.jruby.RubyNumeric.zero_p.

num_zero_p

Inherited from org.jruby.RubyNumeric:
abs2argasBigIntegerasDoubleasIntasLongasNumericcallCoercedcallCoercedcallCoercedcallCoercedcheckIntcheckIntcoercecoercecoerceBincoerceBincoerceBitcoerceBitcoerceCmpcoerceCmpcoerceFailedcoerceRelOpcoerceRelOpcoerceRescuecompareNumberWithZerocompareWithZeroconjugateconvertToRationalconvertToRationalcreateNumericClassdbl2ivaldbl2numdbl_cmpdivdoCoercedupeql_pfinite_pfix2intfix2intfix2longfixablefloat2longfloat2ulongfloatStepfloatStepSizegetBigIntegerValuegetCoercedgetDoubleValuegetIntValuegetLongValuegetRoundingModeidivimageinfinite_pinitialize_copyint2fixinteger_pintervalStepSizeisNegativeisPositiveisRealisZeroisZeromodulomodulonegativeIntnegFixablenegFixablenewNumericnonzero_pnum2chrnum2dblnum2dblnum2fixnum2fixnum2intnum2longnum2ulongnum_imaginarynumFuncallnumFuncallnumRemainderop_notop_num_equalop_uplusop_upluspolarposFixableposFixablepositiveIntquorbClonerbClonerbClonerbClonerealreal_prectscalar_psingleton_method_addedstepstr2fnumstr2fnumstr2fnumstr2inumstr2inumstr2inumto_cto_inttoJava