2019-03-13 14:19:38 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2019-04-22 09:24:16 +02:00
|
|
|
|
namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage
|
2019-03-13 14:19:38 +01:00
|
|
|
|
{
|
2019-03-13 17:23:52 +01:00
|
|
|
|
public abstract class AGarbage : IGarbage
|
2019-03-13 14:19:38 +01:00
|
|
|
|
{
|
|
|
|
|
protected AGarbage(ITypeOfGarbage typeOfGarbage, int weight)
|
|
|
|
|
{
|
|
|
|
|
this.TypeOfGarbage = typeOfGarbage;
|
|
|
|
|
this.Weight = weight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ITypeOfGarbage TypeOfGarbage { get; }
|
2019-03-13 17:23:52 +01:00
|
|
|
|
|
2019-03-13 14:51:01 +01:00
|
|
|
|
public virtual int Weight { get; set; }
|
2019-03-13 14:19:38 +01:00
|
|
|
|
|
|
|
|
|
public virtual int Volume
|
|
|
|
|
{
|
|
|
|
|
get { return this.Weight / TypeOfGarbage.Density; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected abstract AGarbage Add(AGarbage garbageToAdd);
|
2019-03-13 17:23:52 +01:00
|
|
|
|
protected abstract AGarbage Subtract (AGarbage garbageToSubtract);
|
2019-03-13 14:19:38 +01:00
|
|
|
|
|
|
|
|
|
#region Operators
|
|
|
|
|
|
|
|
|
|
public static AGarbage operator + (AGarbage a, AGarbage b)
|
|
|
|
|
{
|
|
|
|
|
return a.Add(b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static AGarbage operator - (AGarbage a, AGarbage b)
|
|
|
|
|
{
|
|
|
|
|
return a.Subtract(b);
|
|
|
|
|
}
|
2019-03-13 17:23:52 +01:00
|
|
|
|
|
2019-03-13 14:51:01 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
|
{
|
|
|
|
|
return this.MemberwiseClone();
|
|
|
|
|
}
|
2019-03-13 14:19:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|