zmiany zabierania smieci
This commit is contained in:
parent
f12495c1b4
commit
e89d892f79
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
{
|
||||
public abstract class AGarbage : IGarbage
|
||||
public abstract class AGarbage : IGarbage, ICloneable
|
||||
{
|
||||
protected AGarbage(ITypeOfGarbage typeOfGarbage, int weight)
|
||||
{
|
||||
@ -15,7 +15,7 @@ namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
}
|
||||
|
||||
public ITypeOfGarbage TypeOfGarbage { get; }
|
||||
public virtual int Weight { get; }
|
||||
public virtual int Weight { get; set; }
|
||||
|
||||
public virtual int Volume
|
||||
{
|
||||
@ -36,6 +36,11 @@ namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
{
|
||||
return a.Subtract(b);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
|
@ -8,6 +8,10 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine
|
||||
{
|
||||
public abstract class ARoutePlanningEngine
|
||||
{
|
||||
protected IGarbageCollector garbageCollector;
|
||||
|
||||
protected IEnumerable<IGarbageLocalization> garbageLocalizations;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
{
|
||||
|
@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||
{
|
||||
public abstract class ATrashCan
|
||||
{
|
||||
@ -28,7 +24,7 @@ namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
public virtual bool AddGarbage(AGarbage garbage)
|
||||
{
|
||||
if (this._typeOfGarbage != garbage.TypeOfGarbage)
|
||||
return false;
|
||||
throw new Exception("You cannot add up different type garbage!");
|
||||
|
||||
var newGarbage = this.Garbage + Garbage;
|
||||
if (newGarbage.Volume > this.MaxVolume)
|
||||
@ -40,8 +36,8 @@ namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
|
||||
public virtual AGarbage TakeGarbage()
|
||||
{
|
||||
var result = this.Garbage;
|
||||
this.Garbage = null;
|
||||
var result = (AGarbage)this.Garbage.Clone();
|
||||
this.Garbage.Weight = 0;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user