Esempio n. 1
0
        public void AddLeafIdx(int idx)
        {
            Assert.IsFalse(leaves.Contains(idx), $"leaf idx {idx} already added");
            leaves.Add(idx);

            Display(Type.Leaf, leaves.Count);
            if (GetThreshold(Type.Leaf) > 0 && IsSatisfied(Type.Leaf))
            {
                OnLeafFilled?.Invoke(false);
            }
        }
Esempio n. 2
0
        // this class really should not throw these events, but such is life
        public void LimitLeaf(int threshold)
        {
            bool prevSatisfied = IsSatisfied(Type.Leaf);

            Constrain(Type.Leaf, threshold);
            bool nowSatisfied = IsSatisfied(Type.Leaf);

            if (!prevSatisfied && nowSatisfied)
            {
                OnLeafFilled?.Invoke(false);
            }
            else if (prevSatisfied && !nowSatisfied)
            {
                OnLeafFilled?.Invoke(true);
            }
        }
Esempio n. 3
0
        public void RemoveIdx(int idx)
        {
            if (leaves.Contains(idx))
            {
                leaves.Remove(idx);

                if (GetThreshold(Type.Leaf) > 0 && IsSatisfied(Type.Leaf))
                {
                    OnLeafFilled?.Invoke(true);
                }
                Display(Type.Leaf, leaves.Count);
            }
            else
            {
                paws.Remove(idx);

                if (GetThreshold(Type.Paw) > 0 && IsSatisfied(Type.Paw))
                {
                    OnPawFilled?.Invoke(true);
                }
                Display(Type.Paw, paws.Count);
            }
        }