internal override PivotsExpression ToPivotsExpression(Dictionary<string, Pivots.Pivot> pivotVsPivotValues, GetChoiceDelegate get_choice_fn)
{
PivotsExpression left, right;
left = left_child.ToPivotsExpression(pivotVsPivotValues, get_choice_fn);
if (left.invariant) {
if (left.invariant_result)
return left;
else
return right_child.ToPivotsExpression(pivotVsPivotValues, get_choice_fn);
}
right = right_child.ToPivotsExpression(pivotVsPivotValues, get_choice_fn);
if (right.invariant) {
if (right.invariant_result)
return right;
else
return left;
}
HashSet<string> pivots;
ComparableHashSet<ComparableHashSet<string>> result;
pivots = new HashSet<string>(left.relevant_pivots);
pivots.UnionWith(right.relevant_pivots);
result = GetExpandedChoices(left, pivots, pivotVsPivotValues);
result.UnionWith(GetExpandedChoices(right, pivots, pivotVsPivotValues));
PivotsExpression res = new PivotsExpression();
res.relevant_pivots = pivots;
res.matching_combinations = result;
return res.Simplify(pivotVsPivotValues);
}