mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[poincare] Fix convention on compareTo
Change-Id: Ia1a7f2f23b93bec6a856da04baf109dfe8f49980
This commit is contained in:
@@ -116,6 +116,10 @@ public:
|
||||
/* Sorting */
|
||||
virtual bool isCommutative() const { return false; }
|
||||
virtual void sort();
|
||||
/* compareTo returns:
|
||||
* 1 if this > e
|
||||
* -1 if this < e
|
||||
* 0 if this == e */
|
||||
virtual int compareTo(const Expression * e) const;
|
||||
|
||||
/* Layout Engine */
|
||||
|
||||
@@ -97,12 +97,12 @@ void Expression::sort() {
|
||||
}
|
||||
|
||||
int Expression::compareTo(const Expression * e) const {
|
||||
if (e->type() > this->type()) {
|
||||
return 1;
|
||||
}
|
||||
if (e->type() < this->type()) {
|
||||
if (this->type() < e->type()) {
|
||||
return -1;
|
||||
}
|
||||
if (this->type() > e->type()) {
|
||||
return 1;
|
||||
}
|
||||
for (int i = 0; i < this->numberOfOperands(); i++) {
|
||||
// The NULL node is the least node type.
|
||||
if (e->numberOfOperands() <= i) {
|
||||
|
||||
Reference in New Issue
Block a user