aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/sortresult.cpp
blob: f4364fac01c427714bffaf2dc92fc23167acedd0 (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<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;
}