edu.vub.at.objects.natives
Class NATFraction

java.lang.Object
  extended byedu.vub.at.objects.natives.NATNil
      extended byedu.vub.at.objects.natives.NATByCopy
          extended byedu.vub.at.objects.natives.grammar.NATAbstractGrammar
              extended byedu.vub.at.objects.natives.grammar.AGExpression
                  extended byedu.vub.at.objects.natives.NATNumeric
                      extended byedu.vub.at.objects.natives.NATFraction
All Implemented Interfaces:
ATAbstractGrammar, ATConversions, ATExpression, ATFraction, ATNil, ATNumeric, ATObject, ATStatement, java.io.Serializable

public final class NATFraction
extends NATNumeric
implements ATFraction

The native implementation of an AmbientTalk fraction. A fraction is implemented by a Java double.

Author:
tvc
See Also:
Serialized Form

Field Summary
static NATFraction INFTY
           
 double javaValue
           
 
Fields inherited from class edu.vub.at.objects.natives.NATNil
_INSTANCE_
 
Constructor Summary
private NATFraction(double javaFrc)
           
 
Method Summary
 NATFraction asNativeFraction()
           
static NATFraction atValue(double javaFrc)
          This method currently serves as a hook for fraction creation.
 ATNumeric base__opdiv_(ATNumeric other)
           
 ATNumeric base__opltx__opeql__opgtx_(ATNumeric other)
           
 ATNumeric base__opmns_(ATNumeric other)
           
 ATNumeric base__oppls_(ATNumeric other)
           
 ATNumeric base__optms_(ATNumeric other)
           
 ATNumeric base_abs()
          FRC(n).abs() => FRC(abs(n))
 ATNumeric base_addFraction(ATFraction other)
           
 ATNumeric base_addNumber(ATNumber other)
           
 ATNumber base_ceiling()
          FRC(n).ceiling() => NBR(ceil(n))
 ATNumeric base_dec()
          FRC(n).dec() => FRC(n-1)
 ATNumeric base_divideFraction(ATFraction other)
           
 ATNumeric base_divideNumber(ATNumber other)
           
 ATNumber base_floor()
          FRC(n).floor() => NBR(floor(n))
 ATNumeric base_gequalsFraction(ATFraction other)
           
 ATNumeric base_gequalsNumber(ATNumber other)
           
 ATNumeric base_inc()
          FRC(n).inc() => FRC(n+1)
 ATNumber base_round()
          FRC(n).round() => NBR(round(n))
 ATNumeric base_subtractFraction(ATFraction other)
           
 ATNumeric base_subtractNumber(ATNumber other)
           
 ATNumeric base_timesFraction(ATFraction other)
           
 ATNumeric base_timesNumber(ATNumber other)
           
 boolean equals(java.lang.Object other)
          By default, two AmbientTalk objects are equal if they are the same object, or one is a proxy for the same object.
protected  double getJavaValue()
          Template method that should return the value of the underlying number or fraction as a double
 ATTable meta_getStripes()
          Returns the stripes of this object.
 NATText meta_print()
          Prints out the object in a human-readable way.
 
Methods inherited from class edu.vub.at.objects.natives.NATNumeric
asNativeNumeric, base__opeql_, base__opgtx__opeql_, base__opgtx_, base__opltx__opeql_, base__opltx_, base__opnot__opeql_, base_cos, base_expt, base_log, base_sin, base_sqrt, base_tan
 
Methods inherited from class edu.vub.at.objects.natives.grammar.AGExpression
base_asExpression
 
Methods inherited from class edu.vub.at.objects.natives.NATByCopy
meta_pass, meta_resolve
 
