org.jruby
Class RubyFloat

java.lang.Object
  extended by org.jruby.RubyBasicObject
      extended by org.jruby.RubyObject
          extended by org.jruby.RubyNumeric
              extended by org.jruby.RubyFloat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType

public class RubyFloat
extends RubyNumeric

A representation of a float object

See Also:
Serialized Form

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
 
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
RubyFloat(Ruby runtime)
           
RubyFloat(Ruby runtime, double value)
           
 
Method Summary
 IRubyObject abs(ThreadContext context)
          flo_abs
 IRubyObject ceil()
          flo_ceil
 IRubyObject coerce(IRubyObject other)
          flo_coerce
protected  int compareValue(RubyNumeric other)
           
 RubyFloat convertToFloat()
          Tries to convert this object to a Ruby Float using the "to_f" method.
static RubyClass createFloatClass(Ruby runtime)
           
 IRubyObject divmod(ThreadContext context, IRubyObject other)
          flo_divmod
 IRubyObject eql_p(IRubyObject other)
          flo_eql
 IRubyObject finite_p()
          flo_is_finite_p
 IRubyObject floor()
          floor
 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.
 double getValue()
          Getter for property value.
 RubyFixnum hash()
          flo_hash
 int hashCode()
          Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects.
static IRubyObject induced_from(ThreadContext context, IRubyObject recv, IRubyObject number)
          rb_flo_induced_from
 IRubyObject infinite_p()
          flo_is_infinite_p
 IRubyObject magnitude(ThreadContext context)
          flo_abs/1.9
 IRubyObject magnitude(ThreadContext context, IRubyObject other)
          flo_quo
static void marshalTo(RubyFloat aFloat, MarshalStream output)
           
 IRubyObject nan_p()
          flo_is_nan_p
static RubyFloat newFloat(Ruby runtime, double value)
           
 IRubyObject op_cmp(ThreadContext context, IRubyObject other)
          flo_cmp
 IRubyObject op_equal(ThreadContext context, IRubyObject other)
          flo_eq
 IRubyObject op_fdiv(ThreadContext context, IRubyObject other)
          flo_div
 IRubyObject op_ge(ThreadContext context, IRubyObject other)
          flo_ge
 IRubyObject op_gt(ThreadContext context, IRubyObject other)
          flo_gt
 IRubyObject op_le(ThreadContext context, IRubyObject other)
          flo_le
 IRubyObject op_lt(ThreadContext context, IRubyObject other)
          flo_lt
 IRubyObject op_minus(ThreadContext context, IRubyObject other)
          flo_minus
 IRubyObject op_mod(ThreadContext context, IRubyObject other)
          flo_mod
 IRubyObject op_mul(ThreadContext context, IRubyObject other)
          flo_mul
 IRubyObject op_plus(ThreadContext context, IRubyObject other)
          flo_plus
 IRubyObject op_pow(ThreadContext context, IRubyObject other)
          flo_pow
 IRubyObject op_uminus()
          flo_uminus
 IRubyObject round()
          flo_round
 IRubyObject to_f()
          flo_fo
 IRubyObject to_r(ThreadContext context)
           
 IRubyObject to_s()
          flo_to_s
 IRubyObject truncate()
          flo_truncate
static RubyFloat unmarshalFrom(UnmarshalStream input)
           
 IRubyObject zero_p()
          flo_zero_p
 
Methods inherited from class org.jruby.RubyNumeric
abs2, arg, asNumeric, callCoerced, callCoerced, checkInt, coerceBin, coerceBody, coerceCmp, coerceRelOp, conjugate, createNumericClass, dbl_cmp, dbl2num, denominator, div, doCoerce, eql_p, fdiv, fix2int, fix2long, getCoerced, image, initialize_copy, int2fix, integer_p, modulo, newNumeric, nonzero_p, num2chr, num2dbl, num2fix, num2int, num2long, numerator, op_cmp, op_num_equal, op_uminus, op_uplus, polar, quo_19, quo, real, rect, remainder, sadded, scalar_p, step, step, step, step19, step19, str2fnum, str2fnum, str2inum, str2inum, to_c, to_int, zero_p
 
Methods inherited from class org.jruby.RubyObject
as, attachToObjectSpace, callInit, checkFrozen, convertToType, createObjectClass, display, dup, eqlInternal, equal_p, equalInternal, equals, evalUnder, evalUnder, extend, freeze, frozen_p, id_deprecated, id, initialize, inspect, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, kind_of_p, method, methods, nil_p, op_eqq, op_match, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, respond_to_p, respond_to_p, send, send, send, send, send, singleton_methods, singleton_methods19, singletonMethods, specificEval, specificEval, specificEval, specificEval, specificEval, taint, tainted_p, to_a, to_java, toString, type_deprecated, type, untaint, validateInstanceVariable
 
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkStringType, convertToArray, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataWrapStruct, ensureInstanceVariablesSettable, eql, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, getFlag, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariableList, getInternalVariables, getMetaClass, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariableCount, getVariableList, getVariableMap, getVariableNameList, hasInstanceVariable, hasInternalVariable, hasVariables, infectBy, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isRubyVariable, isTaint, isTrue, makeMetaClass, op_not_equal, op_not, removeFinalizers, removeInstanceVariable, removeInternalVariable, respondsTo, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, syncVariables, taint, testFrozen, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableGetMap, variableTableGetMap, variableTableGetSize, variableTableGetTable, variableTableReadLocked, variableTableRehash, variableTableRemove, variableTableStore, variableTableSync
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RubyFloat

