Esempio n. 1
0
 public void AddPossibleParent(Bag bag)
 {
     PossibleParentBags.Add(bag.BagLabel, bag);
 }
Esempio n. 2
0
 private void AddPossibleChild(Bag bag)
 {
     PossibleChildBags.Add(bag.BagLabel, new Tuple <Bag, int>(bag, childBags[bag.BagLabel]));
 }
Esempio n. 3
0
        private Dictionary <string, Tuple <Bag, int> > MergeDescendantBag(Dictionary <string, Tuple <Bag, int> > descendantBags, Bag bag, int count)
        {
            Dictionary <string, Tuple <Bag, int> > descendants = new Dictionary <string, Tuple <Bag, int> >(descendantBags);
            int newCount = count;

            descendants.TryGetValue(bag.BagLabel, out Tuple <Bag, int> existingDescendantBagType);
            if (existingDescendantBagType != null)
            {
                newCount += existingDescendantBagType.Item2;
            }
            descendants[bag.BagLabel] = new Tuple <Bag, int>(bag, newCount);
            return(descendants);
        }