Methods inherited from class edu.vub.at.objects.natives.NATNil
asAmbientTalkObject, asJavaClassUnderSymbiosis, asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeNumber, asNativeTable, asNativeText, base__opeql__opeql_, base_asActorMirror, base_asAsyncMessage, base_asBegin, base_asBoolean, base_asClosure, base_asDefinition, base_asFarReference, base_asField, base_asHandler, base_asMessage, base_asMessageCreation, base_asMethod, base_asMirror, base_asNumber, base_asSplice, base_asStatement, base_asStripe, base_asSymbol, base_asTable, base_asUnquoteSplice, base_asVariableAssignment, base_init, base_isBoolean, base_isCallFrame, base_isClosure, base_isFarReference, base_isMessageCreation, base_isMethod, base_isMirror, base_isSplice, base_isStripe, base_isSymbol, base_isTable, base_isUnquoteSplice, base_isVariableAssignment, base_new, createChild, isAmbientTalkObject, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText, meta_addField, meta_addMethod, meta_assignField, meta_assignVariable, meta_clone, meta_defineField, meta_doesNotUnderstand, meta_eval, meta_extend, meta_getDynamicParent, meta_getLexicalParent, meta_grabField, meta_grabMethod, meta_invoke, meta_isCloneOf, meta_isRelatedTo, meta_isStripedWith, meta_listFields, meta_listMethods, meta_lookup, meta_newInstance, meta_quote, meta_receive, meta_respondsTo, meta_select, meta_send, meta_share, readResolve, toString, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.vub.at.objects.ATNumeric
base__opeql_, base__opgtx__opeql_, base__opgtx_, base__opltx__opeql_, base__opltx_, base__opnot__opeql_, base_cos, base_expt, base_log, base_sin, base_sqrt, base_tan
 
Methods inherited from interface edu.vub.at.objects.ATObject
base__opeql__opeql_, base_init, base_new, meta_addField, meta_addMethod, meta_assignField, meta_assignVariable, meta_clone, meta_defineField, meta_doesNotUnderstand, meta_eval, meta_extend, meta_getDynamicParent, meta_getLexicalParent, meta_grabField, meta_grabMethod, meta_invoke, meta_isCloneOf, meta_isRelatedTo, meta_isStripedWith, meta_listFields, meta_listMethods, meta_lookup, meta_newInstance, meta_pass, meta_quote, meta_receive, meta_resolve, meta_respondsTo, meta_select, meta_send, meta_share
 
Methods inherited from interface edu.vub.at.objects.coercion.ATConversions
asAmbientTalkObject, asJavaClassUnderSymbiosis, asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeNumber, asNativeNumeric, asNativeTable, asNativeText, base_asActorMirror, base_asAsyncMessage, base_asBegin, base_asBoolean, base_asClosure, base_asDefinition, base_asExpression, base_asFarReference, base_asField, base_asHandler, base_asMessage, base_asMessageCreation, base_asMethod, base_asMirror, base_asNumber, base_asSplice, base_asStatement, base_asStripe, base_asSymbol, base_asTable, base_asUnquoteSplice, base_asVariableAssignment, base_isBoolean, base_isCallFrame, base_isClosure, base_isFarReference, base_isMessageCreation, base_isMethod, base_isMirror, base_isSplice, base_isStripe, base_isSymbol, base_isTable, base_isUnquoteSplice, base_isVariableAssignment, isAmbientTalkObject, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText
 

Field Detail

INFTY

public static final NATFraction INFTY

javaValue

public final double javaValue
Constructor Detail

NATFraction

private NATFraction(double javaFrc)
Method Detail

atValue

public static final NATFraction atValue(double javaFrc)
This method currently serves as a hook for fraction creation. Currently fraction objects are not reused, but this might change in the future.


asNativeFraction

public NATFraction asNativeFraction()
Specified by:
asNativeFraction in interface ATConversions
Overrides:
asNativeFraction in class NATNil

equals

public boolean equals(java.lang.Object other)
Description copied from class: NATNil
By default, two AmbientTalk objects are equal if they are the same object, or one is a proxy for the same object.

Overrides:
equals in class NATNil

meta_print

public NATText meta_print()
                   throws InterpreterException
Description copied from interface: ATObject
Prints out the object in a human-readable way.

Specified by:
meta_print in interface ATObject
Overrides:
meta_print in class NATNil
Throws:
InterpreterException

meta_getStripes

public ATTable meta_getStripes()
                        throws InterpreterException
Description copied from interface: ATObject
Returns the stripes of this object. Note that only the stripes that were attached directly to this object are returned, not all of the parent's stripes as well.

Specified by:
meta_getStripes in interface ATObject
Overrides:
meta_getStripes in class NATNumeric
Throws:
InterpreterException

getJavaValue

protected double getJavaValue()
Description copied from class: NATNumeric
Template method that should return the value of the underlying number or fraction as a double

Specified by:
getJavaValue in class NATNumeric

base_inc

public ATNumeric base_inc()
FRC(n).inc() => FRC(n+1)

Specified by:
base_inc in interface ATFraction

base_dec

public ATNumeric base_dec()
FRC(n).dec() => FRC(n-1)

Specified by:
base_dec in interface ATFraction

base_abs

public ATNumeric base_abs()
FRC(n).abs() => FRC(abs(n))

Specified by:
base_abs in interface ATFraction

base_round

public ATNumber base_round()
FRC(n).round() => NBR(round(n))

Specified by:
base_round in interface ATFraction

base_floor

public ATNumber base_floor()
FRC(n).floor() => NBR(floor(n))

Specified by:
base_floor in interface ATFraction

base_ceiling

public ATNumber base_ceiling()
FRC(n).ceiling() => NBR(ceil(n))

Specified by:
base_ceiling in interface ATFraction

base__oppls_

public ATNumeric base__oppls_(ATNumeric other)
                       throws InterpreterException
Specified by:
base__oppls_ in interface ATNumeric
Throws:
InterpreterException

base_addNumber

public ATNumeric base_addNumber(ATNumber other)
                         throws InterpreterException
Specified by:
base_addNumber in interface ATNumeric
Throws:
InterpreterException

base_addFraction

public ATNumeric base_addFraction(ATFraction other)
                           throws InterpreterException
Specified by:
base_addFraction in interface ATNumeric
Throws:
InterpreterException

base__opmns_

public ATNumeric base__opmns_(ATNumeric other)
                       throws InterpreterException
Specified by:
base__opmns_ in interface ATNumeric
Throws:
InterpreterException

base_subtractNumber

public ATNumeric base_subtractNumber(ATNumber other)
                              throws InterpreterException
Specified by:
base_subtractNumber in interface ATNumeric
Throws:
InterpreterException

base_subtractFraction

public ATNumeric base_subtractFraction(ATFraction other)
                                throws InterpreterException
Specified by:
base_subtractFraction in interface ATNumeric
Throws:
InterpreterException

base__optms_

public ATNumeric base__optms_(ATNumeric other)
                       throws InterpreterException
Specified by:
base__optms_ in interface ATNumeric
Throws:
InterpreterException

base_timesNumber

public ATNumeric base_timesNumber(ATNumber other)
                           throws InterpreterException
Specified by:
base_timesNumber in interface ATNumeric
Throws:
InterpreterException

base_timesFraction

public ATNumeric base_timesFraction(ATFraction other)
                             throws InterpreterException
Specified by:
base_timesFraction in interface ATNumeric
Throws:
InterpreterException

base__opdiv_

public ATNumeric base__opdiv_(ATNumeric other)
                       throws InterpreterException
Specified by:
base__opdiv_ in interface ATNumeric
Throws:
InterpreterException

base_divideNumber

public ATNumeric base_divideNumber(ATNumber other)
                            throws InterpreterException
Specified by:
base_divideNumber in interface ATNumeric
Throws:
InterpreterException

base_divideFraction

public ATNumeric base_divideFraction(ATFraction other)
                              throws InterpreterException
Specified by:
base_divideFraction in interface ATNumeric
Throws:
InterpreterException

base__opltx__opeql__opgtx_

public ATNumeric base__opltx__opeql__opgtx_(ATNumeric other)
                                     throws InterpreterException
Specified by:
base__opltx__opeql__opgtx_ in interface ATNumeric
Throws:
InterpreterException

base_gequalsNumber

public ATNumeric base_gequalsNumber(ATNumber other)
                             throws InterpreterException
Specified by:
base_gequalsNumber in interface ATNumeric
Throws:
InterpreterException

base_gequalsFraction

public ATNumeric base_gequalsFraction(ATFraction other)
                               throws InterpreterException
Specified by:
base_gequalsFraction in interface ATNumeric
Throws:
InterpreterException