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
Interfaces
Classes
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.
Interface Listing
EngineCallBacks
HelpCallBacks
com.maplesoft.openmaple.HelpCallBacks
The HelpCallBacks interface provides the functionality required to access the text of a help page.
writeAttrib
writeChar
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.
callBackCallBack
errorCallBack
queryInterrupt
readlineCallBack
redirectCallBack
statusCallBack
streamCallBack
textCallBack
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
Algebraic
AlgebraicRTable
ByteRTable
ComplexDoubleRTable
ComplexNumeric
ComplexNumericRTable
DoubleRTable
Engine
EngineCallBacksDefault
Expseq
FloatRTable
HelpCallBacksDefault
Indexable
IntRTable
List
LongRTable
MString
Name
Numeric
NumericRTable
Procedure
Relation
RTable
Set
ShortRTable
Table
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.
evaluate
getHelp
newExpseq
newList
newMString
newName
newNumeric
newTable
restart
stop
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.
dagEquals
dispose
eval
evalhf
isDisposed
isNULL
isSet
isStop
toString
uneval
unique
com.maplesoft.openmaple.Numeric
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.
byteValue
doubleValue
floatValue
intValue
isByte
isInt
isInteger
isLong
isShort
isUnnamedZero
longValue
shortValue
toBigDecimal
toBigInteger
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.
imaginaryPart
realPart
com.maplesoft.openmaple.Name
The Name class represents a Maple name. Name publicly inherits from Algebraic.
assign
isAssigned
com.maplesoft.openmaple.Procedure
The Procedure class represents a procedure. Member functions allow for evaluating the procedure.
execute
executehf
com.maplesoft.openmaple.Relation
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.
evalBoolean
lhs
rhs
com.maplesoft.openmaple.Indexable
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.
max
member
min
numElements
size
toList
com.maplesoft.openmaple.Expseq
The Expseq class represents an expression sequence. Member functions allow for indexing into the expression sequence and returning its length.
iterator
select
com.maplesoft.openmaple.List
The List class represents a list. Member functions allow for indexing into the list and returning its length.
contains
containsAll
get
indexByRange
indexOf
lastIndexOf
searchFirst
searchLast
subList
toArray
com.maplesoft.openmaple.Set
The Set class represents a set. Member functions allow for indexing into the set and returning its length.
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.
clear
containsKey
containsValue
entrySet
has
indexEntryPairs
keySet
put
putAll
remove
unassign
values
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.
copy
dimensions
lowerBound
upperBound
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 integer1. It allows access to individual elements of the rtable as Java bytes.
com.maplesoft.openmaple.ComplexDoubleRTable
The ComplexDoubleRTable class represents an rtable of type complex8. It allows access to individual elements of the rtable as pairs of Java doubles.
copyImaginary
copyReal
selectImaginary
selectReal
com.maplesoft.openmaple.ComplexNumericRTable
The ComplexNumericRTable class represents an rtable of type complex⁡sfloat. It allows access to individual elements of the rtable as ComplexNumeric objects.
com.maplesoft.openmaple.DoubleRTable
The DoubleRTable class represents an rtable of type float8. It allows access to individual elements of the rtable as Java doubles.
com.maplesoft.openmaple.FloatRTable
The FloatRTable class represents an rtable of type float4. It allows access to individual elements of the rtable as Java floats.
com.maplesoft.openmaple.IntRTable
The IntRTable class represents an rtable of type integer4. It allows access to individual elements of the rtable as Java integers.
com.maplesoft.openmaple.LongRTable
The LongRTable class represents an rtable of type integer8. It allows access to individual elements of the rtable as Java longs.
com.maplesoft.openmaple.NumericRTable
The NumericRTable class represents an rtable of type 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 integer2. 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.
getArg
getArgCount
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.
stringValue
See Also
OpenMaple
OpenMaple/Java/Examples
OpenMaple/Java/running
Download Help Document