Table.assign
add an entry into the Maple Table
Calling Sequence
Parameters
Description
Examples
void assign( Algebraic key, Algebraic val ) throws MapleException
key
-
index to associate with the value
val
value to assign into the table
The assign function associates the Algebraic object val with the Algebraic index key in the Table.
If a value is already assigned to the index key, it is overwritten by val.
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
class Example
{
public static void main( String notused[] ) throws MapleException
String[] mapleArgs = { "java" };
Engine engine = new Engine( mapleArgs, new EngineCallBacksDefault(), null, null );
Table t = engine.newTable();
System.out.println( t );
t.assign( engine.newNumeric( 1 ), engine.newNumeric( 100 ) );
t.assign( engine.newNumeric( 2 ), engine.newNumeric( 200 ) );
t.assign( engine.newNumeric( 3 ), engine.newNumeric( 300 ) );
t.assign( engine.newNumeric( 4 ), engine.newNumeric( 400 ) );
t.assign( engine.newNumeric( 3 ), engine.newNumeric( 600 ) );
t.assign( engine.newNumeric( 4 ), engine.newNumeric( 700 ) );
}
Executing this code produces the following output.
table([])
table([(1)=100,(2)=200,(3)=300,(4)=400])
table([(1)=100,(2)=200,(3)=600,(4)=700])
See Also
ExternalCalling/Java/MapleException
OpenMaple
OpenMaple/Java/Algebraic
OpenMaple/Java/API
OpenMaple/Java/Table
OpenMaple/Java/Table/has
OpenMaple/Java/Table/remove
OpenMaple/Java/Table/select
Download Help Document