public bool InsertLung(Lung newLung) { switch (newLung) { case LeftLung leftLung: if (LeftLung.IsPresent) { LeftLung = leftLung; return(true); } break; case RightLung rightLung: if (RightLung.IsPresent) { RightLung = rightLung; return(true); } break; default: throw new ArgumentException(message: $"Unrecognised Lung Type: {newLung.GetType().Name}"); } return(false); }
public bool RemoveLung(bool isTargetLeft, out Lung RemovedLung) { if (isTargetLeft && LeftLung.IsPresent) { RemovedLung = LeftLung; LeftLung.RemoveOrgan(); return(true); } if (!isTargetLeft && RightLung.IsPresent) { RemovedLung = RightLung; RightLung.RemoveOrgan(); return(true); } RemovedLung = null; return(false); }