examples

The following directories contain programs written in the JOOS language. In
each directory you will find a Makefile which shows how make the
programs in the directory (i.e. which .java files go together to form
an application).
The following directories contain Java applications (not applets).

Most examples have been taken from textbooks and modified so that they are
written in JOOS. The changes made to make them into JOOS program
includes:

Making the constructors explicit, and conforming to JOOS specifications
with an explicit call to the super constructor.

Since JOOS does not support constants, all constants (particularly
those from the Java awt libraries)
must be accessed via nullary functions
found in the JOOS libarary class called JoosConstants. You may refer
to the file
$JOOSDIR/Lib/joos/lib/JoosConstants.java to see all of the
constants supported in this manner.

Since JOOS does not support overloading, the
JOOS external declarations
only support one alternative (usually the most general one)
for each method in Java libraries.
In some cases, for example the add
method in the Container class,
both alternatives are really needed. In this case there is a JOOS
wrapper class called JoosContainer
that provided a new name for
each kind of add (addString and addPosition).

Some Java libarary classes have static members and/or classes. In
order to get this functionality, one needs to use the appropriate wrapper
JOOS class.
A good example of this is the JoosDimension class that
provides a wrapper to the Java Dimension class.

Java has quite a rich class structure to support various kinds of I/O.
All JOOS I/O is simple, and is done using the functions found in the
JoosIO class.

JOOS does not support exceptions, and so it is not possible to
directly call Java library methods that raise exceptions that must
be caught (i.e exceptions that are not Runtime exceptions). Thus, some
JOOS libarary classes are provided that wrap the exception raising
methods inside a method that catches the exception and returns true if
an exception was caught (for example, sleep in
JoosThread).

Since JOOS does not support real numbers, and some
awt functions
require real numbers as input (GridBagConstraints),
there is a JOOS version
(JoosGridBagConstraints), that uses JoosFractions
to represent non-integers.