Java OpenMaple Application Program Interface (API)
Java OpenMaple provides an interface between the Maple evaluation engine and a Java program. This is implemented using Java classes and Java interfaces. The classes allow Java programs to access the Maple evaluation engine. The interfaces allow the Maple evaluation engine to call Java functions.
To use the Java Open Maple interface, start by creating an Engine object. The Engine constructor accepts an object that implements the EngineCallBacks interface. These call backs are used to handle various events from the Maple engine. The Engine object can be used to evaluate a string containing Maple commands or to create new Maple data structures. The Engine object is essentially an object factory for creating Java objects that represent Maple data.
The various Maple data types have corresponding Java classes. These objects have member functions to allow the programmer to manipulate them. Here are a few examples:
The Name object represents a Maple name. A value can be assigned to a Name by using the assign member function. To access the value assigned to the Name the eval member function can be called.
A Procedure object represents a Maple procedure. The execute member function can be used to call the procedure.
There is an hierarchy among the Open Maple objects. All the Open Maple objects inherit from the Algebraic class. This provides the functions that are common to all Maple objects, such as eval. In addition, the class Indexable is a subclass of Algebraic and itself a parent class.
To handle errors, Maple objects throw a MapleException. In addition, user specified call backs can throw a MapleException to indicate that an error occurred.
The following interfaces allow Java functions to be called from the Maple evaluation engine.
The HelpCallBacks interface provides the functionality required to access the text of a help page.
The EngineCallBacks interface provides the functionality required to transfer general information between the user and Maple evaluation engine, for example, interrupt handling and warning, error, and status messages.
The following classes are available to interface with the Maple evaluation engine. To access these classes, the Maple.jar and externalcall.jar files must be in the classpath. As well, the Java Open Maple native library must be accessible to the dynamic loader. For more information, see the running page.
The Engine class is used to start, restart, and stop the Maple session as well as evaluate Maple statements and create new Maple data structures.
The Algebraic class is the parent class of all the classes that represent Maple objects. Its member functions provide access to all the basic functions that can be performed on an object.
The Numeric class represents numeric objects (integers, fractions, and floats). The Numeric class has member functions to convert the Maple object to the Java native types.
The ComplexNumeric class represents complex numbers. Conceptually, a ComplexNumeric object contains two Numeric objects: its real part and its imaginary part.
The Name class represents a Maple name. Name publicly inherits from Algebraic.
The Procedure class represents a procedure. Member functions allow for evaluating the procedure.
The Relation class represents a relation. Member functions allow for returning the left-hand or right-hand side of the relation or evaluating it to a true/false value.
The Indexable class is the parent class of all the classes that represent Maple collections. Its member functions provide access to the basic functions that can be performed on a collection, such as querying its size and testing for membership.
The Expseq class represents an expression sequence. Member functions allow for indexing into the expression sequence and returning its length.
The List class represents a list. Member functions allow for indexing into the list and returning its length.
The Set class represents a set. Member functions allow for indexing into the set and returning its length.
The Table class represents a table. Data can be inserted and removed from the table and a table can be searched for a particular element.
The RTable class represents an rtable. Datatype specific rtables are represented by sub-classes of RTable. These sub-classes have datatype specific functions. The RTable member functions perform operations applicable to any rtable.
The AlgebraicRTable class represents an rtable of type anything. It allows access to individual elements of the rtable as Algebraic objects.
The ByteRTable class represents an rtable of type integer1. It allows access to individual elements of the rtable as Java bytes.
The ComplexDoubleRTable class represents an rtable of type complex8. It allows access to individual elements of the rtable as pairs of Java doubles.
The ComplexNumericRTable class represents an rtable of type complex⁡sfloat. It allows access to individual elements of the rtable as ComplexNumeric objects.
The DoubleRTable class represents an rtable of type float8. It allows access to individual elements of the rtable as Java doubles.
The FloatRTable class represents an rtable of type float4. It allows access to individual elements of the rtable as Java floats.
The IntRTable class represents an rtable of type integer4. It allows access to individual elements of the rtable as Java integers.
The LongRTable class represents an rtable of type integer8. It allows access to individual elements of the rtable as Java longs.
The NumericRTable class represents an rtable of type sfloat. It allows access to individual elements of the rtable as Numeric objects.
The ShortRTable class represents an rtable of type integer2. It allows access to individual elements of the rtable as Numeric objects.
The MapleException class is used when errors are raised within Java Open Maple. See also the ?MapleException class constructor help page.
The HelpCallBacksDefault provides a basic implementation of the HelpCallBacks interface. This class can be used directly or it can be sub-classed to override the member functions.
The EngineCallBacksDefault provides a basic implementation of the EngineCallBacks interface. This class can be used directly or it can be sub-classed to override the member functions.
The MString represents a Maple string. This class provides conversion from Maple strings to Java strings.
Download Help Document