Finish 3 / wiecej clonów
This commit is contained in:
parent
680b87e369
commit
aaeb1b3adb
@ -8,7 +8,7 @@ using CzokoŚmieciarka.DataModels.Models;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
{
|
||||
public interface IGarbageLocalization
|
||||
public interface IGarbageLocalization : ICloneable
|
||||
{
|
||||
Coords Coords { get; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||
{
|
||||
public abstract class ATrashCan
|
||||
public abstract class ATrashCan : ICloneable
|
||||
{
|
||||
protected ATrashCan(ITypeOfGarbage typeOfGarbage, int maxVolume)
|
||||
{
|
||||
@ -32,8 +32,13 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||
|
||||
this.Garbage = newGarbage;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
|
||||
public virtual AGarbage TakeGarbage()
|
||||
{
|
||||
var result = (AGarbage)this.Garbage.Clone();
|
||||
|
@ -4,4 +4,8 @@
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -29,8 +29,8 @@ namespace Czoko_Smieciarka.AI_Naive
|
||||
public RoutePlanningEngine(IGarbageCollector collector, IEnumerable<IGarbageLocalization> cans, IEnumerable<ADump> dumps)
|
||||
{
|
||||
this.Collector = collector.Clone() as IGarbageCollector;
|
||||
this.Cans = cans;
|
||||
this.Dumps = dumps;
|
||||
this.Cans = cans.Select(i=>(IGarbageLocalization) i.Clone());
|
||||
this.Dumps = dumps.Select(i => (ADump) i.Clone());
|
||||
this.CurrentState = State.Wait;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user