assign a value into an element of the expression sequence - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Expseq Class : OpenMaple/Java/Expseq/assign

Expseq.assign - assign a value into an element of the expression sequence

Calling Sequence

void assign( int i, Algebraic val ) throws MapleException

Parameters

i

-

index of the entry to assign

val

-

value to assign into the expression sequence

Description

• 

The assign function assigns the Algebraic object val into the element of the Expseq indexed by i.

• 

The assign function can only be called on an Expseq, which is not a unique representation. For more information, see unique.

• 

Valid values of i are 1..n where n is the length of the expression sequence.  The length can be obtained by calling length.

Examples

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

    public static void main( String notused[] ) throws MapleException

    {

    String mapleArgs[];

    Engine engine;

    Expseq e;

    mapleArgs = new String[1];

    mapleArgs[0] = "java";

    engine = new Engine( mapleArgs, new EngineCallBacksDefault(),

        null, null );

    e = (Expseq)engine.evaluate( "1,2,3:" );

    try

    {

        e.assign( 1, engine.newNumeric( 2.2 ) );

    }

    catch ( MapleException me )

    {

        System.out.println( me.getMessage() );

    }

    e = engine.newExpseq( 3 );

    e.assign( 1, engine.newNumeric( 1 ) );

    e.assign( 2, engine.newNumeric( 2 ) );

    e.assign( 3, engine.newNumeric( 3 ) );

    e = (Expseq)e.unique();

    System.out.println( e );

    }

}

Executing this code produces the following output.

Error, expression sequences from Maple cannot be modified in-place

[1, 2, 3]

See Also

ExternalCalling/Java/MapleException, OpenMaple, OpenMaple/Java/Algebraic, OpenMaple/Java/API, OpenMaple/Java/Expseq, OpenMaple/Java/Expseq/length, OpenMaple/Java/Expseq/select


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam