Jatha Software

org.jatha.dynatype
Class StandardLispNumber

java.lang.Object
  extended by org.jatha.dynatype.StandardLispValue
      extended by org.jatha.dynatype.StandardLispAtom
          extended by org.jatha.dynatype.StandardLispNumber
All Implemented Interfaces:
Comparable, LispAtom, LispNumber, LispValue
Direct Known Subclasses:
StandardLispComplex, StandardLispInteger, StandardLispReal

public abstract class StandardLispNumber
extends StandardLispAtom
implements LispNumber

LispNumber is an abstract class that implements the Common LISP NUMBER type. It contains the definitions of add, subtract, multiply and divide.

See Also:
LispValue, LispAtom, LispInteger, LispReal

Field Summary
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
StandardLispNumber()
           
StandardLispNumber(Jatha lisp)
           
 
Method Summary
 LispValue abs()
          Default implementation of abs.
 LispValue acos()
          Arccos function with result in radians.
 LispValue add(LispValue args)
          ADD adds any combination of real or integer numbers.
 LispValue asin()
          Arcsin function with result in radians.
 LispValue atan()
          Arctan function with result in radians.
 LispValue atan2(LispValue x)
          Two-argument Arctan function with result in radians Also called Inverse Tangent, this is the angle whose tangent is y/x, where y is the first argument and x is the second argument.
 boolean basic_constantp()
          Returns Java true if the object is a constant.
 boolean basic_numberp()
          Returns Java true if the object is a number.
 LispValue ceiling()
          Returns the smallest integer greater than or equal to the input value.
 LispValue constantp()
          Returns T if the object is a constant.
 LispValue cos()
          Cosine function, argument in radians.
 LispValue cot()
          Cotangent function, 1/tan(x), argument in radians.
 LispValue csc()
          Cosecant function, 1/sin(x), argument in radians.
 LispValue degreesToRadians()
          Converts a numeric value from degrees to radians.
 LispValue divide(LispValue args)
          DIVIDE adds any combination of real or integer numbers.
 LispValue eql(LispValue arg)
          Returns T if the argument is EQ to the object or if the arguments and object are numbers with equal values.
 LispValue equalNumeric(LispValue arg)
          Returns T if the object is EQUAL to its argument.
 LispValue factorial()
          Compute the factorial of a non-negative integer.
 LispValue floor()
          Returns the largest integer less than or equal to the input value.
abstract  double getDoubleValue()
          Returns a double value corresponding to this value.
 LispValue greaterThan(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly decreasing order.
 LispValue greaterThanOrEqual(LispValue arg)
          Returns T if the object prepended to the argument list is in non-increasing order.
 LispValue lessThan(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly increasing order.
 LispValue lessThanOrEqual(LispValue arg)
          Returns T if the object prepended to the argument list is in strictly non-decreasing order.
 LispValue max(LispValue args)
          Returns the max of this number and its arguments, which may be a list of numbers or a single number.
 LispValue min(LispValue args)
          Returns the min of this number and its arguments, which may be a list of numbers or a single number.
 LispValue multiply(LispValue args)
          MULTIPLY adds any combination of real or integer numbers.
 LispValue negate()
          Returns the negative of the given number.
 LispValue numberp()
          Returns T if the object is any kind of number.
 LispValue radiansToDegrees()
          Converts a numeric value from radians to degrees.
 LispValue reciprocal()
          Computes 1/x of the given number.
 LispValue sec()
          Secant function, 1/cos(x), argument in radians.
 LispValue sin()
          Sine trigonometric function, argument is in radians.
 LispValue sqrt()
          Square root.
 LispValue subtract(LispValue args)
          SUBTRACT adds any combination of real or integer numbers.
 LispValue tan()
          Tangent trigonometric function, argument is in radians.
 LispValue typep(LispValue type)
           
 
Methods inherited from class org.jatha.dynatype.StandardLispAtom
atom, basic_atom
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
adjustSpecialCount, append, apply, apropos_print, assoc, basic_bignump, basic_consp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_stringp, basic_symbolp, bignump, boundp, butlast, car, cdr, characterp, clrhash, compareTo, concatenate, consp, contains, copy_list, copy, documentation, eighth, elt, elt, eq, equal, fboundp, fifth, first, floatp, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, iterator, keywordp, last, length, lisp_null, list, listp, member, nconc, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, pop, position, prin1, princ, print, push, rassoc, readFromString, remhash, remove, rest, reverse, rplaca, rplacd, second, set_special, setf_documentation, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, showStackTrace, sixth, specialP, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tenth, third, toCollection, toJava, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, uses, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jatha.dynatype.LispNumber
getBigIntegerValue, getLongValue
 
Methods inherited from interface org.jatha.dynatype.LispValue
adjustSpecialCount, append, apply, apropos_print, assoc, atom, basic_atom, basic_bignump, basic_consp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_stringp, basic_symbolp, bignump, boundp, butlast, car, cdr, characterp, clrhash, compareTo, concatenate, consp, contains, copy_list, copy, documentation, eighth, elt, elt, eq, equal, fboundp, fifth, first, floatp, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, iterator, keywordp, last, length, lisp_null, list, listp, member, nconc, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, pop, position, prin1, princ, print, push, rassoc, readFromString, remhash, remove, rest, reverse, rplaca, rplacd, second, set_special, setf_documentation, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sixth, specialP, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tenth, third, toCollection, toJava, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, uses, zerop
 

Constructor Detail

StandardLispNumber

public StandardLispNumber()

StandardLispNumber

public StandardLispNumber(Jatha lisp)
Method Detail

basic_constantp

public boolean basic_constantp()
Description copied from interface: LispValue
Returns Java true if the object is a constant.

Specified by:
basic_constantp in interface LispValue
Overrides:
basic_constantp in class StandardLispValue

basic_numberp

public boolean basic_numberp()
Description copied from interface: LispValue
Returns Java true if the object is a number.

Specified by:
basic_numberp in interface LispValue
Overrides:
basic_numberp in class StandardLispValue

getDoubleValue

public abstract double getDoubleValue()
Description copied from interface: LispNumber
Returns a double value corresponding to this value.

Specified by:
getDoubleValue in interface LispNumber

constantp

public LispValue constantp()
Description copied from interface: LispValue
Returns T if the object is a constant.

Specified by:
constantp in interface LispValue
Overrides:
constantp in class StandardLispValue

abs

public LispValue abs()
Default implementation of abs.

Specified by:
abs in interface LispValue
Overrides:
abs in class StandardLispValue

degreesToRadians

public LispValue degreesToRadians()
Converts a numeric value from degrees to radians.

Specified by:
degreesToRadians in interface LispValue
Overrides:
degreesToRadians in class StandardLispValue
Returns:
The value in radians.

radiansToDegrees

public LispValue radiansToDegrees()
Converts a numeric value from radians to degrees.

Specified by:
radiansToDegrees in interface LispValue
Overrides:
radiansToDegrees in class StandardLispValue
Returns:
The value in degrees.

factorial

public LispValue factorial()
Compute the factorial of a non-negative integer. Reals are truncated to the nearest integer.

Specified by:
factorial in interface LispValue
Overrides:
factorial in class StandardLispValue

max

public LispValue max(LispValue args)
Returns the max of this number and its arguments, which may be a list of numbers or a single number.

Specified by:
max in interface LispValue
Overrides:
max in class StandardLispValue
Parameters:
args - a number or a list of numbers
Returns:
the maximum numeric value.

min

public LispValue min(LispValue args)
Returns the min of this number and its arguments, which may be a list of numbers or a single number.

Specified by:
min in interface LispValue
Overrides:
min in class StandardLispValue
Parameters:
args - a number or a list of numbers
Returns:
the minimum numeric value.

negate

public LispValue negate()
Returns the negative of the given number.

Specified by:
negate in interface LispValue
Overrides:
negate in class StandardLispValue

numberp

public LispValue numberp()
Description copied from interface: LispValue
Returns T if the object is any kind of number.

Specified by:
numberp in interface LispValue
Overrides:
numberp in class StandardLispValue

reciprocal

public LispValue reciprocal()
Computes 1/x of the given number. Only valid for numbers.

Specified by:
reciprocal in interface LispValue
Overrides:
reciprocal in class StandardLispValue
Returns:
a LispReal

add

public LispValue add(LispValue args)
ADD adds any combination of real or integer numbers. May create a Bignum or signal floating-point overflow if necessary.

Specified by:
add in interface LispValue
Overrides:
add in class StandardLispValue
See Also:
LispReal, LispInteger

divide

public LispValue divide(LispValue args)
DIVIDE adds any combination of real or integer numbers.

Specified by:
divide in interface LispValue
Overrides:
divide in class StandardLispValue
See Also:
LispReal, LispInteger, LispBignum

multiply

public LispValue multiply(LispValue args)
MULTIPLY adds any combination of real or integer numbers.

Specified by:
multiply in interface LispValue
Overrides:
multiply in class StandardLispValue
See Also:
LispReal, LispInteger

subtract

public LispValue subtract(LispValue args)
SUBTRACT adds any combination of real or integer numbers.

Specified by:
subtract in interface LispValue
Overrides:
subtract in class StandardLispValue
See Also:
LispReal, LispInteger

acos

public LispValue acos()
Arccos function with result in radians. Also called Inverse Cosine, this is the angle whose cosine is the argument.

Specified by:
acos in interface LispValue
Overrides:
acos in class StandardLispValue

asin

public LispValue asin()
Arcsin function with result in radians. Also called Inverse Sine, this is the angle whose sine is the argument.

Specified by:
asin in interface LispValue
Overrides:
asin in class StandardLispValue

atan

public LispValue atan()
Arctan function with result in radians. Also called Inverse Tangent, this is the angle whose tangent is the argument.

Specified by:
atan in interface LispValue
Overrides:
atan in class StandardLispValue

atan2

public LispValue atan2(LispValue x)
Two-argument Arctan function with result in radians Also called Inverse Tangent, this is the angle whose tangent is y/x, where y is the first argument and x is the second argument.

Specified by:
atan2 in interface LispValue
Overrides:
atan2 in class StandardLispValue

ceiling

public LispValue ceiling()
Returns the smallest integer greater than or equal to the input value.

Specified by:
ceiling in interface LispValue
Overrides:
ceiling in class StandardLispValue

cos

public LispValue cos()
Cosine function, argument in radians.

Specified by:
cos in interface LispValue
Overrides:
cos in class StandardLispValue

cot

public LispValue cot()
Cotangent function, 1/tan(x), argument in radians.

Specified by:
cot in interface LispValue
Overrides:
cot in class StandardLispValue

csc

public LispValue csc()
Cosecant function, 1/sin(x), argument in radians.

Specified by:
csc in interface LispValue
Overrides:
csc in class StandardLispValue

floor

public LispValue floor()
Returns the largest integer less than or equal to the input value.

Specified by:
floor in interface LispValue
Overrides:
floor in class StandardLispValue

sec

public LispValue sec()
Secant function, 1/cos(x), argument in radians.

Specified by:
sec in interface LispValue
Overrides:
sec in class StandardLispValue

sin

public LispValue sin()
Sine trigonometric function, argument is in radians.

Specified by:
sin in interface LispValue
Overrides:
sin in class StandardLispValue

sqrt

public LispValue sqrt()
Description copied from class: StandardLispValue
Square root. Accepts negative numbers.

Specified by:
sqrt in interface LispValue
Overrides:
sqrt in class StandardLispValue

tan

public LispValue tan()
Tangent trigonometric function, argument is in radians.

Specified by:
tan in interface LispValue
Overrides:
tan in class StandardLispValue

typep

public LispValue typep(LispValue type)
Specified by:
typep in interface LispValue
Overrides:
typep in class StandardLispAtom

greaterThan

public LispValue greaterThan(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly decreasing order.

Specified by:
greaterThan in interface LispValue
Overrides:
greaterThan in class StandardLispValue

greaterThanOrEqual

public LispValue greaterThanOrEqual(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in non-increasing order.

Specified by:
greaterThanOrEqual in interface LispValue
Overrides:
greaterThanOrEqual in class StandardLispValue

lessThan

public LispValue lessThan(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly increasing order.

Specified by:
lessThan in interface LispValue
Overrides:
lessThan in class StandardLispValue

lessThanOrEqual

public LispValue lessThanOrEqual(LispValue arg)
Description copied from interface: LispValue
Returns T if the object prepended to the argument list is in strictly non-decreasing order.

Specified by:
lessThanOrEqual in interface LispValue
Overrides:
lessThanOrEqual in class StandardLispValue

equalNumeric

public LispValue equalNumeric(LispValue arg)
Description copied from interface: LispValue
Returns T if the object is EQUAL to its argument.

Specified by:
equalNumeric in interface LispValue
Overrides:
equalNumeric in class StandardLispValue

eql

public LispValue eql(LispValue arg)
Description copied from interface: LispValue
Returns T if the argument is EQ to the object or if the arguments and object are numbers with equal values.

Specified by:
eql in interface LispValue
Overrides:
eql in class StandardLispValue

Jatha Software