|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.vub.at.objects.natives.NATNil
edu.vub.at.objects.natives.NATByCopy
edu.vub.at.objects.natives.grammar.NATAbstractGrammar
edu.vub.at.objects.natives.grammar.AGExpression
edu.vub.at.objects.natives.NATNumeric
edu.vub.at.objects.natives.NATNumber
The native implementation of an AmbientTalk number. A number is implemented by a Java int.
Field Summary | |
int |
javaValue
|
static NATNumber |
MONE
|
static NATNumber |
ONE
|
static NATNumber |
ZERO
|
Fields inherited from class edu.vub.at.objects.natives.NATNil |
_INSTANCE_ |
Constructor Summary | |
private |
NATNumber(int javaNumber)
|
Method Summary | |
NATNumber |
asNativeNumber()
|
static NATNumber |
atValue(int javaNumber)
This method currently serves as a hook for number creation. |
ATNumber |
base__opdiv__opmns_(ATNumber n)
NBR(n) /- NBR(d) => NBR(n / d) |
ATNumeric |
base__opdiv_(ATNumeric other)
|
ATNumeric |
base__opltx__opeql__opgtx_(ATNumeric other)
|
ATNumeric |
base__opmns_(ATNumeric other)
|
ATNumeric |
base__oppls_(ATNumeric other)
|
ATFraction |
base__opque__opque_(ATNumber nbr)
NBR(start) ?? |
ATNumber |
base__oprem_(ATNumber n)
NBR(n) % NBR(r) => NBR(n % r) |
ATTable |
base__optms__optms__optms_(ATNumber end)
NBR(start) *** NBR(stop) => [ start, ..., stop ] Example: 2 *** 5 => [ 2, 3, 4, 5 ] 5 *** 2 => [ 5, 4, 3, 2 ] |
ATTable |
base__optms__optms_(ATNumber end)
NBR(start) ** NBR(stop) => [ start, ..., stop [ Example: 2 ** 5 => [ 2, 3, 4 ] 5 ** 2 => [ 5, 4, 3 ] |
ATNumeric |
base__optms_(ATNumeric other)
|
ATNumeric |
base_abs()
NBR(n).abs() => NBR(abs(n)) |
ATNumeric |
base_addFraction(ATFraction other)
|
ATNumeric |
base_addNumber(ATNumber other)
|
ATNumber |
base_asNumber()
|
ATNumeric |
base_dec()
NBR(n).dec() => NBR(n-1) |
ATNumeric |
base_divideFraction(ATFraction other)
|
ATNumeric |
base_divideNumber(ATNumber other)
|
ATNil |
base_doTimes_(ATClosure code)
NBR(n).doTimes: { |i| code } => for i = 1 to n do code.eval(i) ; nil |
ATNumeric |
base_gequalsFraction(ATFraction other)
|
ATNumeric |
base_gequalsNumber(ATNumber other)
|
ATNumeric |
base_inc()
NBR(n).inc() => NBR(n+1) |
ATNumeric |
base_subtractFraction(ATFraction other)
|
ATNumeric |
base_subtractNumber(ATNumber other)
|
ATNumeric |
base_timesFraction(ATFraction other)
|
ATNumeric |
base_timesNumber(ATNumber other)
|
ATNil |
base_to_do_(ATNumber end,
ATClosure code)
NBR(start).to: NBR(stop) do: { |i| code } => for i = start to stop do code.eval(i) ; nil Also works if stop > start, in which case it becomes a downTo. |
ATNil |
base_to_step_do_(ATNumber end,
ATNumber inc,
ATClosure code)
NBR(start).to: NBR(stop) step: NBR(inc) do: { |i| code } => for i = start; i < stop; i++ do code.eval(i) ; nil Also works if stop > start, in which case it becomes a downTo. |
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 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 |
Field Detail |
public static final NATNumber ZERO
public static final NATNumber ONE
public static final NATNumber MONE
public final int javaValue
Constructor Detail |
private NATNumber(int javaNumber)
Method Detail |
public static final NATNumber atValue(int javaNumber)
public boolean equals(java.lang.Object other)
NATNil
equals
in class NATNil
public ATNumber base_asNumber() throws XTypeMismatch
base_asNumber
in interface ATConversions
base_asNumber
in class NATNil
XTypeMismatch
public NATNumber asNativeNumber()
asNativeNumber
in interface ATConversions
asNativeNumber
in class NATNil
public NATText meta_print() throws InterpreterException
ATObject
meta_print
in interface ATObject
meta_print
in class NATNil
InterpreterException
public ATTable meta_getStripes() throws InterpreterException
ATObject
meta_getStripes
in interface ATObject
meta_getStripes
in class NATNumeric
InterpreterException
protected double getJavaValue()
NATNumeric
getJavaValue
in class NATNumeric
public ATNil base_doTimes_(ATClosure code) throws InterpreterException
base_doTimes_
in interface ATNumber
InterpreterException
public ATNil base_to_do_(ATNumber end, ATClosure code) throws InterpreterException
base_to_do_
in interface ATNumber
InterpreterException
public ATNil base_to_step_do_(ATNumber end, ATNumber inc, ATClosure code) throws InterpreterException
base_to_step_do_
in interface ATNumber
InterpreterException
public ATTable base__optms__optms_(ATNumber end) throws InterpreterException
base__optms__optms_
in interface ATNumber
InterpreterException
public ATTable base__optms__optms__optms_(ATNumber end) throws InterpreterException
base__optms__optms__optms_
in interface ATNumber
InterpreterException
public ATNumeric base_inc()
base_inc
in interface ATNumber
public ATNumeric base_dec()
base_dec
in interface ATNumber
public ATNumeric base_abs()
base_abs
in interface ATNumber
public ATFraction base__opque__opque_(ATNumber nbr) throws InterpreterException
base__opque__opque_
in interface ATNumber
InterpreterException
public ATNumber base__oprem_(ATNumber n) throws InterpreterException
base__oprem_
in interface ATNumber
InterpreterException
public ATNumber base__opdiv__opmns_(ATNumber n) throws InterpreterException
base__opdiv__opmns_
in interface ATNumber
InterpreterException
public ATNumeric base__oppls_(ATNumeric other) throws InterpreterException
base__oppls_
in interface ATNumeric
InterpreterException
public ATNumeric base_addNumber(ATNumber other) throws InterpreterException
base_addNumber
in interface ATNumeric
InterpreterException
public ATNumeric base_addFraction(ATFraction other) throws InterpreterException
base_addFraction
in interface ATNumeric
InterpreterException
public ATNumeric base__opmns_(ATNumeric other) throws InterpreterException
base__opmns_
in interface ATNumeric
InterpreterException
public ATNumeric base_subtractNumber(ATNumber other) throws InterpreterException
base_subtractNumber
in interface ATNumeric
InterpreterException
public ATNumeric base_subtractFraction(ATFraction other) throws InterpreterException
base_subtractFraction
in interface ATNumeric
InterpreterException
public ATNumeric base__optms_(ATNumeric other) throws InterpreterException
base__optms_
in interface ATNumeric
InterpreterException
public ATNumeric base_timesNumber(ATNumber other) throws InterpreterException
base_timesNumber
in interface ATNumeric
InterpreterException
public ATNumeric base_timesFraction(ATFraction other) throws InterpreterException
base_timesFraction
in interface ATNumeric
InterpreterException
public ATNumeric base__opdiv_(ATNumeric other) throws InterpreterException
base__opdiv_
in interface ATNumeric
InterpreterException
public ATNumeric base_divideNumber(ATNumber other) throws InterpreterException
base_divideNumber
in interface ATNumeric
InterpreterException
public ATNumeric base_divideFraction(ATFraction other) throws InterpreterException
base_divideFraction
in interface ATNumeric
InterpreterException
public ATNumeric base__opltx__opeql__opgtx_(ATNumeric other) throws InterpreterException
base__opltx__opeql__opgtx_
in interface ATNumeric
InterpreterException
public ATNumeric base_gequalsNumber(ATNumber other) throws InterpreterException
base_gequalsNumber
in interface ATNumeric
InterpreterException
public ATNumeric base_gequalsFraction(ATFraction other) throws InterpreterException
base_gequalsFraction
in interface ATNumeric
InterpreterException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |