summaryrefslogtreecommitdiff
path: root/src/domain/Well.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/domain/Well.cs')
-rw-r--r--src/domain/Well.cs98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/domain/Well.cs b/src/domain/Well.cs
index 69b5cd5..209cb34 100644
--- a/src/domain/Well.cs
+++ b/src/domain/Well.cs
@@ -28,110 +28,12 @@ namespace domain
}
}
- public class Month
- {
- readonly int year;
- readonly int month;
-
- public Month(int year, int month)
- {
- this.year = year;
- this.month = month;
- }
-
- public bool Equals(Month other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return other.year == year && other.month == month;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Month)) return false;
- return Equals((Month) obj);
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- return (year*397) ^ month;
- }
- }
-
- public Month Plus(int months)
- {
- var newMonth = new DateTime(year, month, 01).AddMonths(months);
- return new Month(newMonth.Year, newMonth.Month);
- }
-
- public override string ToString()
- {
- return string.Format("{0} {1}", year, month);
- }
- }
-
public interface IWell
{
IQuantity GrossProductionFor<T>(Month month) where T : ICommodity, new();
IQuantity NetProductionFor<T>(Month month) where T : ICommodity, new();
}
- public class Percent
- {
- readonly decimal percentage;
- public static Percent Zero = new Percent(0);
-
- public Percent(decimal percentage)
- {
- this.percentage = percentage;
- }
-
- public bool Equals(Percent other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return other.percentage == percentage;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Percent)) return false;
- return Equals((Percent) obj);
- }
-
- public override int GetHashCode()
- {
- return percentage.GetHashCode();
- }
-
- public IQuantity Reduce(IQuantity original)
- {
- //return new ProratedQuantity(original, this);
- return new Quantity(PortionOf(original.Amount), original.Units);
- }
-
- public Percent Plus(Percent other)
- {
- return new Percent(percentage + other.percentage);
- }
-
- public decimal PortionOf(decimal amount)
- {
- return amount*percentage;
- }
-
- public override string ToString()
- {
- return string.Format("{0} %", percentage);
- }
- }
-
public static class Units
{
public static Percent Percent(this decimal percentage)