public RubyFloat(Ruby runtime)

RubyFloat

public RubyFloat(Ruby runtime,
                 double value)
Method Detail

createFloatClass

public static RubyClass createFloatClass(Ruby runtime)

getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from class: RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex

Specified by:
getNativeTypeIndex in interface CoreObjectType
Overrides:
getNativeTypeIndex in class RubyObject
Returns:
the ClassIndex of the native type this object was constructed from
See Also:
org.jruby.runtime.ClassInde

getJavaClass

public java.lang.Class<?> getJavaClass()
Description copied from class: RubyBasicObject
Will return the Java interface that most closely can represent this object, when working through JAva integration translations.

Specified by:
getJavaClass in interface IRubyObject
Overrides:
getJavaClass in class RubyBasicObject
Returns:
Class

getValue

public double getValue()
Getter for property value.

Returns:
Value of property value.

getDoubleValue

public double getDoubleValue()
Overrides:
getDoubleValue in class RubyNumeric

getLongValue

public long getLongValue()
Overrides:
getLongValue in class RubyNumeric

convertToFloat

public RubyFloat convertToFloat()
Description copied from class: RubyBasicObject
Tries to convert this object to a Ruby Float using the "to_f" method.

Specified by:
convertToFloat in interface IRubyObject
Overrides:
convertToFloat in class RubyBasicObject
Returns:

compareValue

protected int compareValue(RubyNumeric other)

newFloat

public static RubyFloat newFloat(Ruby runtime,
                                 double value)

induced_from

public static IRubyObject induced_from(ThreadContext context,
                                       IRubyObject recv,
                                       IRubyObject number)
rb_flo_induced_from


to_s

public IRubyObject to_s()
flo_to_s

Overrides:
to_s in class RubyObject

coerce

public IRubyObject coerce(IRubyObject other)
flo_coerce

Overrides:
coerce in class RubyNumeric

op_uminus

public IRubyObject op_uminus()
flo_uminus


op_plus

public IRubyObject op_plus(ThreadContext context,
                           IRubyObject other)
flo_plus


op_minus

public IRubyObject op_minus(ThreadContext context,
                            IRubyObject other)
flo_minus


op_mul

public IRubyObject op_mul(ThreadContext context,
                          IRubyObject other)
flo_mul


op_fdiv

public IRubyObject op_fdiv(ThreadContext context,
                           IRubyObject other)
flo_div


magnitude

public IRubyObject magnitude(ThreadContext context,
                             IRubyObject other)
flo_quo


op_mod

public IRubyObject op_mod(ThreadContext context,
                          IRubyObject other)
flo_mod


divmod

public IRubyObject divmod(ThreadContext context,
                          IRubyObject other)
flo_divmod

Overrides:
divmod in class RubyNumeric

op_pow

public IRubyObject op_pow(ThreadContext context,
                          IRubyObject other)
flo_pow


op_equal

public IRubyObject op_equal(ThreadContext context,
                            IRubyObject other)
flo_eq

Specified by:
op_equal in interface IRubyObject
Overrides:
op_equal in class RubyObject

op_cmp

public IRubyObject op_cmp(ThreadContext context,
                          IRubyObject other)
flo_cmp


op_gt

public IRubyObject op_gt(ThreadContext context,
                         IRubyObject other)
flo_gt


op_ge

public IRubyObject op_ge(ThreadContext context,
                         IRubyObject other)
flo_ge


op_lt

public IRubyObject op_lt(ThreadContext context,
                         IRubyObject other)
flo_lt


op_le

public IRubyObject op_le(ThreadContext context,
                         IRubyObject other)
flo_le


eql_p

public IRubyObject eql_p(IRubyObject other)
flo_eql

Overrides:
eql_p in class RubyObject

hash

public RubyFixnum hash()
flo_hash

Overrides:
hash in class RubyObject

hashCode

public final int hashCode()
Description copied from class: RubyObject
Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects. If the Ruby "hash" method doesn't return a number, the Object#hashCode implementation will be used instead.

Overrides:
hashCode in class RubyObject

to_f

public IRubyObject to_f()
flo_fo


abs

public IRubyObject abs(ThreadContext context)
flo_abs

Overrides:
abs in class RubyNumeric

magnitude

public IRubyObject magnitude(ThreadContext context)
flo_abs/1.9

Overrides:
magnitude in class RubyNumeric

zero_p

public IRubyObject zero_p()
flo_zero_p


truncate

public IRubyObject truncate()
flo_truncate

Overrides:
truncate in class RubyNumeric

to_r

public IRubyObject to_r(ThreadContext context)

floor

public IRubyObject floor()
floor

Overrides:
floor in class RubyNumeric

ceil

public IRubyObject ceil()
flo_ceil

Overrides:
ceil in class RubyNumeric

round

public IRubyObject round()
flo_round

Overrides:
round in class RubyNumeric

nan_p

public IRubyObject nan_p()
flo_is_nan_p


infinite_p

public IRubyObject infinite_p()
flo_is_infinite_p


finite_p

public IRubyObject finite_p()
flo_is_finite_p


marshalTo

public static void marshalTo(RubyFloat aFloat,
                             MarshalStream output)
                      throws java.io.IOException
Throws:
java.io.IOException

unmarshalFrom

public static RubyFloat unmarshalFrom(UnmarshalStream input)
                               throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2002-2007 JRuby Team. All Rights Reserved.