Merge lp:~verifypn-cpn/verifypn/eq-push-fix-trunk into lp:verifypn

Proposed by Peter Gjøl Jensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 219
Merged at revision: 219
Proposed branch: lp:~verifypn-cpn/verifypn/eq-push-fix-trunk
Merge into: lp:verifypn
Diff against target: 30 lines (+8/-10)
1 file modified
PetriEngine/PQL/Expressions.cpp (+8/-10)
To merge this branch: bzr merge lp:~verifypn-cpn/verifypn/eq-push-fix-trunk
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+366401@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Tested and fixes the bug

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'PetriEngine/PQL/Expressions.cpp'
--- PetriEngine/PQL/Expressions.cpp 2018-08-25 19:48:34 +0000
+++ PetriEngine/PQL/Expressions.cpp 2019-04-23 13:42:17 +0000
@@ -3489,18 +3489,16 @@
3489 Condition_ptr pushEqual(CompareCondition* org, bool negated, bool noteq, const EvaluationContext& context)3489 Condition_ptr pushEqual(CompareCondition* org, bool negated, bool noteq, const EvaluationContext& context)
3490 {3490 {
3491 if(org->isTrivial()) return BooleanCondition::getShared(org->evaluate(context) xor negated);3491 if(org->isTrivial()) return BooleanCondition::getShared(org->evaluate(context) xor negated);
3492 if((*org)[0]->placeFree() && (*org)[0]->evaluate(context) == 0)3492 for(auto i : {0,1})
3493 {3493 {
3494 if(negated == noteq) return std::make_shared<LessThanOrEqualCondition>((*org)[1], std::make_shared<LiteralExpr>(0));3494 if((*org)[i]->placeFree() && (*org)[i]->evaluate(context) == 0)
3495 else return std::make_shared<GreaterThanOrEqualCondition>((*org)[1], std::make_shared<LiteralExpr>(1));3495 {
3496 }3496 if(negated == noteq) return std::make_shared<LessThanOrEqualCondition>((*org)[(i + 1) % 2], std::make_shared<LiteralExpr>(0));
3497 if((*org)[1]->placeFree() && (*org)[1]->evaluate(context) == 0)3497 else return std::make_shared<GreaterThanOrEqualCondition>((*org)[(i + 1) % 2], std::make_shared<LiteralExpr>(1));
3498 {3498 }
3499 if(negated == noteq) return std::make_shared<LessThanOrEqualCondition>((*org)[1], std::make_shared<LiteralExpr>(0));
3500 else return std::make_shared<GreaterThanOrEqualCondition>((*org)[1], std::make_shared<LiteralExpr>(1));
3501 }3499 }
3502 if(negated == noteq) return std::make_shared<EqualCondition>((*org)[0], (*org)[1]);3500 if(negated == noteq) return std::make_shared<EqualCondition>((*org)[0], (*org)[1]);
3503 else return std::make_shared<NotEqualCondition>((*org)[0], (*org)[1]); 3501 else return std::make_shared<NotEqualCondition>((*org)[0], (*org)[1]);
3504 }3502 }
3505 3503
3506 Condition_ptr NotEqualCondition::pushNegation(negstat_t& stats, const EvaluationContext& context, bool nested, bool negated, bool initrw) {3504 Condition_ptr NotEqualCondition::pushNegation(negstat_t& stats, const EvaluationContext& context, bool nested, bool negated, bool initrw) {

Subscribers

People subscribed via source and target branches