3 * File: DecomposeOrderResolver.cc
6 * Created on September 1, 2017, 10:36 AM
9 #include "decomposeorderresolver.h"
11 #include "ordernode.h"
12 #include "ordergraph.h"
14 DecomposeOrderResolver::DecomposeOrderResolver(OrderGraph *_graph, Vector<Order *> &_orders) :
16 orders(_orders.getSize(), _orders.expose())
20 DecomposeOrderResolver::~DecomposeOrderResolver() {
23 bool DecomposeOrderResolver::resolveOrder(uint64_t first, uint64_t second) {
24 OrderNode *from = graph->lookupOrderNodeFromOrderGraph(first);
26 OrderNode *to = graph->lookupOrderNodeFromOrderGraph(second);
29 if (from->sccNum != to->sccNum) {
30 OrderEdge *edge = graph->lookupOrderEdgeFromOrderGraph(from, to);
31 if (edge != NULL && edge->mustPos) {
33 } else if ( edge != NULL && edge->mustNeg) {
36 switch (graph->getOrder()->type) {
38 return from->sccNum < to->sccNum;
40 return resolvePartialOrder(from, to);
46 Order *suborder = NULL;
47 // We should ask this query from the suborder ....
48 suborder = orders.get(from->sccNum);
49 ASSERT(suborder != NULL);
50 return suborder->encoding.resolver->resolveOrder(from->id, to->id);
54 bool DecomposeOrderResolver::resolvePartialOrder(OrderNode* first, OrderNode* second){
55 if(first->sccNum > second->sccNum){
58 return graph->isTherePath(first, second);