public void RemoveResource(AbsractResource res) { if (res == comp) { comp = null; } else if (res == designer) { designer = null; } else if (res == algorithm) { algorithm = null; } else { throw new ArgumentException("No such element"); } }
public void AddResource(AbsractResource res) { if (res is Computer && comp == null) { comp = (Computer)res; } else if (res is Designer && designer == null) { designer = (Designer)res; } else if (res is PlacingAlgorithm && algorithm == null) { algorithm = (PlacingAlgorithm)res; } else { throw new ArgumentException(); } }