public bool TryAdd(Boat boat, BerthingAlgorithm algorithm) { if (Boats.Contains(boat)) { throw new ArgumentException("A boat with the same id is already berthed.", nameof(boat)); } int index = algorithm(boat, berthSpots); if (index < 0) { return(false); } AddBoat(boat, index); return(true); }
public void SetBerthingAlgorithm(BerthingAlgorithm algorithm, string algorithmName) { berthingAlgorithm = algorithm; this.algorithmName = algorithmName; }