AssignmentExpression represents a variable assignment expression similar to a C++ or C# assignment. Assignments can be represented as a left-hand-side (lhs), right-hand-side (rhs) and an infix operator (op) as in (lhs op rhs). Operators supported are EQ, PLUSEQ, MINUSEQ, TIMESEQ, DIVIDEEQ Nested expressions and expressions with variables are supported. lhs must be a single variable name. More...
Public Types | |
enum | AssignmentType { EQ, PLUSEQ, MINUSEQ, TIMESEQ, DIVIDEEQ, NO_OP } |
Comparison type enum. More... | |
Public Member Functions | |
AssignmentExpression () | |
Default constructor. | |
AssignmentExpression (string variable, AssignmentType assignmentOperator, Expression expr2) | |
Constructor including variable, op, and rhs. | |
void | SetInvalid () |
Invalidate the AssignmentExpression. | |
void | RenameVariable (string originalName, string newName) |
Rename a variable in all nested expressions. | |
void | SetExpression (string variable, AssignmentType assignmentOperator, Expression expr2) |
Reset the AssignmentExpression with a new variable, operator, and lhs. | |
void | Evaluate (float deltaTime, ActionContext actionContext) |
Evaluate will assign the variable to a new value based on evaluating the rhs expression. The result will be stored in the ActionContext. | |
void | Evaluate (float deltaTime, float minValue, float maxValue, ActionContext fromContext, ActionContext toContext) |
Evaluate will assign the variable to a new value based on evaluating the rhs expression. The fromContext will be used for calculating the new value. The result will be stored in the toContext. | |
override string | ToString () |
ToString() will return a string representation of the AssignmentExpression which may differ from the original text parsed to create this expression. | |
Properties | |
string | AssignedVariable [get] |
bool | IsValid [get] |
Is the expression valid and can it be evaluated successfully? Checks to ensure that the AssignemntExpression is formed of valid variable and rhs expressions, and that the assignment operator is not a no-op. | |
string | ExpressionAsEntered [get, set] |
ExpressionAsEntered returns the text used to initially describe the ConditionalExpression, if the expression was created from parsing a script or manual entry. This is useful when supporting user editing of invalid expressions. |
AssignmentExpression represents a variable assignment expression similar to a C++ or C# assignment. Assignments can be represented as a left-hand-side (lhs), right-hand-side (rhs) and an infix operator (op) as in (lhs op rhs). Operators supported are EQ, PLUSEQ, MINUSEQ, TIMESEQ, DIVIDEEQ Nested expressions and expressions with variables are supported. lhs must be a single variable name.
Comparison type enum.
RAIN.Belief.AssignmentExpression.AssignmentExpression | ( | ) |
Default constructor.
RAIN.Belief.AssignmentExpression.AssignmentExpression | ( | string | variable, |
AssignmentType | assignmentOperator, | ||
Expression | expr2 | ||
) |
Constructor including variable, op, and rhs.
variable | The variable to assign |
assignmentOperator | The assignment operator |
expr2 | The right-hand-side expression |
void RAIN.Belief.AssignmentExpression.Evaluate | ( | float | deltaTime, |
ActionContext | actionContext | ||
) |
Evaluate will assign the variable to a new value based on evaluating the rhs expression. The result will be stored in the ActionContext.
deltaTime | timestep to use when evaluating. this wlil replace the variable "t" in all expressions |
void RAIN.Belief.AssignmentExpression.Evaluate | ( | float | deltaTime, |
float | minValue, | ||
float | maxValue, | ||
ActionContext | fromContext, | ||
ActionContext | toContext | ||
) |
Evaluate will assign the variable to a new value based on evaluating the rhs expression. The fromContext will be used for calculating the new value. The result will be stored in the toContext.
minValue | a minimum value for the result |
maxValue | a maximum value for the result |
deltaTime | timestep to use when evaluating. this wlil replace the variable "t" in all expressions |
fromContext | Context to use when evaluating |
toContext | Context to store the result |
void RAIN.Belief.AssignmentExpression.RenameVariable | ( | string | originalName, |
string | newName | ||
) |
Rename a variable in all nested expressions.
originalName | The name of the variable to rename |
newName | The new name to replace the original variable name |
void RAIN.Belief.AssignmentExpression.SetExpression | ( | string | variable, |
AssignmentType | assignmentOperator, | ||
Expression | expr2 | ||
) |
Reset the AssignmentExpression with a new variable, operator, and lhs.
variable | The variable to assign |
assignmentOperator | The assignment operator |
expr2 | The right-hand-side expression |
void RAIN.Belief.AssignmentExpression.SetInvalid | ( | ) |
Invalidate the AssignmentExpression.
override string RAIN.Belief.AssignmentExpression.ToString | ( | ) |
ToString() will return a string representation of the AssignmentExpression which may differ from the original text parsed to create this expression.
string RAIN.Belief.AssignmentExpression.ExpressionAsEntered [get, set] |
ExpressionAsEntered returns the text used to initially describe the ConditionalExpression, if the expression was created from parsing a script or manual entry. This is useful when supporting user editing of invalid expressions.
bool RAIN.Belief.AssignmentExpression.IsValid [get] |
Is the expression valid and can it be evaluated successfully? Checks to ensure that the AssignemntExpression is formed of valid variable and rhs expressions, and that the assignment operator is not a no-op.