public void AttachToFront(IMovable obj) { if (AttachedNext == null) { AttachedNext = obj; obj.AttachToBack(this); } else { AttachedNext.AttachToFront(obj); } }
public IMovable RemoveFromFront(IMovable obj) { if (AttachedNext == null) { return(null); } if (AttachedNext.Equals(obj)) { IMovable next = AttachedNext; AttachedNext = null; return(next); } else { return(AttachedNext.RemoveFromFront(obj)); } }