Set.select
return an element stored within a set
Calling Sequence
Parameters
Description
Examples
Algebraic select( int i ) throws MapleException
i
-
index of the entry to return
The select function returns the Algebraic object stored in index i of the Set.
Valid values of i are 1..n where n is the size of the set. The size can be obtained by calling numElements.
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 );
int i;
Set s = (Set)engine.evaluate( "{seq( (2^(i)), i=1..10 )}:" );
for ( i = 1; i <= 10; i++ )
System.out.println( l.select(i) );
}
try
s.select(11);
catch ( MapleException me )
System.out.println( me.getMessage() );
s.select(0);
Executing this code produces the following output.
2
4
8
16
32
64
128
256
512
1024
Error, bad index, 11, into set
Error, bad index, 0, into set
See Also
ExternalCalling/Java/MapleException
OpenMaple
OpenMaple/Java/Algebraic
OpenMaple/Java/API
OpenMaple/Java/Set
OpenMaple/Java/Set/containsAll
OpenMaple/Java/Set/iterator
OpenMaple/Java/Set/toArray
Download Help Document