Java OpenMaple Application Program Interface (API) - Maple Programming Help

Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : OpenMaple/Java/API

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.

Overview

 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{OpenMaple/Java/Algebraic} class.  This provides the functions that are common to all Maple objects, such as eval.  In addition, the classes Numeric and RTable are sub-classes of Algebraic and are themselves parent classes.
 To handle errors Maple objects throw a MapleException.  In addition, user specified call backs can throw a MapleException to indicate that an error occurred.

Interfaces

 • The following interfaces allow Java functions to be called from the Maple evaluation engine.

Interface Listing

com.maplesoft.openmaple.HelpCallBacks

 • The HelpCallBacks interface provides the functionality required to access the text of a help page.

com.maplesoft.openmaple.EngineCallBacks

 • 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.

Classes

 • 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.

Class Listing

com.maplesoft.openmaple.Engine

 • 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.

com.maplesoft.openmaple.Algebraic

 • 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.

com.maplesoft.openmaple.Numeric

 • The Numeric class represents numeric objects (integers and floats).  The Numeric class has member functions to convert the Maple object to the Java native types.

com.maplesoft.openmaple.ComplexNumeric

 • The ComplexNumeric class represents complex numbers.  Conceptually, a ComplexNumeric object contains two Numeric objects: its real part and its imaginary part.

com.maplesoft.openmaple.Name

 • The Name class represents a Maple name. Name publicly inherits from Algebraic.

com.maplesoft.openmaple.Expseq

 • The Expseq class represents an expression sequence.  Member functions allow for indexing into the expression sequence and returning its length.

com.maplesoft.openmaple.List

 • The List class represents a list.  Member functions allow for indexing into the list and returning its length.

com.maplesoft.openmaple.Procedure

 • The Procedure class represents a procedure. Member functions allow for evaluating the procedure.

com.maplesoft.openmaple.Table

 • 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.

com.maplesoft.openmaple.RTable

 • 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.

com.maplesoft.openmaple.AlgebraicRTable

 • The AlgebraicRTable class represents an rtable of type anything.  It allows access to individual elements of the rtable as Algebraic objects.

com.maplesoft.openmaple.ByteRTable

 • The ByteRTable class represents an rtable of type ${\mathrm{integer}}_{1}$.  It allows access to individual elements of the rtable as Java bytes.

com.maplesoft.openmaple.ComplexDoubleRTable

 • The ComplexDoubleRTable class represents an rtable of type ${\mathrm{complex}}_{8}$.  It allows access to individual elements of the rtable as pairs of Java doubles.

com.maplesoft.openmaple.ComplexNumericRTable

 • The ComplexNumericRTable class represents an rtable of type $\mathrm{complex}\left(\mathrm{sfloat}\right)$.  It allows access to individual elements of the rtable as ComplexNumeric objects.

com.maplesoft.openmaple.DoubleRTable

 • The DoubleRTable class represents an rtable of type ${\mathrm{float}}_{8}$.  It allows access to individual elements of the rtable as Java doubles.

com.maplesoft.openmaple.FloatRTable

 • The FloatRTable class represents an rtable of type ${\mathrm{float}}_{4}$.  It allows access to individual elements of the rtable as Java floats.

com.maplesoft.openmaple.IntRTable

 • The IntRTable class represents an rtable of type ${\mathrm{integer}}_{4}$.  It allows access to individual elements of the rtable as Java integers.

com.maplesoft.openmaple.LongRTable

 • The LongRTable class represents an rtable of type ${\mathrm{integer}}_{8}$.  It allows access to individual elements of the rtable as Java longs.

com.maplesoft.openmaple.NumericRTable

 • The NumericRTable class represents an rtable of type $\mathrm{sfloat}$.  It allows access to individual elements of the rtable as Numeric objects.

com.maplesoft.openmaple.ShortRTable

 • The ShortRTable class represents an rtable of type ${\mathrm{integer}}_{2}$.  It allows access to individual elements of the rtable as Numeric objects.

com.maplesoft.externalcall.MapleException

 • The MapleException class is used when errors are raised within Java Open Maple. See also the ?MapleException class constructor help page.

com.maplesoft.openmaple.HelpCallBacksDefault

 • 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.

com.maplesoft.openmaple.EngineCallBacksDefault

 • 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.

com.maplesoft.openmaple.MString

 • The MString represents a Maple string.  This class provides conversion from Maple strings to Java strings.