Skip to content

Commit

Permalink
can analyze reachability for a task chain
Browse files Browse the repository at this point in the history
  • Loading branch information
vovatrykoz committed Nov 13, 2024
1 parent b947f7d commit b2c1590
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ struct TaskInstance {
};

struct TaskInstancePair {
TaskInstance currentInstance;
TaskInstance instance;
TaskInstance nextInstance;

TaskInstancePair(const TaskInstance& currentInstance,
const TaskInstance& nextInstance)
: currentInstance(currentInstance), nextInstance(nextInstance) {}
: instance(currentInstance), nextInstance(nextInstance) {}
};

#endif
12 changes: 8 additions & 4 deletions source/MathFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,20 @@ bool MathFramework::reach(const TaskInstance& currentWriterTaskInstance,
}

bool MathFramework::pathReach(const std::vector<TaskInstancePair>& timedPath) {
if(timedPath.empty()) {
if (timedPath.empty()) {
return false;
}

if(timedPath.size() == 1) {
if (timedPath.size() == 1) {
return true;
}

for(int i = 0; i < timedPath.size() - 2; i++) {

for (int i = 0; i < timedPath.size() - 2; i++) {
if (!reach(timedPath[i].instance,
timedPath[i + 1].instance,
timedPath[i].nextInstance)) {
return false;
}
}

return true;
Expand Down

0 comments on commit b2c1590

Please sign in to comment.