static double countOld(double d1, double d2, double Vm, double S0, double Km) { Constants2 c01 = new Constants2(d1, d2, 0.0004, Vm, S0, 40, 40, 120, Km); ElectricityOld electricity1 = new ElectricityOld(new NewProduct(c01), c01); double value1 = electricity1.calculate(); electricity1 = null; return(value1); }
// Constructor with conditions public NewProduct(Constants2 co2) { c2 = co2; s = new SubstractFactory(co2); for (int i = 0; i <= Convert.ToInt32(c2.N2); i++) { p2.Add(new Key(i, 0).getKey(), new Product(0)); } for (int i = 0; i <= Convert.ToInt32(c2.N1); i++) { p1.Add(new Key(i, 0).getKey(), new Product(0)); } }
// Constructor with conditions public SubstractFactory(Constants2 co2) { //c = constants; c2 = co2; for (int i = 0; i < Convert.ToInt32(c2.N1); i++) { s1.Add(new Key(i, 0).getKey(), new Substract(0)); } for (int i = 1; i < Convert.ToInt32(c2.N2); i++) { s2.Add(new Key(i, 0).getKey(), new Substract(0)); } s2.Add(new Key(Convert.ToInt32(c2.N2), 0).getKey(), new Substract(c2.S0)); s1.Add(new Key(Convert.ToInt32(c2.N1), 0).getKey(), new Substract(0)); s2.Add(new Key(0, 0).getKey(), new Substract(0)); }
public ElectricityOld(IProduct product, Constants2 constants2) { p = product; c2 = constants2; }