public class RubyFixnum extends RubyInteger implements Constantizable
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeException
RubyObject.Data
RubyBasicObject.Finalizer
Modifier and Type | Field and Description |
---|---|
static int |
CACHE_OFFSET |
static long |
MAX |
static long |
MAX_MARSHAL_FIXNUM |
static long |
MIN |
static long |
MIN_MARSHAL_FIXNUM |
static long |
SIGN_BIT |
SINGLE_CHAR_BYTELISTS19
DBL_EPSILON, NUMERIC_ALLOCATOR
FIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
NULL_ARRAY
Constructor and Description |
---|
RubyFixnum(Ruby runtime) |
RubyFixnum(Ruby runtime,
long value) |
Modifier and Type | Method and Description |
---|---|
IRubyObject |
abs(ThreadContext context)
fix_abs
|
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.
|
IRubyObject |
bit_length(ThreadContext context) |
int |
compareTo(IRubyObject other)
Compares this Ruby object with another.
|
Object |
constant() |
RubyInteger |
convertToInteger(String method)
Tries to convert this object to a Ruby Integer using the
supplied conversion method.
|
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 |
divmod(ThreadContext context,
IRubyObject other)
fix_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.
|
IRubyObject |
equal_p19(ThreadContext context,
IRubyObject obj) |
boolean |
equals(Object other)
This override does not do a "checked" dispatch.
|
RubyBoolean |
even_p(ThreadContext context) |
boolean |
fastEqual(RubyFixnum other) |
static RubyFixnum |
five(Ruby runtime) |
static RubyFixnum |
four(Ruby runtime) |
BigInteger |
getBigIntegerValue() |
double |
getDoubleValue() |
int |
getIntValue()
Return the value of this numeric as a 32-bit long.
|
Class<?> |
getJavaClass()
Will return the Java interface that most closely can represent
this object, when working through JAva integration
translations.
|
long |
getLongValue()
Return the value of this numeric as a 64-bit long.
|
ClassIndex |
getNativeClassIndex()
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()
This override does not do "checked" dispatch since Object usually has #hash defined.
|
IRubyObject |
id()
rb_obj_id
Return the internal id of an object.
|
IRubyObject |
idiv(ThreadContext context,
IRubyObject other,
String method) |
IRubyObject |
idiv(ThreadContext context,
long y,
String method) |
static IRubyObject |
induced_from(IRubyObject recv,
IRubyObject other)
Deprecated.
|
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(ThreadContext context) |
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_div(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_div(ThreadContext context,
long other) |
boolean |
op_equal_boolean(ThreadContext context,
long other) |
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
fix_equal
|
IRubyObject |
op_equal(ThreadContext context,
long other) |
boolean |
op_ge_boolean(ThreadContext context,
long other) |
IRubyObject |
op_ge(ThreadContext context,
IRubyObject other)
fix_ge
|
IRubyObject |
op_ge(ThreadContext context,
long other) |
boolean |
op_gt_boolean(ThreadContext context,
long other) |
IRubyObject |
op_gt(ThreadContext context,
IRubyObject other)
fix_gt
|
IRubyObject |
op_gt(ThreadContext context,
long other) |
boolean |
op_le_boolean(ThreadContext context,
long other) |
IRubyObject |
op_le(ThreadContext context,
IRubyObject other)
fix_le
|
IRubyObject |
op_le(ThreadContext context,
long other) |
IRubyObject |
op_lshift(IRubyObject other)
fix_lshift
|
IRubyObject |
op_lshift(long width) |
boolean |
op_lt_boolean(ThreadContext context,
long other) |
IRubyObject |
op_lt(ThreadContext context,
IRubyObject other)
fix_lt
|
IRubyObject |
op_lt(ThreadContext context,
long other) |
IRubyObject |
op_minus_one(ThreadContext context) |
IRubyObject |
op_minus_two(ThreadContext context) |
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_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_one(ThreadContext context) |
IRubyObject |
op_plus_two(ThreadContext context) |
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(ThreadContext context) |
IRubyObject |
quo(ThreadContext context,
IRubyObject other)
Deprecated.
|
IRubyObject |
size()
fix_size
|
IRubyObject |
succ(ThreadContext context)
int_succ
|
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()
Deprecated.
|
static RubyFixnum |
two(Ruby runtime) |
static RubyFixnum |
unmarshalFrom(UnmarshalStream input) |
IRubyObject |
zero_p()
fix_zero_p
|
static RubyFixnum |
zero(Ruby runtime) |
chr, chr19, chr19, convertToInteger, createIntegerClass, denominator, downto, gcd, gcdlcm, induced_from, integer_p, lcm, numerator, ord, rationalize, round, round19, round19, timesSizeFn, to_i, to_r, toFloat, upto
abs2, arg, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerce, coerceBin, coerceBit, coerceBody, coerceCmp, coerceFailed, coerceRelOp, coerceRescue, conjugate, createNumericClass, dbl_cmp, dbl2num, div, div19, divmod19, doCoerce, eql_p, fdiv, fix2int, fix2int, fix2long, floatStep, floatStepSize, floor, getCoerced, image, initialize_copy, int2fix, intervalStepSize, 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, str2fnum, str2fnum, str2fnum19, str2inum, str2inum, to_c, to_int, toJava, truncate, zero_p
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, initialize, inspect, op_eqq, puts, specificEval, toString
addFinalizer, anyToString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, infectBy, initialize19, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isModule, isNil, isSpecialConst, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_equal_19, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, tainted_p, testFrozen, testFrozen, to_a, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
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
public RubyFixnum(Ruby runtime)
public RubyFixnum(Ruby runtime, long value)
public ClassIndex getNativeClassIndex()
RubyObject
getNativeClassIndex
in interface CoreObjectType
getNativeClassIndex
in class RubyObject
ClassIndex
public Object constant()
constant
in interface Constantizable
Constantizable
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 IRubyObject equal_p19(ThreadContext context, IRubyObject obj)
equal_p19
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 Class<?> getJavaClass()
RubyBasicObject
getJavaClass
in interface IRubyObject
getJavaClass
in class RubyBasicObject
public double getDoubleValue()
getDoubleValue
in class RubyNumeric
public long getLongValue()
RubyNumeric
getLongValue
in class RubyNumeric
public int getIntValue()
RubyNumeric
getIntValue
in class RubyNumeric
public 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
RubyBasicObject.hashCode()
public boolean equals(Object other)
RubyObject
equals
in class RubyObject
RubyBasicObject.equals(Object)
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)
@Deprecated 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_plus_one(ThreadContext context)
public IRubyObject op_plus_two(ThreadContext context)
public IRubyObject op_minus(ThreadContext context, IRubyObject other)
public IRubyObject op_minus(ThreadContext context, long otherValue)
public IRubyObject op_minus_one(ThreadContext context)
public IRubyObject op_minus_two(ThreadContext context)
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 op_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, long other)
public RubyBoolean odd_p(ThreadContext context)
odd_p
in class RubyInteger
public RubyBoolean even_p(ThreadContext context)
even_p
in class RubyInteger
public IRubyObject pred(ThreadContext context)
pred
in class RubyInteger
public IRubyObject idiv(ThreadContext context, IRubyObject other, String method)
public IRubyObject idiv(ThreadContext context, long y, String method)
public IRubyObject op_mod(ThreadContext context, IRubyObject other)
public IRubyObject op_mod(ThreadContext context, long other)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod
in class RubyNumeric
@Deprecated 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 op_equal_boolean(ThreadContext context, long other)
public boolean fastEqual(RubyFixnum other)
public final int compareTo(IRubyObject other)
RubyBasicObject
compareTo
in interface Comparable<IRubyObject>
compareTo
in class RubyBasicObject
other
- another IRubyObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp
in class RubyBasicObject
public IRubyObject op_cmp(ThreadContext context, long other)
public IRubyObject op_gt(ThreadContext context, IRubyObject other)
public IRubyObject op_gt(ThreadContext context, long other)
public boolean op_gt_boolean(ThreadContext context, long other)
public IRubyObject op_ge(ThreadContext context, IRubyObject other)
public IRubyObject op_ge(ThreadContext context, long other)
public boolean op_ge_boolean(ThreadContext context, long other)
public IRubyObject op_lt(ThreadContext context, IRubyObject other)
public IRubyObject op_lt(ThreadContext context, long other)
public boolean op_lt_boolean(ThreadContext context, long other)
public IRubyObject op_le(ThreadContext context, IRubyObject other)
public IRubyObject op_le(ThreadContext context, long other)
public boolean op_le_boolean(ThreadContext context, long 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 succ(ThreadContext context)
RubyInteger
succ
in class RubyInteger
public IRubyObject bit_length(ThreadContext context)
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 String asJavaString()
RubyBasicObject
asJavaString
in interface IRubyObject
asJavaString
in class RubyBasicObject
public static RubyFixnum unmarshalFrom(UnmarshalStream input) throws IOException
IOException
@Deprecated public static IRubyObject induced_from(IRubyObject recv, IRubyObject other)
public RubyInteger convertToInteger(String method)
RubyBasicObject
convertToInteger
in interface IRubyObject
convertToInteger
in class RubyBasicObject
Copyright © 2001-2015 JRuby. All Rights Reserved.