Browse Source

improved the assignmentsFinder a little

tempestpy_adaptions
TimQu 6 years ago
parent
commit
c1f85b0fac
  1. 16
      src/storm/storage/jani/traverser/AssignmentsFinder.cpp

16
src/storm/storage/jani/traverser/AssignmentsFinder.cpp

@ -20,35 +20,45 @@ namespace storm {
void AssignmentsFinder::traverse(Location const& location, boost::any const& data) { void AssignmentsFinder::traverse(Location const& location, boost::any const& data) {
auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data); auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data);
if (!resVar.second->hasLocationAssignment) {
for (auto const& assignment : location.getAssignments()) { for (auto const& assignment : location.getAssignments()) {
storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable(); storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable();
if (assignedVariable.getExpressionVariable() == *resVar.first) { if (assignedVariable.getExpressionVariable() == *resVar.first) {
resVar.second->hasLocationAssignment = true; resVar.second->hasLocationAssignment = true;
break;
}
} }
} }
ConstJaniTraverser::traverse(location, data);
} }
void AssignmentsFinder::traverse(TemplateEdge const& templateEdge, boost::any const& data) { void AssignmentsFinder::traverse(TemplateEdge const& templateEdge, boost::any const& data) {
auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data); auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data);
if (!resVar.second->hasEdgeAssignment) {
for (auto const& assignment : templateEdge.getAssignments()) { for (auto const& assignment : templateEdge.getAssignments()) {
storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable(); storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable();
if (assignedVariable.getExpressionVariable() == *resVar.first) { if (assignedVariable.getExpressionVariable() == *resVar.first) {
resVar.second->hasEdgeAssignment = true; resVar.second->hasEdgeAssignment = true;
break;
}
} }
} }
ConstJaniTraverser::traverse(templateEdge, data);
for (auto const& dest : templateEdge.getDestinations()) {
traverse(dest, data);
}
} }
void AssignmentsFinder::traverse(TemplateEdgeDestination const& templateEdgeDestination, boost::any const& data) { void AssignmentsFinder::traverse(TemplateEdgeDestination const& templateEdgeDestination, boost::any const& data) {
auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data); auto resVar = boost::any_cast<std::pair<storm::expressions::Variable const*, ResultType*>>(data);
if (!resVar.second->hasEdgeDestinationAssignment) {
for (auto const& assignment : templateEdgeDestination.getOrderedAssignments()) { for (auto const& assignment : templateEdgeDestination.getOrderedAssignments()) {
storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable(); storm::jani::Variable const& assignedVariable = assignment.lValueIsArrayAccess() ? assignment.getLValue().getArray() : assignment.getVariable();
if (assignedVariable.getExpressionVariable() == *resVar.first) { if (assignedVariable.getExpressionVariable() == *resVar.first) {
resVar.second->hasEdgeDestinationAssignment = true; resVar.second->hasEdgeDestinationAssignment = true;
break;
}
} }
} }
ConstJaniTraverser::traverse(templateEdgeDestination, data);
} }
} }
} }

Loading…
Cancel
Save