|
||||||||||
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.ObjectMethods |
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject |
---|
RubyBasicObject.BasicObjectMethods, RubyBasicObject.Finalizer, RubyBasicObject.VariableTableEntry |
Field Summary | |
---|---|
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 |
Fields inherited from class org.jruby.RubyBasicObject |
---|
ALL_F, dataStruct, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold |
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 |
IRubyObject |
as(java.lang.Class javaClass)
|
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. |
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 |
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()
|
static RubyFixnum |
five(Ruby runtime)
|
static RubyFixnum |
four(Ruby runtime)
|
IRubyObject |
freeze(ThreadContext context)
rb_obj_freeze call-seq: obj.freeze => obj Prevents further modifications to obj. |
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)
|
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_aref(IRubyObject other)
fix_aref |
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other)
fix_cmp |
IRubyObject |
op_div(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_equal(ThreadContext context,
IRubyObject other)
fix_equal |
IRubyObject |
op_ge(ThreadContext context,
IRubyObject other)
fix_ge |
IRubyObject |
op_gt(ThreadContext context,
IRubyObject other)
fix_gt |
IRubyObject |
op_le(ThreadContext context,
IRubyObject other)
fix_le |
IRubyObject |
op_lshift(IRubyObject other)
fix_lshift |
IRubyObject |
op_lt(ThreadContext context,
IRubyObject other)
fix_lt |
IRubyObject |
op_minus(ThreadContext context,
IRubyObject other)
fix_minus |
IRubyObject |
op_mod(ThreadContext context,
IRubyObject other)
fix_mod |
IRubyObject |
op_mul(ThreadContext context,
IRubyObject other)
fix_mul |
IRubyObject |
op_neg()
fix_rev |
IRubyObject |
op_or(ThreadContext context,
IRubyObject other)
fix_or |
IRubyObject |
op_plus(ThreadContext context,
IRubyObject other)
fix_plus |
IRubyObject |
op_pow_19(ThreadContext context,
IRubyObject other)
fix_pow |
IRubyObject |
op_pow(ThreadContext context,
IRubyObject other)
fix_pow |
IRubyObject |
op_rshift(IRubyObject other)
fix_rshift |
IRubyObject |
op_uminus()
fix_uminus |
IRubyObject |
op_xor(ThreadContext context,
IRubyObject other)
fix_xor |
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 |
to_f()
fix_to_f |
IRubyObject |
to_java()
|
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, convertToInteger, createIntegerClass, denominator, downto, downto19, even_p, gcd, gcdlcm, induced_from, integer_p, lcm, numerator, odd_p, pred, succ, times, times19, to_i, to_r, toFloat, upto, upto19 |
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, doCoerce, eql_p, fdiv, fix2int, fix2long, floor, getCoerced, image, initialize_copy, int2fix, modulo, newNumeric, nonzero_p, num2chr, num2dbl, num2fix, num2int, num2long, op_cmp, op_num_equal, op_uminus, op_uplus, polar, quo_19, real, rect, remainder, round, sadded, scalar_p, step, step, step, step19, step19, str2fnum, str2fnum, str2inum, str2inum, to_c, to_int, truncate, zero_p |
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
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 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 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()
RubyObject
hash
in class RubyObject
public final int hashCode()
RubyObject
hashCode
in class RubyObject
public boolean equals(java.lang.Object other)
RubyObject
equals
in class RubyObject
public RubyString to_s(IRubyObject[] args)
public RubyString to_s()
RubyObject
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 RubyObject
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_minus(ThreadContext context, IRubyObject other)
public IRubyObject op_mul(ThreadContext context, IRubyObject other)
public IRubyObject div_div(ThreadContext context, IRubyObject other)
public IRubyObject op_div(ThreadContext context, IRubyObject 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 op_mod(ThreadContext context, IRubyObject other)
public IRubyObject divmod(ThreadContext context, IRubyObject other)
divmod
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_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 RubyObject
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
public IRubyObject op_gt(ThreadContext context, IRubyObject other)
public IRubyObject op_ge(ThreadContext context, IRubyObject other)
public IRubyObject op_lt(ThreadContext context, IRubyObject other)
public IRubyObject op_le(ThreadContext context, IRubyObject other)
public IRubyObject op_neg()
public IRubyObject op_and(ThreadContext context, IRubyObject other)
public IRubyObject op_or(ThreadContext context, IRubyObject other)
public IRubyObject op_xor(ThreadContext context, IRubyObject other)
public IRubyObject op_aref(IRubyObject other)
public IRubyObject op_lshift(IRubyObject other)
public IRubyObject op_rshift(IRubyObject other)
public IRubyObject to_f()
public IRubyObject size()
public IRubyObject zero_p()
public IRubyObject id()
RubyObject
id
in interface IRubyObject
id
in class RubyObject
public IRubyObject taint(ThreadContext context)
RubyObject
$SAFE
level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.
taint
in class RubyObject
public IRubyObject freeze(ThreadContext context)
RubyObject
TypeError
will be raised if modification is attempted.
There is no way to unfreeze a frozen object. See also
Object#frozen?
.
a = [ "a", "b", "c" ]
a.freeze
a << "z"
produces:
prog.rb:3:in `<<': can't modify frozen array (TypeError)
from prog.rb:3
freeze
in class RubyObject
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)
public IRubyObject to_java()
to_java
in class RubyObject
public IRubyObject as(java.lang.Class javaClass)
as
in class RubyObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |