public class RubyFixnum extends RubyInteger implements Constantizable
RubyNumeric.InvalidIntegerException, RubyNumeric.NumberTooLargeExceptionRubyObject.DataRubyBasicObject.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_BYTELISTS19DBL_EPSILON, NUMERIC_ALLOCATORFIELD_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_ALLOCATORALL_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, varTableStampNULL_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 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(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()
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 |
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, uptoabs2, 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_pattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, initialize, inspect, op_eqq, puts, specificEval, toStringaddFinalizer, 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, 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, yieldUnderpublic 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()
RubyObjectgetNativeClassIndex in interface CoreObjectTypegetNativeClassIndex in class RubyObjectClassIndexpublic Object constant()
constant in interface ConstantizableConstantizablepublic final boolean eql(IRubyObject other)
eql in interface IRubyObjecteql in class RubyBasicObjectpublic IRubyObject equal_p(ThreadContext context, IRubyObject obj)
RubyBasicObjectequal_p in class RubyBasicObjectpublic IRubyObject equal_p19(ThreadContext context, IRubyObject obj)
equal_p19 in class RubyBasicObjectpublic boolean isImmediate()
RubyBasicObjectisImmediate in interface IRubyObjectisImmediate in class RubyBasicObjectpublic RubyClass getSingletonClass()
RubyBasicObjectgetSingletonClass in interface IRubyObjectgetSingletonClass in class RubyBasicObjectpublic Class<?> getJavaClass()
RubyBasicObjectgetJavaClass in interface IRubyObjectgetJavaClass in class RubyBasicObjectpublic double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
RubyNumericgetLongValue in class RubyNumericpublic int getIntValue()
RubyNumericgetIntValue in class RubyNumericpublic BigInteger getBigIntegerValue()
getBigIntegerValue in class RubyNumericpublic 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()
RubyBasicObjecthash in class RubyBasicObjectpublic final int hashCode()
RubyObjecthashCode in class RubyObjectpublic boolean equals(Object other)
RubyObjectequals in class RubyObjectpublic IRubyObject times(ThreadContext context, Block block)
times in class RubyIntegerpublic RubyString to_s(IRubyObject[] args)
public RubyString to_s()
RubyBasicObjectto_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 RubyBasicObjectpublic 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 RubyIntegerpublic RubyBoolean even_p(ThreadContext context)
even_p in class RubyIntegerpublic IRubyObject pred(ThreadContext context)
pred in class RubyIntegerpublic 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 RubyNumericpublic 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 RubyNumericpublic IRubyObject magnitude(ThreadContext context)
magnitude in class RubyNumericpublic IRubyObject op_equal(ThreadContext context, IRubyObject other)
op_equal in interface IRubyObjectop_equal in class RubyBasicObjectpublic 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)
RubyBasicObjectcompareTo in interface Comparable<IRubyObject>compareTo in class RubyBasicObjectother - another IRubyObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp in class RubyBasicObjectpublic 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)
RubyIntegersucc in class RubyIntegerpublic IRubyObject bit_length(ThreadContext context)
public IRubyObject id()
RubyBasicObjectid in interface IRubyObjectid in class RubyBasicObjectpublic 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 RubyBasicObjectpublic String asJavaString()
RubyBasicObjectasJavaString in interface IRubyObjectasJavaString in class RubyBasicObjectpublic static RubyFixnum unmarshalFrom(UnmarshalStream input) throws IOException
IOException@Deprecated public static IRubyObject induced_from(IRubyObject recv, IRubyObject other)
public RubyInteger convertToInteger(String method)
RubyBasicObjectconvertToInteger in interface IRubyObjectconvertToInteger in class RubyBasicObjectCopyright © 2001-2015 JRuby. All Rights Reserved.