public final class Validate
extends java.lang.Object
IFunctionEvaluator#evaluate()
methods to verify correct
arguments and state.Modifier and Type | Method and Description |
---|---|
static ISymbol |
checkAssignedVariable(IExpr expr)
Check if the argument is a symbol and has an assigned value.
|
static IAST |
checkASTType(IAST ast,
int position)
Check if the argument at the given position is an AST.
|
static IAST |
checkASTType(IExpr expr)
Check if the expression is an AST.
|
static IAST |
checkASTUpRuleType(IExpr expr)
Check if the argument at the given position is an AST.
|
static java.lang.String |
checkContextName(IAST ast,
int position)
Check if the argument at the given position is a
IStringX
string object. |
static IExpr |
checkEquation(IExpr expr)
Check if the given expression is an equation (i.e.
|
static IAST |
checkEquations(IAST ast,
int position)
Check if the argument at the given
ast position is an
equation (i.e. |
static IAST |
checkEven(IAST ast)
If
ast.size()-1 is not even throw a
WrongNumberOfArguments exception. |
static IInteger |
checkIntegerType(IAST ast,
int position)
Check if the argument at the given position is a integer.
|
static int |
checkIntType(IAST ast,
int pos)
Check the argument, if it's a Java
int value in the range [0,
Integer.MAX_VALUE] |
static int |
checkIntType(IAST ast,
int pos,
int startValue)
Check the argument, if it's a Java
int value in the range [
startValue , Integer.MAX_VALUE] |
static int |
checkIntType(IExpr expr)
Check the expression, if it's a Java
int value in the range [0 ,
Integer.MAX_VALUE] |
static int |
checkIntType(IExpr expr,
int startValue)
Check the expression, if it's a Java
int value in the range [
startValue , Integer.MAX_VALUE] |
static long |
checkLongPowerExponent(IAST ast)
Get the exponent
long value of the ast
expressions, which is identified as a
Power[<something>, exponent] expression. |
static long |
checkLongType(IExpr expr)
Check the argument, if it's a Java
long value in the range [0,
Long.MAX_VALUE] |
static IAST |
checkOdd(IAST ast)
If
ast.size()-1 is not odd throw a WrongNumberOfArguments
exception. |
static int |
checkPowerExponent(IAST ast)
Get the exponent
int value of the ast
expressions, which is identified as a
Power[<something>, exponent] expression. |
static IAST |
checkRange(IAST ast,
int from)
If
ast.size() < from throw a WrongNumberOfArguments
exception. |
static IAST |
checkRange(IAST ast,
int from,
int to)
If
ast.size() < from || ast.size() > to throw a
WrongNumberOfArguments exception. |
static IAST |
checkSize(IAST ast,
int size)
If {@code ast.size() !
|
static IStringX |
checkStringType(IAST ast,
int position)
Check if the argument at the given position is a
IStringX
string object. |
static IAST |
checkSymbolOrSymbolList(IAST ast,
int position)
Check if the argument at the given position is a single symbol or a list
of symbols.
|
static ISymbol |
checkSymbolType(IAST ast,
int position)
Check if the argument at the given position is a symbol.
|
public static int checkIntType(IAST ast, int pos)
int
value in the range [0,
Integer.MAX_VALUE]WrongArgumentType
public static int checkPowerExponent(IAST ast)
int
value of the ast
expressions, which is identified as a
Power[<something>, exponent]
expression. The
int
value can be determined from an IInteger or INum
expression.ast
- int
value of the
Power[<something>, exponent]
expression.WrongArgumentType
public static long checkLongPowerExponent(IAST ast)
long
value of the ast
expressions, which is identified as a
Power[<something>, exponent]
expression. The
long
value can be determined from an IInteger or INum
expression.ast
- long
value of the
Power[<something>, exponent]
expression.WrongArgumentType
public static long checkLongType(IExpr expr)
long
value in the range [0,
Long.MAX_VALUE]WrongArgumentType
public static int checkIntType(IAST ast, int pos, int startValue)
int
value in the range [
startValue
, Integer.MAX_VALUE]WrongArgumentType
public static int checkIntType(IExpr expr)
int
value in the range [0 ,
Integer.MAX_VALUE]WrongArgumentType
public static int checkIntType(IExpr expr, int startValue)
int
value in the range [
startValue
, Integer.MAX_VALUE]expr
- a signed number which will be converted to a Java
int
if possible, otherwise throw a
WrongArgumentType
exception.WrongArgumentType
public static IInteger checkIntegerType(IAST ast, int position)
position
- the position which has to be a symbol.WrongArgumentType
- if it's not a symbol.public static IAST checkRange(IAST ast, int from)
ast.size() < from
throw a WrongNumberOfArguments
exception.WrongNumberOfArguments
- if size
is not in the range from
to
Integer.MAX_VALUE
public static IAST checkRange(IAST ast, int from, int to)
ast.size() < from || ast.size() > to
throw a
WrongNumberOfArguments
exception.WrongNumberOfArguments
- if size
is not in the range from
to
to
public static IAST checkSize(IAST ast, int size)
ast.size() != size
throw a WrongNumberOfArguments
exception.WrongNumberOfArguments
- if size
unequals the list sizepublic static IAST checkEven(IAST ast)
ast.size()-1
is not even throw a
WrongNumberOfArguments
exception.WrongNumberOfArguments
- if ast.size()-1
is not evenpublic static IAST checkOdd(IAST ast)
ast.size()-1
is not odd throw a WrongNumberOfArguments
exception.WrongNumberOfArguments
- if ast.size()-1
is not oddpublic static IStringX checkStringType(IAST ast, int position)
IStringX
string object.position
- the position which has to be a string.WrongArgumentType
- if it's not a symbol.public static java.lang.String checkContextName(IAST ast, int position)
IStringX
string object.position
- the position which has to be a string.WrongArgumentType
- if it's not a symbol.public static IAST checkSymbolOrSymbolList(IAST ast, int position)
position
- the position which has to be a symbol or list.ast.get(position)
.WrongArgumentType
- if it's not a symbol.public static ISymbol checkAssignedVariable(IExpr expr)
expr
- the expr which has to be a symbol.expr
if it's a SymbolWrongArgumentType
- if it's not a symbol.public static ISymbol checkSymbolType(IAST ast, int position)
position
- the position which has to be a symbol.WrongArgumentType
- if it's not a symbol.public static IAST checkASTUpRuleType(IExpr expr)
position
- the position which has to be an AST.WrongArgumentType
- if it's not an AST.public static IAST checkASTType(IAST ast, int position)
position
- the position which has to be an AST.WrongArgumentType
- if it's not an AST.public static IAST checkASTType(IExpr expr)
WrongArgumentType
- if it's not an AST.public static IAST checkEquations(IAST ast, int position)
ast
position is an
equation (i.e. Equal(a,b)
) or a list of equations or a
boolean And()
expression of equations and return a list of
expanded expressions, which should be equal to 0
.ast
- position
- the position of the equations argument in the ast
expression.