|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyNumeric
org.jruby.RubyInteger
org.jruby.RubyFixnum
public class RubyFixnum
Implementation of the Fixnum class.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jruby.RubyNumeric |
---|
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException |
Nested classes/interfaces inherited from class org.jruby.RubyObject |
---|
RubyObject.Data |
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject |
---|
RubyBasicObject.Finalizer |
Field Summary | |
---|---|
static int |
CACHE_OFFSET
|
static long |
MAX
|
static long |
MAX_MARSHAL_FIXNUM
|
static long |
MIN
|
static long |
MIN_MARSHAL_FIXNUM
|
static long |
SIGN_BIT
|
Fields inherited from class org.jruby.RubyNumeric |
---|
DBL_EPSILON, NUMERIC_ALLOCATOR |
Fields inherited from class org.jruby.RubyObject |
---|
OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR |
Fields inherited from class org.jruby.RubyBasicObject |
---|
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F |
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject |
---|
NULL_ARRAY |
Constructor Summary | |
---|---|
RubyFixnum(Ruby runtime)
|
|
RubyFixnum(Ruby runtime,
long value)
|
Method Summary | |
---|---|
IRubyObject |
abs(ThreadContext context)
fix_abs |
java.lang.String |
asJavaString()
rb_to_id Will try to convert this object to a String using the Ruby "to_str" if the object isn't already a String. |
int |
compareTo(IRubyObject other)
|
static RubyClass |
createFixnumClass(Ruby runtime)
|
IRubyObject |
div_div(ThreadContext context,
IRubyObject other)
fix_div here is terrible MRI gotcha: 1.div 3.0 -> 0 1 / 3.0 -> 0.3333333333333333 MRI is also able to do it in one place by looking at current frame in rb_num_coerce_bin: rb_funcall(x, ruby_frame->orig_func, 1, y); also note that RubyFloat doesn't override Numeric.div |
IRubyObject |
div_div19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
divmod(ThreadContext context,
IRubyObject other)
fix_divmod |
IRubyObject |
divmod19(ThreadContext context,
IRubyObject other)
num_divmod |
boolean |
eql(IRubyObject other)
short circuit for Fixnum key comparison |
IRubyObject |
equal_p(ThreadContext context,
IRubyObject obj)
rb_obj_equal Will use Java identity equality. |
boolean |
equals(java.lang.Object other)
This method is just a wrapper around the Ruby "==" method, provided so that RubyObjects can be used as keys in the Java HashMap object underlying RubyHash. |
RubyBoolean |
even_p()
|
boolean |
fastEqual(RubyFixnum other)
|
static RubyFixnum |
five(Ruby runtime)
|
static RubyFixnum |
four(Ruby runtime)
|
java.math.BigInteger |
getBigIntegerValue()
|
double |
getDoubleValue()
|
java.lang.Class<?> |
getJavaClass()
Will return the Java interface that most closely can represent this object, when working through JAva integration translations. |
long |
getLongValue()
|
int |
getNativeTypeIndex()
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. |
RubyClass |
getSingletonClass()
rb_singleton_class Note: this method is specialized for RubyFixnum, RubySymbol, RubyNil and RubyBoolean Will either return the existing singleton class for this object, or create a new one and return that. |
RubyFixnum |
hash()
rb_obj_id Will return the hash code of this object. |
int |
hashCode()
Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects. |
IRubyObject |
id()
rb_obj_id Return the internal id of an object. |
IRubyObject |
id2name()
fix_id2name |
IRubyObject |
idiv(ThreadContext context,
IRubyObject other,
java.lang.String method)
|
IRubyObject |
idiv(ThreadContext context,
long y,
java.lang.String method)
|
static IRubyObject |
induced_from(IRubyObject recv,
IRubyObject other)
rb_fix_induced_from |
boolean |
isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?). |
IRubyObject |
magnitude(ThreadContext context)
fix_abs/1.9 |
static RubyFixnum |
minus_one(Ruby runtime)
|
RubyFixnum |
newFixnum(long newValue)
|
static RubyFixnum |
newFixnum(Ruby runtime,
long value)
|
RubyBoolean |
odd_p()
|
static RubyFixnum |
one(Ruby runtime)
|
IRubyObject |
op_and(ThreadContext context,
IRubyObject other)
fix_and |
IRubyObject |
op_and(ThreadContext context,
long other)
|
IRubyObject |
op_aref(IRubyObject other)
fix_aref |
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other)
fix_cmp |
IRubyObject |
op_cmp(ThreadContext context,
long other)
|
IRubyObject |
op_cmp19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_div(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_div(ThreadContext context,
long other)
|
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
fix_equal |
IRubyObject |
op_equal(ThreadContext context,
long other)
|
IRubyObject |
op_equal19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_ge(ThreadContext context,
IRubyObject other)
fix_ge |
IRubyObject |
op_ge(ThreadContext context,
long other)
|
IRubyObject |
op_ge19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_gt(ThreadContext context,
IRubyObject other)
fix_gt |
IRubyObject |
op_gt(ThreadContext context,
long other)
|
IRubyObject |
op_gt19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_le(ThreadContext context,
IRubyObject other)
fix_le |
IRubyObject |
op_le(ThreadContext context,
long other)
|
IRubyObject |
op_le19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_lshift(IRubyObject other)
fix_lshift |
IRubyObject |
op_lshift(long width)
|
IRubyObject |
op_lt(ThreadContext context,
IRubyObject other)
fix_lt |
IRubyObject |
op_lt(ThreadContext context,
long other)
|
IRubyObject |
op_lt19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_minus(ThreadContext context,
IRubyObject other)
fix_minus |
IRubyObject |
op_minus(ThreadContext context,
long otherValue)
|
IRubyObject |
op_mod(ThreadContext context,
IRubyObject other)
fix_mod |
IRubyObject |
op_mod(ThreadContext context,
long other)
|
IRubyObject |
op_mod19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_mul(ThreadContext context,
IRubyObject other)
fix_mul |
IRubyObject |
op_mul(ThreadContext context,
long otherValue)
|
IRubyObject |
op_neg()
fix_rev |
IRubyObject |
op_or(ThreadContext context,
IRubyObject other)
fix_or |
IRubyObject |
op_or(ThreadContext context,
long other)
|
IRubyObject |
op_plus(ThreadContext context,
IRubyObject other)
fix_plus |
IRubyObject |
op_plus(ThreadContext context,
long otherValue)
|
IRubyObject |
op_pow_19(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_pow(ThreadContext context,
IRubyObject other)
fix_pow |
IRubyObject |
op_pow(ThreadContext context,
long other)
|
IRubyObject |
op_rshift(IRubyObject other)
fix_rshift |
IRubyObject |
op_rshift(long width)
|
IRubyObject |
op_uminus()
fix_uminus |
IRubyObject |
op_xor(ThreadContext context,
IRubyObject other)
fix_xor |
IRubyObject |
op_xor(ThreadContext context,
long other)
|
IRubyObject |
pred()
|
IRubyObject |
quo(ThreadContext context,
IRubyObject other)
fix_quo |
IRubyObject |
size()
fix_size |
IRubyObject |
taint(ThreadContext context)
rb_obj_taint call-seq: obj.taint -> obj Marks obj as tainted---if the $SAFE level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings. |
static RubyFixnum |
three(Ruby runtime)
|
IRubyObject |
times(ThreadContext context,
Block block)
|
IRubyObject |
to_f()
fix_to_f |
RubyString |
to_s()
rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj. |
RubyString |
to_s(IRubyObject arg0)
|
RubyString |
to_s(IRubyObject[] args)
fix_to_s |
IRubyObject |
to_sym()
fix_to_sym |
static RubyFixnum |
two(Ruby runtime)
|
static RubyFixnum |
unmarshalFrom(UnmarshalStream input)
|
IRubyObject |
zero_p()
fix_zero_p |
static RubyFixnum |
zero(Ruby runtime)
|
Methods inherited from class org.jruby.RubyInteger |
---|
chr, chr19, chr19, convertToInteger, createIntegerClass, denominator, downto, even_p, gcd, gcdlcm, induced_from, integer_p, lcm, numerator, odd_p, ord, pred, rationalize, round, round19, round19, succ, to_i, to_r, toFloat, upto |
Methods inherited from class org.jruby.RubyNumeric |
---|
abs2, arg, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerce, coerceBin, coerceBody, coerceCmp, coerceRelOp, conjugate, createNumericClass, dbl_cmp, dbl2num, div, div19, doCoerce, eql_p, fdiv, fix2int, fix2int, fix2long, floatStep, floor, getCoerced, image, initialize_copy, int2fix, modulo, modulo19, newNumeric, nonzero_p, num_imaginary, num2chr, num2dbl, num2fix, num2int, num2long, op_cmp, op_num_equal, op_uminus, op_uplus, polar, quo_19, real, rect, remainder, sadded, scalar_p, step, step, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava, truncate, zero_p |
Methods inherited from class org.jruby.RubyObject |
---|
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, op_eqq, puts, specificEval, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long SIGN_BIT
public static final long MAX
public static final long MIN
public static final long MAX_MARSHAL_FIXNUM
public static final long MIN_MARSHAL_FIXNUM
public static final int CACHE_OFFSET
Constructor Detail |
---|
public RubyFixnum(Ruby runtime)
public RubyFixnum(Ruby runtime, long value)
Method Detail |
---|
public static RubyClass createFixnumClass(Ruby runtime)
public int getNativeTypeIndex()
RubyObject
getNativeTypeIndex
in interface CoreObjectType
getNativeTypeIndex
in class RubyObject
org.jruby.runtime.ClassInde
public final boolean eql(IRubyObject other)
eql
in interface IRubyObject
eql
in class RubyBasicObject
public IRubyObject equal_p(ThreadContext context, IRubyObject obj)
RubyBasicObject
equal_p
in class RubyBasicObject
public boolean isImmediate()
RubyBasicObject
isImmediate
in interface IRubyObject
isImmediate
in class RubyBasicObject
public RubyClass getSingletonClass()
RubyBasicObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyBasicObject
public java.lang.Class<?> getJavaClass()
RubyBasicObject
getJavaClass
in interface IRubyObject
getJavaClass
in class RubyBasicObject
public double getDoubleValue()
getDoubleValue
in class RubyNumeric
public long getLongValue()
getLongValue
in class RubyNumeric
public java.math.BigInteger getBigIntegerValue()
getBigIntegerValue
in class RubyNumeric
public static RubyFixnum newFixnum(Ruby runtime, long value)
public RubyFixnum newFixnum(long newValue)
public static RubyFixnum zero(Ruby runtime)
public static RubyFixnum one(Ruby runtime)
public static RubyFixnum two(Ruby runtime)
public static RubyFixnum three(Ruby runtime)
public static RubyFixnum four(Ruby runtime)
public static RubyFixnum five(Ruby runtime)
public static RubyFixnum minus_one(Ruby runtime)
public RubyFixnum hash()
RubyBasicObject
hash
in class RubyBasicObject
public final int hashCode()
RubyObject
hashCode
in class RubyObject
public boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
public IRubyObject times(ThreadContext context, Block block)
times
in class RubyInteger
public RubyString to_s(IRubyObject[] args)
public RubyString to_s()
RubyBasicObject
to_s
prints the object's class and an encoding of the
object id. As a special case, the top-level object that is the
initial execution context of Ruby programs returns ``main.''
to_s
in class RubyBasicObject
public RubyString to_s(IRubyObject arg0)
public IRubyObject id2name()
public IRubyObject to_sym()
public IRubyObject op_uminus()
public IRubyObject op_plus(ThreadContext context, IRubyObject other)
public IRubyObject op_plus(ThreadContext context, long otherValue)
public IRubyObject op_minus(ThreadContext context, IRubyObject other)
public IRubyObject op_minus(ThreadContext context, long otherValue)
public IRubyObject op_mul(ThreadContext context, IRubyObject other)
public IRubyObject op_mul(ThreadContext context, long otherValue)
public IRubyObject div_div(ThreadContext context, IRubyObject other)
public IRubyObject div_div19(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, long other)
public RubyBoolean odd_p()
public RubyBoolean even_p()
public IRubyObject pred()
public IRubyObject idiv(ThreadContext context, IRubyObject other, java.lang.String method)
public IRubyObject idiv(ThreadContext context, long y, java.lang.String method)
public IRubyObject op_mod(ThreadContext context, IRubyObject other)
public IRubyObject op_mod(ThreadContext context, long other)
public IRubyObject op_mod19(ThreadContext context, IRubyObject other)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod
in class RubyNumeric
public IRubyObject divmod19(ThreadContext context, IRubyObject other)
RubyNumeric
divmod19
in class RubyNumeric
public IRubyObject quo(ThreadContext context, IRubyObject other)
quo
in class RubyNumeric
public IRubyObject op_pow(ThreadContext context, IRubyObject other)
public IRubyObject op_pow(ThreadContext context, long other)
public IRubyObject op_pow_19(ThreadContext context, IRubyObject other)
public IRubyObject abs(ThreadContext context)
abs
in class RubyNumeric
public IRubyObject magnitude(ThreadContext context)
magnitude
in class RubyNumeric
public IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal
in interface IRubyObject
op_equal
in class RubyBasicObject
public IRubyObject op_equal(ThreadContext context, long other)
public boolean fastEqual(RubyFixnum other)
public IRubyObject op_equal19(ThreadContext context, IRubyObject other)
public final int compareTo(IRubyObject other)
compareTo
in interface java.lang.Comparable<IRubyObject>
compareTo
in class RubyBasicObject
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp
in class RubyBasicObject
public IRubyObject op_cmp(ThreadContext context, long other)
public IRubyObject op_cmp19(ThreadContext context, IRubyObject other)
public IRubyObject op_gt(ThreadContext context, IRubyObject other)
public IRubyObject op_gt(ThreadContext context, long other)
public IRubyObject op_gt19(ThreadContext context, IRubyObject other)
public IRubyObject op_ge(ThreadContext context, IRubyObject other)
public IRubyObject op_ge(ThreadContext context, long other)
public IRubyObject op_ge19(ThreadContext context, IRubyObject other)
public IRubyObject op_lt(ThreadContext context, IRubyObject other)
public IRubyObject op_lt(ThreadContext context, long other)
public IRubyObject op_lt19(ThreadContext context, IRubyObject other)
public IRubyObject op_le(ThreadContext context, IRubyObject other)
public IRubyObject op_le(ThreadContext context, long other)
public IRubyObject op_le19(ThreadContext context, IRubyObject other)
public IRubyObject op_neg()
public IRubyObject op_and(ThreadContext context, IRubyObject other)
public IRubyObject op_and(ThreadContext context, long other)
public IRubyObject op_or(ThreadContext context, IRubyObject other)
public IRubyObject op_or(ThreadContext context, long other)
public IRubyObject op_xor(ThreadContext context, IRubyObject other)
public IRubyObject op_xor(ThreadContext context, long other)
public IRubyObject op_aref(IRubyObject other)
public IRubyObject op_lshift(IRubyObject other)
public IRubyObject op_lshift(long width)
public IRubyObject op_rshift(IRubyObject other)
public IRubyObject op_rshift(long width)
public IRubyObject to_f()
public IRubyObject size()
public IRubyObject zero_p()
public IRubyObject id()
RubyBasicObject
id
in interface IRubyObject
id
in class RubyBasicObject
public IRubyObject taint(ThreadContext context)
RubyBasicObject
$SAFE
level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.
taint
in class RubyBasicObject
public java.lang.String asJavaString()
RubyBasicObject
asJavaString
in interface IRubyObject
asJavaString
in class RubyBasicObject
public static RubyFixnum unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOException
public static IRubyObject induced_from(IRubyObject recv, IRubyObject other)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |