sisc.data
Class Quantity
java.lang.Object
sisc.util.Util
sisc.data.Expression
sisc.data.Value
sisc.data.Quantity
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable, Immediate, Singleton, ExpressionVisitee, Version
public class Quantity
- extends Value
- implements Singleton
- See Also:
- Serialized Form
Fields inherited from class sisc.util.Util |
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV |
Method Summary |
Quantity |
acos()
|
Quantity |
add(Quantity o)
|
Quantity |
and(Quantity o)
|
Quantity |
asin()
|
Quantity |
atan()
|
Quantity |
atan(Quantity other)
|
Quantity |
bitCount()
|
Quantity |
ceiling()
|
boolean |
comp(Quantity o,
int test)
|
Quantity |
cos()
|
static double |
cosh(double x)
|
protected static java.math.BigInteger |
d2i(double d)
|
double |
decimal()
|
Quantity |
denominator()
|
void |
deserialize(Deserializer s)
All Expressions must implement a default (no-argument) constructor. |
void |
display(ValueWriter w)
|
protected static double |
div(double d1,
double d2)
|
Quantity |
div(Quantity o)
|
double |
doubleValue()
|
boolean |
equals(java.lang.Object v)
Compares this Value to another. |
boolean |
eqv(java.lang.Object v)
Compares this Value to another for equality according to the
rules of Scheme's eqv?. |
Quantity |
exp()
|
Quantity |
floor()
|
Quantity |
gcd(Quantity o)
|
boolean |
greater(Quantity o)
|
int |
hashCode()
|
Quantity |
imagpart()
|
int |
indexValue()
|
protected Quantity |
intBound(long v)
|
java.math.BigInteger |
integer()
|
int |
intValue()
|
boolean |
is(int mask)
|
Quantity |
lcm(Quantity o)
|
boolean |
less(Quantity o)
|
Quantity |
log()
|
long |
longValue()
|
Quantity |
lsh(int num)
|
Quantity |
modulo(Quantity o)
|
Quantity |
mul(Quantity o)
|
Quantity |
negate()
|
Quantity |
not()
|
Quantity |
numerator()
|
Quantity |
or(Quantity o)
|
protected static double |
parseDecimal(java.lang.String dv,
int radix)
|
protected static double |
parseDecimal(java.lang.String dv,
int radix,
boolean asDecimal)
|
protected static boolean |
parsePounds(char[] c)
|
protected static Quantity |
parseUinteger(java.lang.String v,
int radix)
|
Quantity |
quotient(Quantity o)
|
protected static double |
ratioToDecimal(java.math.BigInteger numerator,
java.math.BigInteger denominator)
|
Quantity |
realpart()
|
Quantity |
remainder(Quantity o)
|
Quantity |
round()
|
protected Quantity |
round(int rtype)
|
Quantity |
rsh(int num)
|
protected static int |
scale(int scale1,
int scale2)
|
void |
serialize(Serializer s)
All Expressions must implement a default (no-argument) constructor. |
protected static int |
sign(double d)
|
protected void |
simplify()
|
Quantity |
sin()
|
Value |
singletonValue()
|
static double |
sinh(double x)
|
Quantity |
sqrt()
|
static java.math.BigDecimal[] |
sqrtrem(java.math.BigDecimal x)
|
static java.math.BigInteger[] |
sqrtrem(java.math.BigInteger x)
|
Quantity |
sub(Quantity o)
|
Quantity |
tan()
|
Quantity |
toExact()
|
Quantity |
toInexact()
|
java.lang.String |
toString()
|
java.lang.String |
toString(int radix)
|
Quantity |
truncate()
|
boolean |
valueEqual(Value v)
Compares this value to another for semantic equality. |
static Quantity |
valueOf(java.math.BigDecimal val)
|
static Quantity |
valueOf(java.math.BigInteger val)
|
static Quantity |
valueOf(java.math.BigInteger num,
java.math.BigInteger den)
|
static Quantity |
valueOf(double val)
|
static Quantity |
valueOf(double real,
double imag)
|
static Quantity |
valueOf(int val)
|
static Quantity |
valueOf(long val)
|
static Quantity |
valueOf(Quantity real,
Quantity imag)
|
static Quantity |
valueOf(java.lang.String v)
|
static Quantity |
valueOf(java.lang.String v,
int radix)
|
static Quantity |
valueOf(java.lang.String v,
int radix,
boolean handleComplex)
|
Quantity |
xor(Quantity o)
|
protected static java.lang.String |
zeroTrim(java.lang.String s)
|
Methods inherited from class sisc.data.Expression |
deserializeAnnotations, getAnnotation, getAnnotation, getAnnotationKeys, getAnnotations, getName, readExternal, readResolve, serializeAnnotations, setAnnotation, setAnnotation, setName, visit, visitAnnotations, writeExternal |
Methods inherited from class sisc.util.Util |
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
_BI_NEGONE
public static final java.math.BigInteger _BI_NEGONE
_BI_ZERO
public static final java.math.BigInteger _BI_ZERO
_BI_ONE
public static final java.math.BigInteger _BI_ONE
_BI_TEN
public static final java.math.BigInteger _BI_TEN
_INT_MAX
public static final java.math.BigInteger _INT_MAX
_INT_MIN
public static final java.math.BigInteger _INT_MIN
ZERO
public static final Quantity ZERO
IZERO
public static final Quantity IZERO
ONE
public static final Quantity ONE
NEGONE
public static final Quantity NEGONE
TWO
public static final Quantity TWO
I
public static final Quantity I
TWO_I
public static final Quantity TWO_I
POSITIVE_INFINITY
public static final Quantity POSITIVE_INFINITY
NEGATIVE_INFINITY
public static final Quantity NEGATIVE_INFINITY
HALF_PI
public static final Quantity HALF_PI
NaN
public static final Quantity NaN
FIXED
public static final int FIXED
- See Also:
- Constant Field Values
EXACT
public static final int EXACT
- See Also:
- Constant Field Values
INEXACT
public static final int INEXACT
- See Also:
- Constant Field Values
RATIONAL
public static final int RATIONAL
- See Also:
- Constant Field Values
IMAGINARY
public static final int IMAGINARY
- See Also:
- Constant Field Values
INTEGER
public static final int INTEGER
- See Also:
- Constant Field Values
DECIMAL
public static final int DECIMAL
- See Also:
- Constant Field Values
FIXEDINT
public static final int FIXEDINT
- See Also:
- Constant Field Values
DECIM
public static final int DECIM
- See Also:
- Constant Field Values
INTEG
public static final int INTEG
- See Also:
- Constant Field Values
RATIO
public static final int RATIO
- See Also:
- Constant Field Values
COMPLEX
public static final int COMPLEX
- See Also:
- Constant Field Values
POSINF
public static final int POSINF
- See Also:
- Constant Field Values
NEGINF
public static final int NEGINF
- See Also:
- Constant Field Values
NAN
public static final int NAN
- See Also:
- Constant Field Values
characteristics
public static final int[] characteristics
type
public int type
val
public int val
d
public double d
im
public double im
i
public java.math.BigInteger i
de
public java.math.BigInteger de
Quantity
public Quantity()
valueOf
public static Quantity valueOf(int val)
valueOf
public static Quantity valueOf(long val)
valueOf
public static Quantity valueOf(double val)
valueOf
public static Quantity valueOf(java.math.BigInteger val)
valueOf
public static Quantity valueOf(java.math.BigDecimal val)
valueOf
public static Quantity valueOf(java.math.BigInteger num,
java.math.BigInteger den)
valueOf
public static Quantity valueOf(Quantity real,
Quantity imag)
valueOf
public static Quantity valueOf(double real,
double imag)
valueOf
public static Quantity valueOf(java.lang.String v)
valueOf
public static final Quantity valueOf(java.lang.String v,
int radix)
valueOf
public static Quantity valueOf(java.lang.String v,
int radix,
boolean handleComplex)
sign
protected static int sign(double d)
parsePounds
protected static boolean parsePounds(char[] c)
parseUinteger
protected static Quantity parseUinteger(java.lang.String v,
int radix)
parseDecimal
protected static double parseDecimal(java.lang.String dv,
int radix)
parseDecimal
protected static double parseDecimal(java.lang.String dv,
int radix,
boolean asDecimal)
simplify
protected void simplify()
and
public Quantity and(Quantity o)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
or
public Quantity or(Quantity o)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
xor
public Quantity xor(Quantity o)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
not
public Quantity not()
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
bitCount
public Quantity bitCount()
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
lsh
public Quantity lsh(int num)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
rsh
public Quantity rsh(int num)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
floor
public Quantity floor()
ceiling
public Quantity ceiling()
truncate
public Quantity truncate()
round
public Quantity round()
d2i
protected static java.math.BigInteger d2i(double d)
gcd
public Quantity gcd(Quantity o)
lcm
public Quantity lcm(Quantity o)
round
protected Quantity round(int rtype)
modulo
public Quantity modulo(Quantity o)
quotient
public Quantity quotient(Quantity o)
remainder
public Quantity remainder(Quantity o)
sinh
public static double sinh(double x)
cosh
public static double cosh(double x)
sin
public Quantity sin()
cos
public Quantity cos()
tan
public Quantity tan()
asin
public Quantity asin()
acos
public Quantity acos()
atan
public Quantity atan()
atan
public Quantity atan(Quantity other)
exp
public Quantity exp()
log
public Quantity log()
negate
public Quantity negate()
sqrtrem
public static java.math.BigDecimal[] sqrtrem(java.math.BigDecimal x)
throws java.lang.ArithmeticException
- Throws:
java.lang.ArithmeticException
sqrtrem
public static java.math.BigInteger[] sqrtrem(java.math.BigInteger x)
throws java.lang.ArithmeticException
- Throws:
java.lang.ArithmeticException
sqrt
public Quantity sqrt()
add
public Quantity add(Quantity o)
mul
public Quantity mul(Quantity o)
sub
public Quantity sub(Quantity o)
div
protected static double div(double d1,
double d2)
div
public Quantity div(Quantity o)
comp
public boolean comp(Quantity o,
int test)
doubleValue
public double doubleValue()
decimal
public double decimal()
longValue
public long longValue()
indexValue
public int indexValue()
intValue
public int intValue()
integer
public java.math.BigInteger integer()
toExact
public Quantity toExact()
toInexact
public Quantity toInexact()
realpart
public Quantity realpart()
imagpart
public Quantity imagpart()
numerator
public Quantity numerator()
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
denominator
public Quantity denominator()
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
ratioToDecimal
protected static double ratioToDecimal(java.math.BigInteger numerator,
java.math.BigInteger denominator)
scale
protected static int scale(int scale1,
int scale2)
intBound
protected final Quantity intBound(long v)
is
public boolean is(int mask)
greater
public boolean greater(Quantity o)
less
public boolean less(Quantity o)
eqv
public boolean eqv(java.lang.Object v)
- Description copied from class:
Value
- Compares this Value to another for equality according to the
rules of Scheme's eqv?. In SISC, this differs from eq? in that
eq? is strict pointer equality.
- Overrides:
eqv
in class Value
- Parameters:
v
- the other Value
equals
public boolean equals(java.lang.Object v)
- Description copied from class:
Value
- Compares this Value to another. By default equal to eqv.
- Overrides:
equals
in class Value
- Parameters:
v
- the other Value
valueEqual
public boolean valueEqual(Value v)
- Description copied from class:
Value
- Compares this value to another for semantic equality. Used to
implement Scheme's 'equal?'. Subclasses must test for
pointer equality as well as semantic equality, so that infinite loops
on recursive structures are less likely.
- Overrides:
valueEqual
in class Value
- Parameters:
v
- the other Value
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
display
public void display(ValueWriter w)
throws java.io.IOException
- Specified by:
display
in class Value
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class Value
zeroTrim
protected static java.lang.String zeroTrim(java.lang.String s)
toString
public java.lang.String toString(int radix)
deserialize
public void deserialize(Deserializer s)
throws java.io.IOException
- Description copied from class:
Expression
- All Expressions must implement a default (no-argument) constructor.
Those that wish to b serialized to a heap must implement both this
and the serialize method. The Expression may use any method of the
DataInput stream and the Deserializer serialization context
to read its state.
- Overrides:
deserialize
in class Expression
- Parameters:
s
- the Deserializer
- Throws:
java.io.IOException
serialize
public void serialize(Serializer s)
throws java.io.IOException
- Description copied from class:
Expression
- All Expressions must implement a default (no-argument) constructor.
Those that wish to be serialized to a heap must implement both this
and the deserialize method. The Expression may use any method of
the Serializer, which implements java.io.DataOutput
to write its state.
- Overrides:
serialize
in class Expression
- Parameters:
s
- the Serializer
- Throws:
java.io.IOException
singletonValue
public Value singletonValue()
- Specified by:
singletonValue
in interface Singleton