Package com.rubecula.jquantity

JQuantity Contents: Copyright Notice Overview JQuantity Philosophy Programming Conventions Package Structure
Class Structure Links Important Note about the links to classes in this document:  This document appears in two different places: the source tree and the doc tree (where it is placed by the javadoc program).


Interface Summary
Arithmetical Interface to define certain standard Arithmetical accessor methods.
Arithmutable This interface defines various arithmetical mutating methods.
CompoundModel Class
Divisible Interface to define Divisible arithmetical operations.
Estimable The public interface Estimable defines the methods which allow an object to maintain a visible, up-to-date estimate of its value for debugging purposes.
Fuzzy This interface specifies the methods which characterize a fuzzy value: getBoundAbs, getBound, getModel.
FuzzyMutable This interface specifies the methods which allow setting fuzzy data: setBoundAbs, setBoundRel, setModel.
FuzzyPresentable This interface defines operations required for presenting fuzzy objects.
Imaginable Imaginable: the interface which defines complex operations.
Integral Interface to define Integral operations.
Millable This interface is implemented by objects which can be operated on by a mill, i.e. something which implements MillInterface.
Mutable This interface is used to define whether an object is mutable, that is to say it has non-final instance fields with mutator methods.
Normalizable This interface defines the operation which can be invoked on an object to "normalize" it.
Transcendental This interface models the functions necessary for evaluating transcendental functions.
Trigonometrical This interface defines trigonometrical operations.

Class Summary
Approximation This Class approximates a value using an immutable double-precision value.
AttributeFactory Class
Attributes Class
BaseNumber Abstract (scalar) numerical class from which to derive other concrete classes.
Complex Representation of a Complex Number Objects of this class represent complex numbers defined on one side or the other of the EL (exponential-log) plane.
Compound Class
Constants Class to create Lookupable objects for the JQuantity framework.
DivisibleMutable Interface to define Mutating Divisible arithmetical operations.
Expression Class to manage a mathematical expression.
FuzzInt This class extends a WholeNumber by adding fuzzy parameters.
IntegerPresentation Presentation class to deal with integral objects in radix 10.
JQuantity This class represents a quantity, that is to say a value and its units.
JQuantityPresentation This class is a string-component representation of a JQuantity.
Library Class which defines constants, formulas, etc. for use in a Mill.
Loader This public class is used to populate the JQuantity system at run-time with various definitions of units, etc.
Manifest This class defines a "manifest" constant (a whole number which cannot be changed).
Mill This class is responsible for evaluating operations on Presentable objects.
MillFactory Factory class for Mills.
MutableNumber Abstract class from which to derive other concrete classes of mutable numbers.
MutablePresentation Class
NumberPresentation Public class used primarily for the output of instances of Rational.
OneMatrix Class to model a fixed-size one-dimensional matrix (normally called a Vector) but given the name OneMatrix to avoid confusion with Vector.
Operator This class defines operators in the context of SymbolicPresentations and their Presentable counterparts: Expressions.
PresentableFactory Factory class for creating Presentables from double or long values (the preferred method of creating Presentables is to start with a String, create a Presentation using an implementer of PresentationFactoryInterface, and then turn that into a Presentable).
PresentationFactory Factory class for Presentations.
QuantityPresentation Presentation class to deal with quantity objects.
QuantityProperties Class to model JQuantities which can be read from a properties file, stored back and looked up (using a key string) the application.
Rational Public class to represent precise rational numbers.
Row Class
SparseMatrix Class
SymbolicPresentation Class to model the presentation of symbolic text, for example in a mathematical formula.
TwoMatrix Class to represent a fixed size two-dimensional matrix.
Value This class represents a Rational which may be factored in some way.
ValuePresentation Presentation class to deal with value objects.
WholeNumber This class is a logical extension of the BigInteger class, but is an actual extension of MutableNumber.

Exception Summary
Expression.ExpressionException Static class to define an exception encountered when parsing a formula.
InvalidOperandException A checked exception intended to be internal to the JQuantity package, which indicates that when a mathematical operation A op B is invoked, the class of B is not valid for the operation on A.
JQuantityException This exception class is used to report problems in the JQuantity package.

Package com.rubecula.jquantity Description



Important Note about the links to classes in this document:  This document appears in two different places: the source tree and the doc tree (where it is placed by the javadoc program).  The class links are only valid when reading the version in the doc tree.

Copyright Notice

JQUANTITY Framework Project.
Copyright (C) 2002, 2003, 2004 Rubecula Software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

CVS Version: $Revision: 1.10 $

Back to Top


The following text was provided to SourceForge to describe this project [note that some of this may now be outdated]:

The purpose of this project is to make available a set of Java classes which enable end users and programmers to make scientific calculations resulting in either exact quantities or quantities with known (bounded) errors.

Previously developed in the form of an end-user applet supported by beans, this project will remodel the classes for more general usage including end-user usage as a servlet or SOAP-enabled RPC.

The primary class is JQuantity. An instance of JQuantity includes the actual value (i.e. the best approximation of the value), the current precision (error bounds) and the units.

Numbers may be real or complex. JQuantity calculations use a method of lazy evaluation of transcendental-function-based quantities which either reduces or eliminates possible errors. Non-transcendental quantities are represented as rational numbers. Non-zero errors, where needed, can be characterized as uniform or Gaussian.

Methods allow representation of a JQuantity in the most appropriate text form, given a user-preferred system of units.

An extensible library of standard constants is provided. A JQuantity stack (of semi-infinite size) is provided which supports most of the standard mathematical functions. Non-supported esoteric functions can be added by accessing other calculator programs, e.g. unix calc, or by simply using the macro programming capability.

For usage as a serious online calculator for end-users, a swing-based applet class is provided which allows customization and programmability.

The applet will be extended to allow infix operations in addition to the current RPN operations.

Back to Top

JQuantity Philosophy

Here are some of the tenets of the philosophy behind the design and development of JQuantity:

Back to Top

Programming Conventions

Note two things, however. Although most of the code has its roots in an earlier implementation (of Calculator.NET), much of it has been completely rewritten more or less from scratch. However, some parts (notably those dealing with Units) have not yet been scrubbed convention-wise. Furthermore, conventions change somewhat, especially in the light of the Eclipse Workbench which I am now using to develop the code. This has its own ideas of the appropriate ordering of source code.

Back to Top

Package Structure

Most of the numeric classes are in the package called com.rubecula.jquantity.  At some future time, this will be split further with the purely numeric going into a package called com.rubecula.numeric (or similar), and the presentation-related classes going into com.rubecula.presentation (or similar).  The classes remaining in jquantity will probably be have to do with expression parsing, units, compound numbers like Complex, etc.

Other packages related to JQuantity are:

The remainder of this document (or at least, most of it) describes the jquantity package in more detail.

Class Structure

The following is an introduction to the major classes and interfaces of the jquantity package. Use it as a starting point and/or as an adjunct to the javadoc (or possibly here: javadoc). However, if there are discrepancies, then the javadoc must of course take should be considered definitive.

Before describing the numerical classes proper, it is important to mention two (co-) utility classes (in the util package):

Note that the two classes Presentation and Presentable are co-dependent (this is the only situation in the jquantity package where two classes are mutually dependent).

Following are descriptions of the significant JQuantity classes.

Back to Top


Back to Top

Last Updated: 2004-01-31