Example #1
0
 public bool Remove(CompositePhysicalObject unit)
 {
     Leaf removeFrom = root.Remove(unit);
     if (removeFrom != null)
     {
         unit.SetLeaf(null);
         removeFrom.Collapse();
         return true;
     }
     else
     {
         throw new Exception("No object to remove");
     }
 }
Example #2
0
        public override bool Add(CompositePhysicalObject unit)
        {
            if (this.Contains(unit.Position))
            {
                unitCount++;
                unitList.Add(unit);
                unit.SetLeaf(this);

                if (unitList.Count > max_count)
                {
                    this.Expand();
                }
                return true;
            }
            return false;
        }
Example #3
0
 public override Leaf Remove(CompositePhysicalObject unit)
 {
     if (unitList.Contains(unit))
     {
         unitCount--;
         unitList.Remove(unit);
         unit.SetLeaf(null);
         return this;
     }
     return null;
 }