mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[poincare] In rulegen, do not sort children of non-commutative nodes!!
Change-Id: Ibe228f400e688a17aeff4721fe6e77ab4bca1373
This commit is contained in:
@@ -186,6 +186,9 @@ void Node::sort() {
|
||||
for (Node * child : *m_children) {
|
||||
child->sort();
|
||||
}
|
||||
if (!isCommutative()) {
|
||||
return;
|
||||
}
|
||||
for (int i = m_children->size()-1; i > 0; i--) {
|
||||
bool isSorted = true;
|
||||
for (int j = 0; j < m_children->size()-1; j++) {
|
||||
@@ -200,6 +203,13 @@ void Node::sort() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Node::isCommutative() {
|
||||
if (m_name->compare("Addition") == 0 || m_name->compare("Multiplication") == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
std::string Node::generateSelectorConstructor(Rule * context) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
private:
|
||||
int selectorCaptureIndexInRule(Rule * rule);
|
||||
int selectorIndexInRule(Rule * rule);
|
||||
|
||||
bool isCommutative();
|
||||
/*
|
||||
int generateTree(bool selector, Rule * context, int index, int indentationLevel);
|
||||
std::string generateSelectorConstructor(Rule * context);
|
||||
|
||||
Reference in New Issue
Block a user