mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
Add the isCommutative method to expression.
Change-Id: I657df96c5e24168ecd04470252549ed84eb2cfe3
This commit is contained in:
@@ -11,6 +11,7 @@ class CommutativeOperation : public Expression {
|
||||
int numberOfOperands() override;
|
||||
float approximate(Context& context) override;
|
||||
ExpressionLayout * createLayout() override;
|
||||
bool isCommutative() override;
|
||||
protected:
|
||||
virtual float operateApproximatevelyOn(float a, float b) = 0;
|
||||
virtual char operatorChar() = 0;
|
||||
|
||||
@@ -40,6 +40,7 @@ class Expression {
|
||||
Expression * simplify();
|
||||
|
||||
virtual Type type() = 0;
|
||||
virtual bool isCommutative();
|
||||
|
||||
virtual float approximate(Context& context) = 0;
|
||||
};
|
||||
|
||||
@@ -57,3 +57,8 @@ ExpressionLayout * CommutativeOperation::createLayout() {
|
||||
}
|
||||
return new HorizontalLayout(children_layouts, number_of_children);
|
||||
}
|
||||
|
||||
bool CommutativeOperation::isCommutative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,3 +63,7 @@ bool Expression::valueEquals(Expression * e) {
|
||||
* -riden. */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Expression::isCommutative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user