public void highlightTemporarily(PrettyPrintFormat format, Color color) { var tmp = format.getPrintRule(this).Clone(); tmp.color = color; format.addTemporaryRule(id + "", tmp); }
public void highlightTemporarily(PrettyPrintFormat format, Color color, IEnumerable <ConstraintType> pathConstraints) { var baseRule = format.getPrintRule(this); IEnumerable <PrintRule> newRules; if (pathConstraints.Any()) { newRules = pathConstraints.Select(constraint => { var tmp = baseRule.Clone(); tmp.color = color; tmp.historyConstraints = constraint; return(tmp); }); } else { var tmp = baseRule.Clone(); tmp.color = color; tmp.historyConstraints = new ConstraintType(); newRules = Enumerable.Repeat(tmp, 1); } if (id == -1) { foreach (var tmp in newRules) { format.addTemporaryRule(Name, tmp); } } else { foreach (var tmp in newRules) { format.addTemporaryRule(id + "", tmp); } } }