public class Ele extends PostfixMathCommand implements BinaryOperatorI
a = [1,2,3,4];
ele(a,1); // returns 1
m = [[1,2],[3,4]];
ele(m,[2,2]); // return 4
New parser feature allow a[] notation to be used.
a=[1,2,3,4];
a[3]; // returns 3
b=[[1,2],[3,4]];
b[1,2]; // returns 2
curNumberOfParameters, numberOfParameters| Constructor and Description |
|---|
Ele() |
| Modifier and Type | Method and Description |
|---|---|
Dimensions |
calcDim(Dimensions ldim,
Dimensions rdim)
Find the dimensions of this operator when applied to arguments with given dimensions.
|
MatrixValueI |
calcValue(MatrixValueI res,
MatrixValueI param1,
MatrixValueI param2)
Calculates the value of this operator for given input with results stored in res.
|
void |
run(Stack stack)
Throws an exception because this method should never be called under
normal circumstances.
|
checkNumberOfParameters, checkStack, getNumberOfParameters, setCurNumberOfParametersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckNumberOfParameters, getNumberOfParameters, setCurNumberOfParameterspublic Dimensions calcDim(Dimensions ldim, Dimensions rdim) throws ParseException
BinaryOperatorIcalcDim in interface BinaryOperatorIParseExceptionpublic MatrixValueI calcValue(MatrixValueI res, MatrixValueI param1, MatrixValueI param2) throws ParseException
BinaryOperatorIcalcValue in interface BinaryOperatorIParseExceptionpublic void run(Stack stack) throws ParseException
PostfixMathCommandrun in interface PostfixMathCommandIrun in class PostfixMathCommandParseExceptionCopyright © 2018. All rights reserved.