feat: Added new utility method to get an evaluation for a given rule.
@@ -26,9 +26,11 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.File;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
+import com.synopsys.integration.detector.rule.DetectorRule;
import com.synopsys.integration.detector.rule.DetectorRuleSet;
public class DetectorEvaluationTree {
@@ -78,6 +80,12 @@ public class DetectorEvaluationTree {
return orderedEvaluations;
}
+ public Optional<DetectorEvaluation> getEvaluation(DetectorRule rule) {
+ return orderedEvaluations.stream()
+ .filter(detectorEvaluation1 -> detectorEvaluation1.getDetectorRule().equals(rule))
+ .findFirst();
+ }
+
public Set<DetectorEvaluationTree> getChildren() {
return children;
}
