public virtual void RemoveUnitHierarchy(UnitHierarchy uh) { if (uh.ParentUnit == this) { this.UnitHierarchyChildren.Remove(uh); } else if (uh.Unit == this) { this.UnitHierarchies.Remove(uh); } }
// data modification methods below public virtual void AddUnitHierarchy(UnitHierarchy uh) { if (uh.ParentUnit == this) { if (this.UnitHierarchyChildren.Contains(uh)) { return; } this.UnitHierarchyChildren.Add(uh); } else if (uh.Unit == this) { if (this.UnitHierarchies.Contains(uh)) { return; } this.UnitHierarchies.Add(uh); } }