Part 1 & 2
This commit is contained in:
23
Buckets.Logic/Bucket.cs
Normal file
23
Buckets.Logic/Bucket.cs
Normal file
@ -0,0 +1,23 @@
|
||||
namespace Buckets.Logic
|
||||
{
|
||||
public class Bucket : Container
|
||||
{
|
||||
private const int DEFAULT_CAPACITY = 12;
|
||||
private const int MAX_CAPACITY = 2500;
|
||||
private const int MIN_CAPACITY = 10;
|
||||
|
||||
public Bucket(int content) : base(DEFAULT_CAPACITY, content) {}
|
||||
|
||||
public Bucket(int capacity, int content) : base(capacity, content)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan(capacity, MAX_CAPACITY, nameof(capacity));
|
||||
ArgumentOutOfRangeException.ThrowIfLessThan(capacity, MIN_CAPACITY, nameof(capacity));
|
||||
}
|
||||
|
||||
public void Fill(Bucket bucket)
|
||||
{
|
||||
Content += bucket.Content;
|
||||
bucket.Empty();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user