public void Populate(ref List <Node> nodes, Func <string, string> GetNodeName, Action <string> printFunc) { PrintFunc = printFunc; string[] ruleSplit = RawRules.Split('|', StringSplitOptions.RemoveEmptyEntries); foreach (String curSplit in ruleSplit) { List <string> ids = curSplit.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList(); int intTest; if (!int.TryParse(ids.ElementAt(0), out intTest)) { Value = ids.ElementAt(0); continue; } ids = ids.Select(i => GetNodeName(i)).ToList(); SubRules.Add(new List <string>()); SubRules.Last().AddRange(ids); Sequences.Add(new List <Node>()); foreach (string id in ids) { Node curNode = nodes.Where(n => n.ID == id).First(); Sequences.Last().Add(curNode); } } }
public void RemoveRules(MarkupLine intersectLine) { RawRules.RemoveAll(r => Match(r.From) || Match(r.To)); bool Match(ISupportPoint supportPoint) => supportPoint is IntersectSupportPoint lineRuleEdge && lineRuleEdge.LinePair.ContainLine(intersectLine); if (!RawRules.Any()) { AddRule(false); } }
private void AddRule(MarkupLineRawRule rule, bool update = true) { rule.OnRuleChanged = RuleChanged; RawRules.Add(rule); if (update) { RuleChanged(); } }
public void RemoveRule(MarkupLineRawRule rule) { RawRules.Remove(rule); RuleChanged(); }