From 7275ee09da700deec0e2e4277d2a10204ac0a4c0 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 5 May 2022 10:14:45 +0200 Subject: [PATCH] Fix for walking through DataDescriptorMatcher structure Only visit the left node for operation 'not'. Additional small change for DataDescriptorMatcher created from ConcreteDataTypeMatcher to be in line with the structure used in all other cases. --- Framework/Core/src/DataDescriptorMatcher.cxx | 3 ++- Framework/Core/src/DataSpecUtils.cxx | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Framework/Core/src/DataDescriptorMatcher.cxx b/Framework/Core/src/DataDescriptorMatcher.cxx index da5f6b075e4f1..1d2c100e512ee 100644 --- a/Framework/Core/src/DataDescriptorMatcher.cxx +++ b/Framework/Core/src/DataDescriptorMatcher.cxx @@ -454,7 +454,8 @@ std::ostream& operator<<(std::ostream& os, DataDescriptorMatcher const& matcher) auto edgeWalker = overloaded{ [&os](EdgeActions::EnterNode action) { os << "(" << action.node->mOp; - if (action.node->mOp == DataDescriptorMatcher::Op::Just) { + if (action.node->mOp == DataDescriptorMatcher::Op::Just || + action.node->mOp == DataDescriptorMatcher::Op::Not) { return ChildAction::VisitLeft; } return ChildAction::VisitBoth; diff --git a/Framework/Core/src/DataSpecUtils.cxx b/Framework/Core/src/DataSpecUtils.cxx index b8d75a99166d0..a050535449d8c 100644 --- a/Framework/Core/src/DataSpecUtils.cxx +++ b/Framework/Core/src/DataSpecUtils.cxx @@ -334,7 +334,8 @@ MatcherInfo extractMatcherInfo(DataDescriptorMatcher const& top) state.hasError = true; return VisitNone; } - if (action.node->getOp() == ops::Just) { + if (action.node->getOp() == ops::Just || + action.node->getOp() == ops::Not) { return VisitLeft; } return VisitBoth; @@ -510,7 +511,8 @@ DataDescriptorMatcher DataSpecUtils::dataDescriptorMatcherFrom(ConcreteDataTypeM auto timeDescriptionMatcher = std::make_unique( DataDescriptorMatcher::Op::And, DescriptionValueMatcher{dataType.description.as()}, - StartTimeValueMatcher(ContextRef{0})); + std::make_unique(DataDescriptorMatcher::Op::Just, + StartTimeValueMatcher{ContextRef{0}})); return std::move(DataDescriptorMatcher( DataDescriptorMatcher::Op::And, OriginValueMatcher{dataType.origin.as()}, @@ -564,12 +566,11 @@ std::optional DataSpecUtils::optionalConcreteDat if (state.hasError) { return VisitNone; } + // a ConcreteDataMatcher requires either 'and' or 'just' + // operations and we return the corresponding action for these if (action.node->getOp() == ops::Just) { return VisitLeft; - } - // a ConcreteDataMatcher requires only 'and' operations - // which have an OR, so we reset all the uniqueness attributes. - if (action.node->getOp() == ops::And) { + } else if (action.node->getOp() == ops::And) { return VisitBoth; } // simply use the error state to indicate that the operation does not match the