Finish 3 / wiecej clonów

This commit is contained in:
ryuga4 2019-03-26 20:36:37 +01:00
parent 680b87e369
commit aaeb1b3adb
4 changed files with 15 additions and 6 deletions

View File

@ -8,7 +8,7 @@ using CzokoŚmieciarka.DataModels.Models;
namespace CzokoŚmieciarka.DataModels.Interfaces
{
public interface IGarbageLocalization
public interface IGarbageLocalization : ICloneable
{
Coords Coords { get; }

View File

@ -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();

View File

@ -4,4 +4,8 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -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;
}