Czoko_Smieciarka/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2019-03-13 14:19:38 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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
{
2019-04-23 06:32:35 +02:00
protected AGarbage(ITypeOfGarbage typeOfGarbage, double weight)
2019-03-13 14:19:38 +01:00
{
this.TypeOfGarbage = typeOfGarbage;
this.Weight = weight;
}
public ITypeOfGarbage TypeOfGarbage { get; }
2019-03-13 17:23:52 +01:00
2019-04-23 06:32:35 +02:00
public virtual double Weight { get; set; }
2019-03-13 14:19:38 +01:00
2019-04-23 06:32:35 +02:00
public virtual double Volume
2019-03-13 14:19:38 +01:00
{
2019-04-23 06:32:35 +02:00
get { return (double) this.Weight / TypeOfGarbage.Density; }
2019-03-13 14:19:38 +01:00
}
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
2019-04-23 06:32:35 +02:00
public virtual object Clone()
2019-03-13 14:51:01 +01:00
{
2019-04-23 06:32:35 +02:00
return new NotImplementedException("xD");
2019-03-13 14:51:01 +01:00
}
2019-03-13 14:19:38 +01:00
}
}