*/
Template addPattern(AbstractPattern pattern, String mode, double priority,
String function, int funId)
{
if (pattern instanceof UnionPattern) {
UnionPattern union = (UnionPattern) pattern;
addPattern(union.getLeft(), mode, priority, function, funId);
return addPattern(union.getRight(), mode, priority, function, funId);
}
if (Double.isNaN(priority))
priority = pattern.getPriority();