aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/parenthesesnode.cpp18
-rw-r--r--node/sortresult.cpp23
2 files changed, 34 insertions, 7 deletions
diff --git a/node/parenthesesnode.cpp b/node/parenthesesnode.cpp
index 5e2d0e0..9e6bcec 100644
--- a/node/parenthesesnode.cpp
+++ b/node/parenthesesnode.cpp
@@ -30,18 +30,28 @@ void ParenthesesNode::setInternelNode(ExecutionNode* node)
{
m_internalNode = node;
}
-void ParenthesesNode::run(ExecutionNode* /*previous*/)
+void ParenthesesNode::run(ExecutionNode* previous)
{
- //m_previousNode = previous;
+ m_previousNode = previous;
if(nullptr!=m_internalNode)
{
- m_internalNode->run(this);
- ExecutionNode* temp=m_internalNode;
+ m_internalNode->run(this);
+ ExecutionNode* temp=m_internalNode;
while(nullptr!=temp->getNextNode())
{
temp=temp->getNextNode();
}
m_result = temp->getResult();
+ //m_result->setPrevious(internalResult);
+ if(nullptr!=previous)
+ {
+ auto previousResult = previous->getResult();
+ if(nullptr!=m_internalNode->getResult())
+ {
+ m_internalNode->getResult()->setPrevious(previousResult);
+ }
+ }
+ //m_result = temp->getResult();
}
if(nullptr!=m_nextNode)
diff --git a/node/sortresult.cpp b/node/sortresult.cpp
index 5406eb6..76f517e 100644
--- a/node/sortresult.cpp
+++ b/node/sortresult.cpp
@@ -42,15 +42,32 @@ void SortResultNode::run(ExecutionNode* node)
m_diceResult->setPrevious(previousDiceResult);
if(nullptr!=previousDiceResult)
{
- QList<Die*> diceList=previousDiceResult->getResultList();
+ auto const& diceList=previousDiceResult->getResultList();
QList<Die*> diceList2=m_diceResult->getResultList();
+ /* const auto& asce = [](const Die* a,const Die* b){
+ return a->getValue() < b->getValue();
+ };
+ const auto& desc = [](const Die* a,const Die* b){
+ return a->getValue() > b->getValue();
+ };
+
+ for(auto const dice : diceList)
+ {
+ Die* tmp1 = new Die(*dice);
+ diceList2.append(tmp1);
+ }
+ if(m_ascending)
+ std::sort(diceList2.begin(), diceList2.end(), asce);
+ else
+ std::sort(diceList2.begin(), diceList2.end(), desc);*/
+
// half-interval search sorting
for(int i = 0; i<diceList.size();++i)
{
- Die* tmp1 = new Die();
- *tmp1=*diceList[i];
+ Die* tmp1 = new Die(*diceList[i]);
+ //*tmp1=*diceList[i];
diceList[i]->displayed();
int j =0;