private List < GroovyExpression > processOtherExpression ( GroovyExpression source , OptimizationContext context ) { UpdatedExpressions updatedChildren = getUpdatedChildren ( source , context ) ; if ( ! updatedChildren . hasChanges ( ) ) { return Collections . singletonList ( source ) ; } List < GroovyExpression > result = new ArrayList < GroovyExpression > ( ) ; //The updated children list we get back has the possible values for each child //in the expression. We compute a cartesian product to get all possible //combinations of child values. List < List < GroovyExpression > > updateChildLists = Lists . cartesianProduct ( updatedChildren . getUpdatedChildren ( ) ) ; for ( List < GroovyExpression > updatedChildList : updateChildLists ) { result . add ( source . copy ( updatedChildList ) ) ; } return result ; }
This is called when we encounter an expression that is not an or for example an and expressio . For these expressions we process the children and create copies with the cartesian product of the updated arguments .