Table.get - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Table Class : OpenMaple/Java/Table/get

Table.get

access the element associated with a key

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Algebraic get( Algebraic key )

Parameters

key

-

index of the element to access

Description

• 

The get function returns the Algebraic object associated with key in the Table. If no element is associated with key, the value null is returned.

• 

The get function is identical to select except that the latter does not throw a MapleException.

Examples

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 = (Table)engine.evaluate( "table([(1)=100,(2)=200,(3)=300,(4)=400]):" );

        System.out.println( t.get( engine.newNumeric( 1 ) ) );

        System.out.println( t.get( engine.newNumeric( 2 ) ) );

        System.out.println( t.get( engine.newNumeric( 3 ) ) );

        System.out.println( t.get( engine.newNumeric( 5 ) ) );

    }

}

Executing this code produces the following output.

100

200

300

null

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Table

OpenMaple/Java/Table/assign

OpenMaple/Java/Table/clear

OpenMaple/Java/Table/has

OpenMaple/Java/Table/keySet

OpenMaple/Java/Table/remove

OpenMaple/Java/Table/unassign

OpenMaple/Java/Table/values