mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[poincare] Change name and API of containType
Change-Id: I57617c13a810400a13de774b0abc23db9adf9d15
This commit is contained in:
@@ -148,7 +148,8 @@ public:
|
||||
/* Simplification */
|
||||
static void simplify(Expression ** expressionAddress, Context & context, AngleUnit angleUnit = AngleUnit::Default);
|
||||
|
||||
bool containType(Type type) const;
|
||||
typedef bool (*ExpressionTest)(const Expression * e);
|
||||
bool recursivelyMatches(ExpressionTest test) const;
|
||||
|
||||
/* Evaluation Engine
|
||||
* The function evaluate creates a new expression and thus mallocs memory.
|
||||
|
||||
@@ -95,12 +95,12 @@ Expression * Expression::deepBeautify(Context & context, AngleUnit angleUnit) {
|
||||
return e;
|
||||
}
|
||||
|
||||
bool Expression::containType(Type t) const {
|
||||
if (type() == t) {
|
||||
bool Expression::recursivelyMatches(ExpressionTest test) const {
|
||||
if (test(this)) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < numberOfOperands(); i++) {
|
||||
if (operand(i)->containType(t)) {
|
||||
if (test(operand(i))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user