|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.Finalizer, RubyObject.ObjectMethods, RubyObject.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 |
---|
ALL_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, metaClassName, NEVER, NIL_F, OBJECT_ALLOCATOR, 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()
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. |
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()
|
IRubyObject |
freeze()
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 rutning 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?). |
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(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()
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. |
IRubyObject |
to_f()
fix_to_f |
RubyString |
to_s(IRubyObject[] args)
fix_to_s |
IRubyObject |
to_sym()
fix_to_sym |
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, downto, even_p, induced_from, integer_p, odd_p, pred, succ, times, to_i, toFloat, upto |
Methods inherited from class org.jruby.RubyNumeric |
---|
abs, asNumeric, callCoerced, callCoerced, ceil, checkInt, coerce, coerceBin, coerceBody, coerceCmp, coerceRelOp, createNumericClass, dbl_cmp, dbl2num, div, doCoerce, eql_p, fix2int, fix2long, floor, getCoerced, initialize_copy, int2fix, modulo, newNumeric, nonzero_p, num2chr, num2dbl, num2fix, num2int, num2long, op_cmp, op_num_equal, op_uminus, op_uplus, remainder, round, sadded, step, str2fnum, str2fnum, str2inum, str2inum, 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 RubyObject
public boolean isImmediate()
RubyObject
isImmediate
in interface IRubyObject
isImmediate
in class RubyObject
public RubyClass getSingletonClass()
RubyObject
getSingletonClass
in interface IRubyObject
getSingletonClass
in class RubyObject
public java.lang.Class<?> getJavaClass()
RubyObject
getJavaClass
in interface IRubyObject
getJavaClass
in class RubyObject
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 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 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 abs()
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()
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()
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()
RubyObject
asJavaString
in interface IRubyObject
asJavaString
in class RubyObject
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 |