Skip to content

Commit

Permalink
fix: search by template in generated struct only
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil committed Nov 19, 2024
1 parent a160515 commit 3017cb9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions problem-solver/cxx/searchModule/agents/FindSolvingMethodAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,16 @@ ScResult FindSolvingMethodAgent::DoProgram(ScActionInitiatedEvent const & event,
generatedStruct << templateResult[i];
}
ScTemplateSearchResult searchResult;

if (m_context.SearchByTemplate(targetSituationTemplate, searchResult) &&
isGeneratedStructureFound(generatedStruct, searchResult))
bool isGeneratedConstructionFound = false;
m_context.SearchByTemplate(
targetSituationTemplate,
[&isGeneratedConstructionFound](ScTemplateSearchResultItem const & item) -> void {
isGeneratedConstructionFound = true;
},
[this, generatedStruct](ScAddr const & elementAddr) -> bool {
return m_context.CheckConnector(generatedStruct, elementAddr, ScType::EdgeAccessConstPosPerm);
});
if (isGeneratedConstructionFound)
{
suitableMethods.insert(solvingMethod);
break;
Expand Down

0 comments on commit 3017cb9

Please sign in to comment.