예제 #1
0
 internal bool RemoveBranch(FmlOp b, int count = 1)
 {
     if (!Branches.ContainsKey(b))
     {
         return(false);
     }
     if ((Branches[b] -= count) <= 0)
     {
         Branches.Remove(b);
     }
     return(true);
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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);
 }