Class ArithmeticExpression
java.lang.Object
com.inductiveautomation.ignition.common.expressions.AbstractExpression
com.inductiveautomation.ignition.common.expressions.ArithmeticExpression
- All Implemented Interfaces:
Expression
An expression implementation that performs arithmetic operations (addition, subtraction,
multiplication, division, power, and modulo) between two sub-expressions.
This class also handles string concatenation if the operation type is addition and one of the operands is a string.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDetermines how the operation should behave when strings are involved. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class com.inductiveautomation.ignition.common.expressions.AbstractExpression
children, context, updateListener -
Constructor Summary
ConstructorsConstructorDescriptionArithmeticExpression(Expression e1, Expression e2, int opType) ArithmeticExpression(Expression e1, Expression e2, int opType, boolean forceNumeric) ArithmeticExpression(Expression e1, Expression e2, int opType, ArithmeticExpression.StringTypeAffinity affinity) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleaneitherString(QualifiedValue v1, QualifiedValue v2) @NonNull QualifiedValueexecute()Compute and return the value of this expression.Return a human-readable name for the operation that this expression performs.intClass<?>getType()Return the type that this expression will return.booleanisConcat()voidsetConcat(boolean isConcat) voidsetOpType(int i) Methods inherited from class com.inductiveautomation.ignition.common.expressions.AbstractExpression
connect, disconnect, getChildren, setChildren, shutdown, startup
-
Field Details
-
PLUS
public static final int PLUS- See Also:
-
MINUS
public static final int MINUS- See Also:
-
MULT
public static final int MULT- See Also:
-
DIVIDE
public static final int DIVIDE- See Also:
-
MOD
public static final int MOD- See Also:
-
POW
public static final int POW- See Also:
-
-
Constructor Details
-
ArithmeticExpression
-
ArithmeticExpression
-
ArithmeticExpression
public ArithmeticExpression(Expression e1, Expression e2, int opType, ArithmeticExpression.StringTypeAffinity affinity) -
ArithmeticExpression
public ArithmeticExpression()
-
-
Method Details
-
eitherString
-
execute
Description copied from interface:ExpressionCompute and return the value of this expression.- Returns:
- the result of the expression evaluation as a
QualifiedValue - Throws:
ExpressionException- if an error occurs during execution
-
getType
Description copied from interface:ExpressionReturn the type that this expression will return.- Returns:
- the
Classof the value returned byExpression.execute()
-
getOpName
Description copied from interface:ExpressionReturn a human-readable name for the operation that this expression performs.- Returns:
- the operation name
-
getOpType
public int getOpType() -
setOpType
public void setOpType(int i) -
isConcat
public boolean isConcat() -
setConcat
public void setConcat(boolean isConcat)
-