Commit 9f193e2
Changed files (7)
src
domain
src/domain/utility/iterating.cs
@@ -0,0 +1,14 @@
+namespace utility
+{
+ using System;
+ using System.Linq;
+ using System.Collections.Generic;
+
+ public static class Iterating
+ {
+ public static void Each<T>(this IEnumerable<T> items, Action<T> visitor){
+ foreach (var item in items ?? Enumerable.Empty<T>())
+ visitor(item);
+ }
+ }
+}
src/domain/BOED.cs
@@ -0,0 +1,38 @@
+namespace domain
+{
+ public class BOED : IUnitOfMeasure
+ {
+ public decimal Convert(decimal amount, IUnitOfMeasure units)
+ {
+ // need to do actual conversion here;
+ return amount;
+ }
+
+ public bool Equals(BOED other)
+ {
+ if (ReferenceEquals(null, other)) return false;
+ if (ReferenceEquals(this, other)) return true;
+ return true;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != typeof (BOED)) return false;
+ return Equals((BOED) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (name != null ? name.GetHashCode() : 0);
+ }
+
+ public override string ToString()
+ {
+ return name;
+ }
+
+ readonly string name = "BOED";
+ }
+}
src/domain/domain.csproj
@@ -41,6 +41,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Greeting.cs" />
+ <Compile Include="BOED.cs" />
<Compile Include="Commodity.cs" />
<Compile Include="CommoditySplits.cs" />
<Compile Include="DeclineCurve.cs" />
@@ -51,7 +52,10 @@
<Compile Include="Production.cs" />
<Compile Include="Quantity.cs" />
<Compile Include="TypeCurve.cs" />
+ <Compile Include="Units.cs" />
<Compile Include="Well.cs" />
+ <Compile Include="IUnitOfMeasure.cs" />
+ <Compile Include="utility\iterating.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(OS)' == 'Windows_NT' " />
src/domain/DrillSchedule.cs
@@ -3,6 +3,7 @@ namespace domain
using System;
using System.Collections.Generic;
using System.Linq;
+ using utility;
public class DrillSchedule
{
src/domain/IUnitOfMeasure.cs
@@ -0,0 +1,7 @@
+namespace domain
+{
+ public interface IUnitOfMeasure
+ {
+ decimal Convert(decimal amount, IUnitOfMeasure units);
+ }
+}
src/domain/Units.cs
@@ -0,0 +1,22 @@
+namespace domain
+{
+ using System;
+
+ public static class Units
+ {
+ public static Percent Percent(this decimal percentage)
+ {
+ return new Percent(percentage/100);
+ }
+
+ public static IQuantity BOED(this int quantity)
+ {
+ return BOED(Convert.ToDecimal(quantity));
+ }
+
+ public static IQuantity BOED(this decimal quantity)
+ {
+ return new Quantity(quantity, new BOED());
+ }
+ }
+}
src/domain/Well.cs
@@ -3,6 +3,7 @@ namespace domain
using System;
using System.Collections.Generic;
using System.Linq;
+ using utility;
public class Well : IWell
{
@@ -33,71 +34,4 @@ namespace domain
IQuantity GrossProductionFor<T>(Month month) where T : ICommodity, new();
IQuantity NetProductionFor<T>(Month month) where T : ICommodity, new();
}
-
- public static class Units
- {
- public static Percent Percent(this decimal percentage)
- {
- return new Percent(percentage/100);
- }
-
- public static IQuantity BOED(this int quantity)
- {
- return BOED(Convert.ToDecimal(quantity));
- }
-
- public static IQuantity BOED(this decimal quantity)
- {
- return new Quantity(quantity, new BOED());
- }
- }
-
- public class BOED : IUnitOfMeasure
- {
- public decimal Convert(decimal amount, IUnitOfMeasure units)
- {
- // need to do actual conversion here;
- return amount;
- }
-
- public bool Equals(BOED other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return true;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (BOED)) return false;
- return Equals((BOED) obj);
- }
-
- public override int GetHashCode()
- {
- return (name != null ? name.GetHashCode() : 0);
- }
-
- public override string ToString()
- {
- return name;
- }
-
- readonly string name = "BOED";
- }
-
- public interface IUnitOfMeasure
- {
- decimal Convert(decimal amount, IUnitOfMeasure units);
- }
-
- public static class Iterating
- {
- public static void Each<T>(this IEnumerable<T> items, Action<T> visitor){
- foreach (var item in items ?? Enumerable.Empty<T>())
- visitor(item);
- }
- }
}