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
|
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||||
{
|
{
|
||||||
public interface IGarbageLocalization
|
public interface IGarbageLocalization : ICloneable
|
||||||
{
|
{
|
||||||
Coords Coords { get; }
|
Coords Coords { get; }
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||||
{
|
{
|
||||||
public abstract class ATrashCan
|
public abstract class ATrashCan : ICloneable
|
||||||
{
|
{
|
||||||
protected ATrashCan(ITypeOfGarbage typeOfGarbage, int maxVolume)
|
protected ATrashCan(ITypeOfGarbage typeOfGarbage, int maxVolume)
|
||||||
{
|
{
|
||||||
@ -34,6 +34,11 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return this.MemberwiseClone();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual AGarbage TakeGarbage()
|
public virtual AGarbage TakeGarbage()
|
||||||
{
|
{
|
||||||
var result = (AGarbage)this.Garbage.Clone();
|
var result = (AGarbage)this.Garbage.Clone();
|
||||||
|
@ -4,4 +4,8 @@
|
|||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -29,8 +29,8 @@ namespace Czoko_Smieciarka.AI_Naive
|
|||||||
public RoutePlanningEngine(IGarbageCollector collector, IEnumerable<IGarbageLocalization> cans, IEnumerable<ADump> dumps)
|
public RoutePlanningEngine(IGarbageCollector collector, IEnumerable<IGarbageLocalization> cans, IEnumerable<ADump> dumps)
|
||||||
{
|
{
|
||||||
this.Collector = collector.Clone() as IGarbageCollector;
|
this.Collector = collector.Clone() as IGarbageCollector;
|
||||||
this.Cans = cans;
|
this.Cans = cans.Select(i=>(IGarbageLocalization) i.Clone());
|
||||||
this.Dumps = dumps;
|
this.Dumps = dumps.Select(i => (ADump) i.Clone());
|
||||||
this.CurrentState = State.Wait;
|
this.CurrentState = State.Wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user