/** * called by the class that is responsible for writing this sucker. * Subclasses should implement this so that their data is passed back in a * byte array. * * @param out the stream to write to */ public override void Serialize(ILittleEndianOutput out1) { futureHeader.Serialize(out1); int formula1Len = GetFormulaSize(Formula1); int formula2Len = GetFormulaSize(Formula2); out1.WriteByte(ConditionType); out1.WriteByte(ComparisonOperation); out1.WriteShort(formula1Len); out1.WriteShort(formula2Len); // TODO Update ext_formatting_length if (ext_formatting_length == 0) { out1.WriteInt(0); out1.WriteShort(0); } else { out1.WriteInt(ext_formatting_length); SerializeFormattingBlock(out1); out1.Write(ext_formatting_data); } Formula1.SerializeTokens(out1); Formula2.SerializeTokens(out1); out1.WriteShort(GetFormulaSize(formula_scale)); formula_scale.SerializeTokens(out1); out1.WriteByte(ext_opts); out1.WriteShort(priority); out1.WriteShort(template_type); out1.WriteByte(template_param_length); out1.Write(template_params); byte type = ConditionType; if (type == CONDITION_TYPE_COLOR_SCALE) { color_gradient.Serialize(out1); } else if (type == CONDITION_TYPE_DATA_BAR) { data_bar.Serialize(out1); } else if (type == CONDITION_TYPE_FILTER) { out1.Write(filter_data); } else if (type == CONDITION_TYPE_ICON_SET) { multistate.Serialize(out1); } }
public void Generator_ForSequence2() { int[] expected = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; var computer = new Formula2(); int i = 0; foreach (var number in Generator.GenerateSequence(expected.Length, 1, 2, computer)) { Assert.AreEqual(expected[i++], number); } Assert.AreEqual(expected.Length, i); }
/** * called by the class that is responsible for writing this sucker. * Subclasses should implement this so that their data is passed back in a * byte array. * * @param out the stream to write to */ public override void Serialize(ILittleEndianOutput out1) { int formula1Len = GetFormulaSize(Formula1); int formula2Len = GetFormulaSize(Formula2); out1.WriteByte(ConditionType); out1.WriteByte(ComparisonOperation); out1.WriteShort(formula1Len); out1.WriteShort(formula2Len); SerializeFormattingBlock(out1); Formula1.SerializeTokens(out1); Formula2.SerializeTokens(out1); }
public ActionResult Index() { IEnumerable <ReportDTO> ReportDtos = ReportService.GetReports(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <ReportDTO, ReportViewModel>()).CreateMapper(); var Reports = mapper.Map <IEnumerable <ReportDTO>, List <ReportViewModel> >(ReportDtos); //email = Request.QueryString["email"]; /// STRATEGY var calculatorContext = new Report2(new CalculatorO3()); var O3Total = calculatorContext.Calculate(ReportDtos); calculatorContext.SetCalculator(new CalculatorNO2()); var NO2Total = calculatorContext.Calculate(ReportDtos); calculatorContext.SetCalculator(new CalculatorSO2()); var SO2Total = calculatorContext.Calculate(ReportDtos); ViewBag.O3Result = O3Total; ViewBag.NO2Result = NO2Total; ViewBag.SO2Result = SO2Total; /// TEMPLATE AbstractClass result = new Formula1(); result.Calculating(O3Total, NO2Total, SO2Total); ViewBag.F1S1 = result.FirstStep(O3Total, NO2Total, SO2Total); ViewBag.F1S2 = result.SecondStep(O3Total, NO2Total, SO2Total); ViewBag.F1S3 = result.ThirdStep(O3Total, NO2Total, SO2Total); result = new Formula2(); result.Calculating(O3Total, NO2Total, SO2Total); ViewBag.F2S1 = result.FirstStep(O3Total, NO2Total, SO2Total); ViewBag.F2S2 = result.SecondStep(O3Total, NO2Total, SO2Total); ViewBag.F2S3 = result.ThirdStep(O3Total, NO2Total, SO2Total); /// FACADE Subsystem1 subsystem1 = new Subsystem1(); Subsystem2 subsystem2 = new Subsystem2(); Facade facade = new Facade(subsystem1, subsystem2); ViewBag.FCD_S1_O1 = subsystem1.operation1(O3Total, NO2Total, SO2Total); ViewBag.FCD_S1_ON = subsystem1.operationN(O3Total, NO2Total, SO2Total); ViewBag.FCD_S2_O1 = subsystem2.operation1(O3Total, NO2Total, SO2Total); ViewBag.FCD_S2_OZ = subsystem2.operationZ(O3Total, NO2Total, SO2Total); return(View(Reports)); }