public class RubyFixnum extends RubyInteger
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 |
DBL_EPSILON, NUMERIC_ALLOCATOROBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_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_FNULL_ARRAY| Constructor and Description |
|---|
RubyFixnum(Ruby runtime) |
RubyFixnum(Ruby runtime,
long value) |
| Modifier and Type | Method and Description |
|---|---|
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) |
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, uptoabs2, 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_pattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, initialize, 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, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getMetaClass, getObjectId, getRuntime, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, infectBy, initialize19, initialize19, initialize19, initialize19, initialize19, initObjectId, 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, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, 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, 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, send19, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, 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 int getNativeTypeIndex()
RubyObjectgetNativeTypeIndex in interface CoreObjectTypegetNativeTypeIndex in class RubyObjectorg.jruby.runtime.ClassIndepublic final boolean eql(IRubyObject other)
eql in interface IRubyObjecteql in class RubyBasicObjectpublic IRubyObject equal_p(ThreadContext context, IRubyObject obj)
RubyBasicObjectequal_p in class RubyBasicObjectpublic boolean isImmediate()
RubyBasicObjectisImmediate in interface IRubyObjectisImmediate in class RubyBasicObjectpublic RubyClass getSingletonClass()
RubyBasicObjectgetSingletonClass in interface IRubyObjectgetSingletonClass in class RubyBasicObjectpublic java.lang.Class<?> getJavaClass()
RubyBasicObjectgetJavaClass in interface IRubyObjectgetJavaClass in class RubyBasicObjectpublic double getDoubleValue()
getDoubleValue in class RubyNumericpublic long getLongValue()
getLongValue in class RubyNumericpublic java.math.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(java.lang.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)
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 RubyNumericpublic IRubyObject divmod19(ThreadContext context, IRubyObject other)
RubyNumericdivmod19 in class RubyNumericpublic 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 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 RubyBasicObjectpublic IRubyObject op_cmp(ThreadContext context, IRubyObject other)
op_cmp in class RubyBasicObjectpublic 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()
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 java.lang.String asJavaString()
RubyBasicObjectasJavaString in interface IRubyObjectasJavaString in class RubyBasicObjectpublic static RubyFixnum unmarshalFrom(UnmarshalStream input) throws java.io.IOException
java.io.IOExceptionpublic static IRubyObject induced_from(IRubyObject recv, IRubyObject other)
Copyright © 2002-2009 JRuby Team. All Rights Reserved.