User`s guide

6 Reference Infor mation for Java
Programming Interfaces Generated by Java Builder
“APIs Based on MATLAB Function Signatures” on page 6-14
“Standard API” on page 6-15
“mlx API” on page 6-17
“Code Fragment: Signatures Generated for myprimes Exam ple” on page
6-17
APIs Based on MATLAB Function Signatures
Jav a B uilde r g enerates tw o kinds of interfaces to handle MATLAB function
signatures.
A standard signature in Java.
This interface specifies input arguments for each overloaded method as
oneormoreinputargumentsofclass
java.lang.Object or any subclass
(including subclasses of
MWArray). The standard interface specifies return
values,ifany,asasubclassof
MWArray.
mlx API
This interface allows the user to specify the inputs to a function as an
Object array, where each array e lem ent is one input argument. Similarly,
theuseralsogivesthemlxinterfaceapre-allocatedObjectarraytohold
the outputs of the function. The allocated length of the output array
determines the num ber o f desired function outputs.
The mlx interface may also be accessed using java.util.List containers
in place of Object arrays for the inputs and outputs. Note that if List
containers are used, the output List passed in must contain a number of
elements equal to the desired number of function outputs.
For example, this would be incorrect usage:
java.util.List outputs = new ArrayList(3);
myclass.myfunction(outputs, inputs); // outputs contains 0 elements!
And this would be the correct usage:
java.util.List outputs = Arrays.asList(new Object[3]);
myclass.myfunction(outputs, inputs); // ok, list contains 3 elements
6-14