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"); } }
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; }
public override Leaf Remove(CompositePhysicalObject unit) { if (unitList.Contains(unit)) { unitCount--; unitList.Remove(unit); unit.SetLeaf(null); return this; } return null; }