public Container FindContainerFor(IList <Container> containers, Drum drum) { foreach (var container in containers) { if (container.CanAccommodate(drum)) { return(container); } } throw new Exception(); }
public bool CanAccommodate(Drum drum) { if (drum.GetContainerSpecification() == null) { return(HasSpaceFor(drum)); } else { return(HasSpaceFor(drum) && drum.GetContainerSpecification().IsSatisfiedBy(this)); } }
public bool HasSpaceFor(Drum drum) { return(RemainingSpace >= drum.Size); }
public void AddDrum(Drum drum) { Drums.Add(drum); }