internal bool RemoveBranch(FmlOp b, int count = 1) { if (!Branches.ContainsKey(b)) { return(false); } if ((Branches[b] -= count) <= 0) { Branches.Remove(b); } return(true); }
internal void AddBranch(FmlOp b, int count = 1) { if (b == null) { throw new Exception("b is null"); } if (count < 1) { throw new Exception("count is less than 1"); } if (Branches.ContainsKey(b)) { Branches[b] += count; } else { Branches.Add(b, count); } }
public bool FindInAncestors(FmlOp b) { if (b == null) { return(false); } if (Branches.Count == 0) { return(false); } if (Branches.ContainsKey(b)) { return(true); } foreach (FmlOp parent in Branches.Keys) { if (FindInAncestors(b)) { return(true); } } return(false); }