public class Length extends PostfixMathCommand implements UnaryOperatorI
len(5) -> 1 len([1,2,3]) -> 3 len([[1,2],[3,4],[5,6]]) -> 6
curNumberOfParameters, numberOfParameters| Constructor and Description |
|---|
Length() |
| Modifier and Type | Method and Description |
|---|---|
Dimensions |
calcDim(Dimensions ldim)
Find the dimensions of this operator when applied to arguments with given dimensions.
|
MatrixValueI |
calcValue(MatrixValueI res,
MatrixValueI lhs)
Calculates the value of this operator for given input with results stored in res.
|
void |
run(Stack aStack)
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)
UnaryOperatorIcalcDim in interface UnaryOperatorIpublic MatrixValueI calcValue(MatrixValueI res, MatrixValueI lhs) throws ParseException
UnaryOperatorIcalcValue in interface UnaryOperatorIParseExceptionpublic void run(Stack aStack) throws ParseException
PostfixMathCommandrun in interface PostfixMathCommandIrun in class PostfixMathCommandParseExceptionCopyright © 2018. All rights reserved.