blob: f842fcc873ac88f725af19dc6e4777dc99e5d4f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "sortresult.h"
#include <QDebug>
SortResultNode::SortResultNode()
{
m_ascending = true;
}
void SortResultNode::run(ExecutionNode* node)
{
if(NULL==node)
{
return;
}
QList<Die> diceList=node->getResult()->getResultList();
QList<Die> 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;
}
|