public Rule GetRule(int pos) { if (rules.ContainsKey(pos)) return rules[pos]; else { Rule r = new Rule(this, pos); rules.Add(pos, r); if (this.NextRulePos < pos) this.NextRulePos = pos + 1; return r; } }
public void RemoveRule(Rule r) { if (rules.ContainsKey(r.pos)) rules.Remove(r.pos); }
public Rule AddRule(RuleTypes type, RuleDirections dir, string pattern, string replacement) { Rule r = new Rule(this, this.NextRulePos, type, dir, pattern, replacement); rules.Add(this.NextRulePos, r); this.NextRulePos ++; return r; }