org.matheclipse.core.eval.exception
Class Validate
- java.lang.Object
-
- org.matheclipse.core.eval.exception.Validate
-
public final class Validate extends java.lang.ObjectStatic methods to be called at the start of the built-inIFunctionEvaluator#evaluate()methods to verify correct arguments and state.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static ISymbolcheckAssignedVariable(IExpr expr)Check if the argument is a symbol and has an assigned value.static IASTcheckASTType(IAST ast, int position)Check if the argument at the given position is an AST.static IASTcheckASTType(IExpr expr)Check if the expression is an AST.static IASTcheckASTUpRuleType(IExpr expr)Check if the argument at the given position is an AST.static IASTcheckEven(IAST ast)Ifast.size()-1is not even throw aWrongNumberOfArgumentsexception.static IIntegercheckIntegerType(IAST ast, int position)Check if the argument at the given position is a integer.static intcheckIntType(IAST ast, int pos)Check the argument, if it's a Javaintvalue in the range [0, Integer.MAX_VALUE]static intcheckIntType(IAST ast, int pos, int startValue)Check the argument, if it's a Javaintvalue in the range [startValue, Integer.MAX_VALUE]static intcheckIntType(IExpr expr)static intcheckIntType(IExpr expr, int startValue)Check the expression, if it's a Javaintvalue in the range [startValue, Integer.MAX_VALUE]static IASTcheckOdd(IAST ast)Ifast.size()-1is not odd throw aWrongNumberOfArgumentsexception.static intcheckPowerExponent(IAST ast)Get the exponentintvalue of theastexpressions, which is identified as aPower[<something>, exponent]expression.static IASTcheckRange(IAST ast, int from)Ifast.size() < fromthrow aWrongNumberOfArgumentsexception.static IASTcheckRange(IAST ast, int from, int to)Ifast.size() < from || ast.size() > tothrow aWrongNumberOfArgumentsexception.static IASTcheckSize(IAST ast, int size)Ifast.size() != sizethrow aWrongNumberOfArgumentsexception.static IStringXcheckStringType(IAST ast, int position)Check if the argument at the given position is aIStringXstring object.static IASTcheckSymbolList(IAST ast, int position)Check if the argument at the given position is a single symbol or a list of symbols.static IASTcheckSymbolOrSymbolList(IAST ast, int position)Check if the argument at the given position is a single symbol or a list of symbols.static ISymbolcheckSymbolType(IAST ast, int position)Check if the argument at the given position is a symbol.
-
-
-
Method Detail
-
checkIntType
public static int checkIntType(IAST ast, int pos)
Check the argument, if it's a Javaintvalue in the range [0, Integer.MAX_VALUE]- Throws:
WrongArgumentType
-
checkPowerExponent
public static int checkPowerExponent(IAST ast)
Get the exponentintvalue of theastexpressions, which is identified as aPower[<something>, exponent]expression. Theintvalue can be determined from an IInteger or INum expression.- Parameters:
ast-- Returns:
- the exponent
intvalue of thePower[<something>, exponent]expression. - Throws:
WrongArgumentType
-
checkIntType
public static int checkIntType(IAST ast, int pos, int startValue)
Check the argument, if it's a Javaintvalue in the range [startValue, Integer.MAX_VALUE]- Throws:
WrongArgumentType
-
checkIntType
public static int checkIntType(IExpr expr)
-
checkIntType
public static int checkIntType(IExpr expr, int startValue)
Check the expression, if it's a Javaintvalue in the range [startValue, Integer.MAX_VALUE]- Throws:
WrongArgumentType
-
checkIntegerType
public static IInteger checkIntegerType(IAST ast, int position)
Check if the argument at the given position is a integer.- Parameters:
position- the position which has to be a symbol.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkRange
public static IAST checkRange(IAST ast, int from)
Ifast.size() < fromthrow aWrongNumberOfArgumentsexception.- Throws:
WrongNumberOfArguments- ifsizeis not in the rangefromtoInteger.MAX_VALUE
-
checkRange
public static IAST checkRange(IAST ast, int from, int to)
Ifast.size() < from || ast.size() > tothrow aWrongNumberOfArgumentsexception.- Throws:
WrongNumberOfArguments- ifsizeis not in the rangefromtoto
-
checkSize
public static IAST checkSize(IAST ast, int size)
Ifast.size() != sizethrow aWrongNumberOfArgumentsexception.- Throws:
WrongNumberOfArguments- ifsizeunequals the list size
-
checkEven
public static IAST checkEven(IAST ast)
Ifast.size()-1is not even throw aWrongNumberOfArgumentsexception.- Throws:
WrongNumberOfArguments- ifast.size()-1is not even
-
checkOdd
public static IAST checkOdd(IAST ast)
Ifast.size()-1is not odd throw aWrongNumberOfArgumentsexception.- Throws:
WrongNumberOfArguments- ifast.size()-1is not odd
-
checkStringType
public static IStringX checkStringType(IAST ast, int position)
Check if the argument at the given position is aIStringXstring object.- Parameters:
position- the position which has to be a string.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkSymbolOrSymbolList
public static IAST checkSymbolOrSymbolList(IAST ast, int position)
Check if the argument at the given position is a single symbol or a list of symbols.- Parameters:
position- the position which has to be a symbol or list.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkSymbolList
public static IAST checkSymbolList(IAST ast, int position)
Check if the argument at the given position is a single symbol or a list of symbols.- Parameters:
position- the position which has to be a symbol or list.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkAssignedVariable
public static ISymbol checkAssignedVariable(IExpr expr)
Check if the argument is a symbol and has an assigned value.- Parameters:
expr- the expr which has to be a symbol.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkSymbolType
public static ISymbol checkSymbolType(IAST ast, int position)
Check if the argument at the given position is a symbol.- Parameters:
position- the position which has to be a symbol.- Throws:
WrongArgumentType- if it's not a symbol.
-
checkASTUpRuleType
public static IAST checkASTUpRuleType(IExpr expr)
Check if the argument at the given position is an AST.- Parameters:
position- the position which has to be an AST.- Throws:
WrongArgumentType- if it's not an AST.
-
checkASTType
public static IAST checkASTType(IAST ast, int position)
Check if the argument at the given position is an AST.- Parameters:
position- the position which has to be an AST.- Throws:
WrongArgumentType- if it's not an AST.
-
checkASTType
public static IAST checkASTType(IExpr expr)
Check if the expression is an AST.- Throws:
WrongArgumentType- if it's not an AST.
-
-
DMelt 3.0 © DataMelt by jWork.ORG