I have a a bunch of rows in a table which store some variables and associated values. I have to fire a task depending the values of the variables from different rows. Multiple values from multiple rows can be overlapped by AND/OR conditions. What design pattern will be helpful to reduce cyclomatic complexity in this situation?
Lets say, Table
Now at runtime some condition needed to be tested. For example,
if v1 column has any value 'a' or 'b' AND 3rd and 4th row contains any 'g' OR all of 5th row contains value 'f', etc.
This kind of requirements are dynamic under certain fixed boundary and I have to prepare a method which takes the input table, and conditions. The method finally returns true/false. If I implement naively I need many nested if/else under full bounded possible conditions which makes my code much complex. What will be good pattern to handle it.
For a real world scenario, I think you should look into rule engines, see https://www.baeldung.com/java-rule-engines for a list of examples.
The point here is: representing your rules in hand written code doesn't scale! There are no good patterns that prevent such a code base from turning into spaghetti code over time. In the real world, such rules change often, and keeping your code up to date often results in duct taping yet another condition to it.
Therefore we have rules engines that allow you to express the elements for such complex decisions in ways that are better to maintain compared to hand written cascades of if else blocks.
And the thing is: if you are serious about the quality of your work, you will most likely implement your own little rules engine yourself anyway. So why not pick one from the shelf, or at least study some carefully and use them as inspiration how to better solve your problem?!