public class FunctionCall extends Object implements Expression
| Constructor and Description |
|---|
FunctionCall() |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(Expression expression)
Adds the given expression as parameter
|
protected static void |
appendNameAndParameters(StringBuilder sb,
String name,
List<Expression> parameters)
Appends the name and parameters to the given string builder.
|
Expression |
eval(Scope scope,
Generator gen)
If possible the expression is evaluated and a simplified expression is returned.
|
Color |
getExpectedColorParam(int index)
Returns the parameter casted as a
Color at the expected index. |
float |
getExpectedFloatParam(int index)
Returns the parameter at the expected index converted to an float.
|
int |
getExpectedIntParam(int index)
Returns the parameter at the expected index converted to an int.
|
Expression |
getExpectedParam(int index)
Returns the parameter at the expected index.
|
String |
getName()
Returns the name of the function.
|
List<Expression> |
getParameters()
Returns all parameters of the function
|
boolean |
isConstant()
Determines if this expression is constant or if it depends on variables.
|
void |
setName(String name)
Sets the name of the function
|
String |
toString() |
public String getName()
protected static void appendNameAndParameters(StringBuilder sb, String name, List<Expression> parameters)
sb - the target to write the output toname - the name of the functionparameters - the list of parameterspublic void setName(String name)
name - the name of the functionpublic void addParameter(Expression expression)
expression - the parameter to addpublic List<Expression> getParameters()
public Expression getExpectedParam(int index)
index - the number of the parameter to accessIllegalArgumentException - if the index is out of boundspublic Color getExpectedColorParam(int index)
Color at the expected index.index - the number of the parameter to accessIllegalArgumentException - if the index is out of bounds or if the parameter isn't a colorpublic int getExpectedIntParam(int index)
index - the number of the parameter to accessIllegalArgumentException - if the index is out of bounds or not a valid integerpublic float getExpectedFloatParam(int index)
index - the number of the parameter to accessIllegalArgumentException - if the index is out of bounds or not a valid decimal numberpublic boolean isConstant()
ExpressionisConstant in interface Expressionpublic Expression eval(Scope scope, Generator gen)
Expressioneval in interface Expressionscope - the scope used to resolve variables.gen - the generator used to evaluate functionsCopyright © 2016. All rights reserved.