diff options
| author | 2014-01-04 16:24:54 +0100 | |
|---|---|---|
| committer | 2014-01-04 16:24:54 +0100 | |
| commit | 4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6 (patch) | |
| tree | d0553a394e50d1de1a5185a7006fe3cb66cbfa3b /node/sortresult.cpp | |
| parent | 4114232457cbc5739872f479ef5d7772e6b5f42f (diff) | |
| download | OneRoll-4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6.tar.gz OneRoll-4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6.zip | |
-Adding range, booleancondition and countexecutenode.
Diffstat (limited to 'node/sortresult.cpp')
| -rw-r--r-- | node/sortresult.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/node/sortresult.cpp b/node/sortresult.cpp new file mode 100644 index 0000000..f4364fa --- /dev/null +++ b/node/sortresult.cpp @@ -0,0 +1,37 @@ +#include "sortresult.h" + +#include <QDebug> + +SortResultNode::SortResultNode() +{ + m_ascending = true; +} +void SortResultNode::run(ExecutionNode* node) +{ + if(NULL==node) + { + return; + } + QList<qint64> diceList=node->getResult()->getResultList(); + QList<qint64> diceList2=m_result.getResultList(); + + diceList2 = diceList; + if(!m_ascending) + { + qSort(diceList2.begin(), diceList2.end(), qGreater<int>()); + } + else + { + qSort(diceList2.begin(), diceList2.end(), qLess<int>()); + } + m_result.setResultList(diceList2); + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } + +} +void SortResultNode::setSortAscending(bool asc) +{ + m_ascending = asc; +} |