From 4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 4 Jan 2014 16:24:54 +0100 Subject: -Adding range, booleancondition and countexecutenode. --- node/sortresult.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 node/sortresult.cpp (limited to 'node/sortresult.cpp') 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 + +SortResultNode::SortResultNode() +{ + m_ascending = true; +} +void SortResultNode::run(ExecutionNode* node) +{ + if(NULL==node) + { + return; + } + QList diceList=node->getResult()->getResultList(); + QList diceList2=m_result.getResultList(); + + diceList2 = diceList; + if(!m_ascending) + { + qSort(diceList2.begin(), diceList2.end(), qGreater()); + } + else + { + qSort(diceList2.begin(), diceList2.end(), qLess()); + } + m_result.setResultList(diceList2); + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } + +} +void SortResultNode::setSortAscending(bool asc) +{ + m_ascending = asc; +} -- cgit v1.2.3-70-g09d2