|
@ -995,19 +995,14 @@ namespace storm { |
|
|
return destDeclarations; |
|
|
return destDeclarations; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ExportJsonType buildEdges(std::vector<Edge> const& edges , std::map<uint64_t, std::string> const& actionNames, std::map<uint64_t, std::string> const& locationNames, std::vector<storm::jani::Constant> const& constants, VariableSet const& globalVariables, VariableSet const& localVariables, bool commentExpressions) { |
|
|
|
|
|
ExportJsonType edgeDeclarations = std::vector<ExportJsonType>(); |
|
|
|
|
|
for(auto const& edge : edges) { |
|
|
|
|
|
if (edge.getGuard().isFalse()) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ExportJsonType buildEdge(Edge const& edge , std::map<uint64_t, std::string> const& actionNames, std::map<uint64_t, std::string> const& locationNames, std::vector<storm::jani::Constant> const& constants, VariableSet const& globalVariables, VariableSet const& localVariables, bool commentExpressions) { |
|
|
STORM_LOG_THROW(edge.getDestinations().size() > 0, storm::exceptions::InvalidJaniException, "An edge without destinations is not allowed."); |
|
|
STORM_LOG_THROW(edge.getDestinations().size() > 0, storm::exceptions::InvalidJaniException, "An edge without destinations is not allowed."); |
|
|
ExportJsonType edgeEntry; |
|
|
ExportJsonType edgeEntry; |
|
|
edgeEntry["location"] = locationNames.at(edge.getSourceLocationIndex()); |
|
|
edgeEntry["location"] = locationNames.at(edge.getSourceLocationIndex()); |
|
|
if(!edge.hasSilentAction()) { |
|
|
|
|
|
|
|
|
if (!edge.hasSilentAction()) { |
|
|
edgeEntry["action"] = actionNames.at(edge.getActionIndex()); |
|
|
edgeEntry["action"] = actionNames.at(edge.getActionIndex()); |
|
|
} |
|
|
} |
|
|
if(edge.hasRate()) { |
|
|
|
|
|
|
|
|
if (edge.hasRate()) { |
|
|
edgeEntry["rate"]["exp"] = buildExpression(edge.getRate(), constants, globalVariables, localVariables); |
|
|
edgeEntry["rate"]["exp"] = buildExpression(edge.getRate(), constants, globalVariables, localVariables); |
|
|
if (commentExpressions) { |
|
|
if (commentExpressions) { |
|
|
edgeEntry["rate"]["comment"] = edge.getRate().toString(); |
|
|
edgeEntry["rate"]["comment"] = edge.getRate().toString(); |
|
@ -1023,8 +1018,16 @@ namespace storm { |
|
|
if (!edge.getAssignments().empty()) { |
|
|
if (!edge.getAssignments().empty()) { |
|
|
edgeEntry["assignments"] = buildAssignmentArray(edge.getAssignments(), constants, globalVariables, localVariables, commentExpressions); |
|
|
edgeEntry["assignments"] = buildAssignmentArray(edge.getAssignments(), constants, globalVariables, localVariables, commentExpressions); |
|
|
} |
|
|
} |
|
|
|
|
|
return edgeEntry; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
edgeDeclarations.push_back(std::move(edgeEntry)); |
|
|
|
|
|
|
|
|
ExportJsonType buildEdges(std::vector<Edge> const& edges , std::map<uint64_t, std::string> const& actionNames, std::map<uint64_t, std::string> const& locationNames, std::vector<storm::jani::Constant> const& constants, VariableSet const& globalVariables, VariableSet const& localVariables, bool commentExpressions) { |
|
|
|
|
|
ExportJsonType edgeDeclarations = std::vector<ExportJsonType>(); |
|
|
|
|
|
for(auto const& edge : edges) { |
|
|
|
|
|
if (edge.getGuard().isFalse()) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
edgeDeclarations.push_back(buildEdge(edge, actionNames, locationNames, constants, globalVariables, localVariables, commentExpressions)); |
|
|
} |
|
|
} |
|
|
return edgeDeclarations; |
|
|
return edgeDeclarations; |
|
|
} |
|
|
} |
|
@ -1065,6 +1068,11 @@ namespace storm { |
|
|
jsonStruct["system"] = CompositionJsonExporter::translate(janiModel.getSystemComposition()); |
|
|
jsonStruct["system"] = CompositionJsonExporter::translate(janiModel.getSystemComposition()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ExportJsonType JsonExporter::getEdgeAsJson(storm::jani::Model const& janiModel, uint64_t automatonIndex, uint64_t edgeIndex, bool commentExpressions) { |
|
|
|
|
|
auto const& automaton = janiModel.getAutomaton(automatonIndex); |
|
|
|
|
|
return buildEdge(automaton.getEdge(edgeIndex), janiModel.getActionIndexToNameMap(), automaton.buildIdToLocationNameMap(), janiModel.getConstants(), janiModel.getGlobalVariables(), automaton.getVariables(), commentExpressions); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
std::string janiFilterTypeString(storm::modelchecker::FilterType const& ft) { |
|
|
std::string janiFilterTypeString(storm::modelchecker::FilterType const& ft) { |
|
|
switch(ft) { |
|
|
switch(ft) { |
|
|
case storm::modelchecker::FilterType::MIN: |
|
|
case storm::modelchecker::FilterType::MIN: |
|
|