public Analysis(string symbol, AnalysisType type) { //assetTimeframe = assetTimeframe. Symbol = symbol; Type = type; AnalysisStart = DateTime.Now; }
public ActionResult Create(newAnalysis data) { VisitDate visit = db.visits.Include(v => v.analysis).Where(v => v.ID == data.visitID).FirstOrDefault(); if (visit == null) { return(RedirectToAction("Index", "Pacients")); } Pacient pacient = db.pacients.Where(p => p.visits.Any(v => v.ID == data.visitID)).FirstOrDefault(); if (pacient == null) { return(RedirectToAction("Index", "Pacients")); } if (ModelState.IsValid) { AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First(); data.analysis.type = type; visit.analysis.Add(data.analysis); db.SaveChanges(); return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis)); } return(PartialView("/views/Analyses/pacientCreate.cshtml", data)); }
public void GetDataSetsWithInitialCollection_ReturnsArrayWithoutChanges_IfNonEmptyArrayWasPassedAndThereWereNoDataToBeAppended() { //Arrange IEnumerable <AnalysisType> analysisTypes = new AnalysisType[] { AnalysisType.Quotations, AnalysisType.Prices }; AnalysisDataQueryDefinition queryDef = new AnalysisDataQueryDefinition(UTDefaulter.DEFAULT_ASSET_ID, UTDefaulter.DEFAULT_TIMEFRAME_ID) { AnalysisTypes = analysisTypes }; Mock <IQuotationRepository> quotationRepository = new Mock <IQuotationRepository>(); Mock <IPriceRepository> priceRepository = new Mock <IPriceRepository>(); IEnumerable <PriceDto> priceDtos = utf.getDefaultPriceDtosCollection(); quotationRepository.Setup(q => q.GetQuotations(queryDef)).Returns(new List <QuotationDto>()); priceRepository.Setup(p => p.GetPrices(queryDef)).Returns(priceDtos); //Act DataSet[] baseDataSets = new DataSet[11]; baseDataSets[7] = utf.getDataSet(7); baseDataSets[8] = utf.getDataSet(8); baseDataSets[9] = utf.getDataSet(9); baseDataSets[10] = utf.getDataSet(10); IDataSetService service = new DataSetService(); service.InjectQuotationRepository(quotationRepository.Object); service.InjectPriceRepository(priceRepository.Object); var dataSets = service.GetDataSets(queryDef, baseDataSets).ToArray(); //Assert var areEqual = baseDataSets.HasEqualItemsInTheSameOrder(dataSets); Assert.IsTrue(areEqual); }
private void Defaults(TimeSeriesDatabase db) { // m_siteCatalog = sc; m_db = db; //ScenarioNames = m_db.Scenario; m_thirtyYearAverage = false; m_selectedSeries = new Series[] { }; m_analysisList = new AnalysisCollection(this); // HasTraces = false; _monthDayRange = new MonthDayRange(10, 1, 9, 30); this.StatisticalMethods = StatisticalMethods.None; WaterYearBeginningMonth = 10;// october WaterYears = new int[] { 2001, 2002, 2003, 2004, 2005, 2006 }; ExceedanceLevels = new int[] { 10, 50, 90 }; AlsoPlotYear = false; PlotYear = 2006; PlotMax = false; PlotMin = false; PlotAvg = false; TimeWindow = new TimeWindow(); SelectedAnalysisType = AnalysisType.TimeSeries; //SelectedScenarios = new string[] { }; m_subtractFromBaseline = false; }
public LogEntry(AnalysisType procedure, string filename, AST.Address address, string original_value, string erroneous_value, double output_error_magnitude, double num_input_error_magnitude, double str_input_error_magnitude, bool was_flagged, bool was_error, double significance, double threshold) { _filename = filename; _procedure = procedure; _address = address; _original_value = original_value; _erroneous_value = erroneous_value; _output_error_magnitude = output_error_magnitude; _num_input_error_magnitude = num_input_error_magnitude; _str_input_error_magnitude = str_input_error_magnitude; _was_flagged = was_flagged; _was_error = was_error; _significance = significance; _threshold = threshold; }
public void GetDataSetsWithInitialCollection_ReturnsNullArray_IfNullArrayWasPassedAndThereWereNoDataToBeAppended() { //Arrange IEnumerable <AnalysisType> analysisTypes = new AnalysisType[] { AnalysisType.Quotations, AnalysisType.Prices }; AnalysisDataQueryDefinition queryDef = new AnalysisDataQueryDefinition(UTDefaulter.DEFAULT_ASSET_ID, UTDefaulter.DEFAULT_TIMEFRAME_ID) { AnalysisTypes = analysisTypes }; Mock <IQuotationRepository> quotationRepository = new Mock <IQuotationRepository>(); Mock <IPriceRepository> priceRepository = new Mock <IPriceRepository>(); IEnumerable <PriceDto> priceDtos = utf.getDefaultPriceDtosCollection(); quotationRepository.Setup(q => q.GetQuotations(queryDef)).Returns(new List <QuotationDto>()); priceRepository.Setup(p => p.GetPrices(queryDef)).Returns(priceDtos); //Act DataSet[] previous = new DataSet[] { }; IDataSetService service = new DataSetService(); service.InjectQuotationRepository(quotationRepository.Object); service.InjectPriceRepository(priceRepository.Object); var dataSets = service.GetDataSets(queryDef, previous).ToArray(); //Assert var isEmpty = (dataSets.Length == 0 || (dataSets.Length == 1 && dataSets[0] == null)); Assert.IsTrue(isEmpty); }
public static string GetAnalysisMenuQuestion(int theAnalysis, out double defaultValue) { defaultValue = 0; AnalysisType whichAnalysis = (AnalysisType)theAnalysis; switch (whichAnalysis) { case AnalysisType.FourierTransform: defaultValue = 2000; return("Please enter the cutoff frequency, in Hertz"); case AnalysisType.Synchronization: defaultValue = 2000; return("Please enter the cutoff frequency, in Hertz"); case AnalysisType.AutoCorrelation: defaultValue = 20; return("Please enter the cutoff delay, in milliseconds"); case AnalysisType.SpatialFrequency: return(""); case AnalysisType.PeriodHistogram: defaultValue = 10; return("Please enter the period, in milliseconds"); default: return(""); } }
public ActionResult CreateByDate(newAnalysis data) { Pacient pacient = db.pacients.Include(p => p.visits.Select(v => v.analysis)).Include(p => p.doctor).Where(p => p.ID == data.pacientID).FirstOrDefault(); if (pacient == null) { return(RedirectToAction("Index", "Pacients")); } VisitDate visit = pacient.visits.Where(v => v.date == data.initialDate).FirstOrDefault(); if (visit != null) { AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First(); data.analysis.type = type; visit.analysis.Add(data.analysis); db.SaveChanges(); return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis)); } else { AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First(); data.analysis.type = type; visit = new VisitDate(); visit.doctorID = pacient.doctor.ID; visit.date = data.initialDate; visit.analysis = new List <Analysis>(); visit.analysis.Add(data.analysis); pacient.visits.Add(visit); db.SaveChanges(); return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis)); } //return PartialView("/views/Assigment/pacientCreate.cshtml", data); }
public static void Get() { ImadHealthRepository <AnalysisResult> analysisresults = new madHealthRepository <AnalysisResult>(Help.Context); ImadHealthRepository <AnalysisType> analysistypes = new madHealthRepository <AnalysisType>(Help.Context); DataTable rawData = Help.OpenExcel("AnalysisResults"); int N = 1; foreach (DataRow row in rawData.Rows) { int oldId = Help.getInteger(row, 0); int typeID = Help.getInteger(row, 4); AnalysisType atype = analysistypes.Get().FirstOrDefault(x => x.Id == typeID); AnalysisResult result = new AnalysisResult() { Title = Help.getString(row, 1), Type = atype, Description = Help.getString(row, 3), Status = (AnalysisStatus)Help.getInteger(row, 2), AppointmentID = Help.getInteger(row, 5) }; N++; analysisresults.Insert(result); analysisresults.Commit(); Help.dicARes.Add(oldId, result.Id); } Console.WriteLine(N); }
public void GetDataSets_ReturnsEmptyCollection_IfThereIsNoQuotationForGivenDateRange() { //Arrange IEnumerable <AnalysisType> analysisTypes = new AnalysisType[] { AnalysisType.Quotations, AnalysisType.Prices }; AnalysisDataQueryDefinition queryDef = new AnalysisDataQueryDefinition(UTDefaulter.DEFAULT_ASSET_ID, UTDefaulter.DEFAULT_TIMEFRAME_ID) { AnalysisTypes = analysisTypes }; Mock <IQuotationRepository> quotationRepository = new Mock <IQuotationRepository>(); Mock <IPriceRepository> priceRepository = new Mock <IPriceRepository>(); IEnumerable <PriceDto> priceDtos = utf.getDefaultPriceDtosCollection(); quotationRepository.Setup(q => q.GetQuotations(queryDef)).Returns(new List <QuotationDto>()); priceRepository.Setup(q => q.GetPrices(queryDef)).Returns(priceDtos); //Act IDataSetService service = new DataSetService(); service.InjectQuotationRepository(quotationRepository.Object); service.InjectPriceRepository(priceRepository.Object); var dataSets = service.GetDataSets(queryDef); //Assert var isEmpty = (dataSets.Count() == 0); Assert.IsTrue(isEmpty); }
public override IEnumerable <Argument> GetArguments() { List <Argument> args = new List <Argument>(); args.Add(ArgumentHelper.ArgumentFactory(nameof(AnalysisType), AnalysisType.ToString())); args.Add(ArgumentHelper.ArgumentFactory(nameof(Response), Response)); args.Add(ArgumentHelper.ArgumentFactory(nameof(ResponseTransformation), ResponseTransformation)); args.Add(ArgumentHelper.ArgumentFactory(nameof(Dose), Dose)); args.Add(ArgumentHelper.ArgumentFactory(nameof(DoseScale), DoseScale.ToString())); args.Add(ArgumentHelper.ArgumentFactory(nameof(Offset), Offset)); args.Add(ArgumentHelper.ArgumentFactory(nameof(QCResponse), QCResponse)); args.Add(ArgumentHelper.ArgumentFactory(nameof(QCDose), QCDose)); args.Add(ArgumentHelper.ArgumentFactory(nameof(SamplesResponse), SamplesResponse)); args.Add(ArgumentHelper.ArgumentFactory(nameof(MinCoeff), MinCoeff)); args.Add(ArgumentHelper.ArgumentFactory(nameof(MaxCoeff), MaxCoeff)); args.Add(ArgumentHelper.ArgumentFactory(nameof(SlopeCoeff), SlopeCoeff)); args.Add(ArgumentHelper.ArgumentFactory(nameof(EDICCoeff), EDICCoeff)); args.Add(ArgumentHelper.ArgumentFactory(nameof(MinStartValue), MinStartValue)); args.Add(ArgumentHelper.ArgumentFactory(nameof(MaxStartValue), MaxStartValue)); args.Add(ArgumentHelper.ArgumentFactory(nameof(SlopeStartValue), SlopeStartValue)); args.Add(ArgumentHelper.ArgumentFactory(nameof(EDICStartValue), EDICStartValue)); args.Add(ArgumentHelper.ArgumentFactory(nameof(Equation), Equation)); args.Add(ArgumentHelper.ArgumentFactory(nameof(StartValues), StartValues)); args.Add(ArgumentHelper.ArgumentFactory(nameof(EquationYAxis), EquationYAxis)); args.Add(ArgumentHelper.ArgumentFactory(nameof(EquationXAxis), EquationXAxis)); return(args); }
public void LoadData(ArrayList xlist, ArrayList ylist, AnalysisType type) { xList = xlist; yList = ylist; if (type == AnalysisType.DIA_SYS_TYPE) { xLabel = "DIA"; yLabel = "SYS"; xUnit = "mmHg"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_SYS_TYPE) { xLabel = "Pulse"; yLabel = "SYS"; xUnit = "BPM"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_DIA_TYPE) { xLabel = "Pulse"; yLabel = "DIA"; xUnit = "BPM"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_MAP_TYPE) { xLabel = "Pulse"; yLabel = "MAP"; xUnit = "BPM"; yUnit = "mmHg"; } cart = new Statistics(xList, yList); InitDataToChart(); }
public void StoreResult <TResult>(AnalysisType type, TResult result) { lock (myResults) { myResults[type] = result; } }
/// <summary> /// /// </summary> /// <param name="p_equipments"></param> /// <param name="p_aroundStation"></param> /// <param name="p_analysisType"></param> /// <param name="p_IllegalSignal">专用于非法信号</param> public InterferedCalculateManage(List <ActivityEquipment> p_equipments, List <ActivitySurroundStation> p_aroundStation, AnalysisType p_analysisType) { this._equipments = p_equipments; this._aroundStation = p_aroundStation; this._analysisType = p_analysisType; CalcInterfereAnalyse(); }
//Method to set the state of the ComboBox Selection - for Analysis Type private void cboAnalysisType_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Check that an option has been selected //the selected index will be 0 if an option has been selected //if (cboAnalysisType.SelectedIndex == 1) { if (cboAnalysisType.SelectedIndex > 0) { if (cboAnalysisType.SelectedIndex == 1) { analysisType = AnalysisType.Summary; } if (cboAnalysisType.SelectedIndex == 2) { analysisType = AnalysisType.Count; } if (cboAnalysisType.SelectedIndex == 3) { analysisType = AnalysisType.Statistics; } } } }
private static void AddAnalysisResult(string projectInfoFile, AnalysisType resultType, string location) { ProjectInfo projectInfo = ProjectInfo.Load(projectInfoFile); projectInfo.AddAnalyzerResult(resultType, location); projectInfo.Save(projectInfoFile); }
private string GetBarName(AnalysisType analysisType, int value, int?nextValue) { switch (analysisType) { case AnalysisType.LowHighRate: case AnalysisType.OddEvenRate: return(TextConverter.Instance[(Rate)value]); case AnalysisType.SeriesCount: return(TextConverter.Instance.GetSeriesCountText(value)); case AnalysisType.Number: return(value.ToString()); default: if (nextValue.HasValue) { return(string.Format("{0} - {1}", value, nextValue - 1)); } else { return(string.Format("{0} - ", value)); } } }
public void GetDataSets_DoesntOverrideExistingObjectsWithNulls_IfTheyAreNotInSpecificRepositories() { //Arrange:QueryDef IEnumerable <AnalysisType> analysisTypes = new AnalysisType[] { AnalysisType.Prices }; AnalysisDataQueryDefinition queryDef = new AnalysisDataQueryDefinition(UTDefaulter.DEFAULT_ASSET_ID, UTDefaulter.DEFAULT_TIMEFRAME_ID) { AnalysisTypes = analysisTypes }; //Arrange:Quotations Mock <IQuotationRepository> quotationRepository = new Mock <IQuotationRepository>(); IEnumerable <QuotationDto> quotationDtos = new QuotationDto[] { utf.getQuotationDto(1), utf.getQuotationDto(2), utf.getQuotationDto(3), utf.getQuotationDto(4) }; quotationRepository.Setup(q => q.GetQuotations(queryDef)).Returns(quotationDtos); //Arrange:Prices Mock <IPriceRepository> priceRepository = new Mock <IPriceRepository>(); IEnumerable <PriceDto> priceDtos = new PriceDto[] { utf.getPriceDto(1), utf.getPriceDto(2), utf.getPriceDto(3), utf.getPriceDto(4) }; priceRepository.Setup(p => p.GetPrices(queryDef)).Returns(priceDtos); //Act IDataSetService service = new DataSetService(); service.InjectQuotationRepository(quotationRepository.Object); service.InjectPriceRepository(priceRepository.Object); var dataSets = service.GetDataSets(queryDef); if (dataSets == null) { throw new Exception("Collection should not be null"); } DataSet baseDataSet = dataSets.SingleOrDefault(ds => ds.IndexNumber == 2); if (baseDataSet == null) { throw new Exception("Base data set shouldn't be null"); } Price basePrice = (baseDataSet == null ? null : baseDataSet.GetPrice()); if (basePrice == null) { throw new Exception("Base price shouldn't be null"); } priceRepository.Setup(q => q.GetPrices(queryDef)).Returns(new PriceDto[] { }); service.InjectPriceRepository(priceRepository.Object); dataSets = service.GetDataSets(queryDef); DataSet comparedDataSet = dataSets.SingleOrDefault(ds => ds.IndexNumber == 2); Price comparedPrice = (comparedDataSet == null ? null : comparedDataSet.GetPrice()); //Assert var areTheSameObject = (basePrice == comparedPrice); Assert.IsTrue(areTheSameObject); }
public ActionResult DeleteConfirmed(int id) { AnalysisType analysisType = db.analysisTypes.Find(id); db.analysisTypes.Remove(analysisType); db.SaveChanges(); return(RedirectToAction("Index")); }
public TResult GetResult <TResult>(AnalysisType type) { lock (myResults) { myResults.TryGetValue(type, out var result); return((TResult)result); } }
public static Mock<IAnalyzer> generateMockAnalyzer(AssetTimeframe atf, AnalysisType type, DateTime? firstRequiredDate) { Mock<IAnalyzer> mock = new Mock<IAnalyzer>(); mock.Setup(q => q.getFirstRequiredDate()).Returns(firstRequiredDate); mock.Setup(q => q.getAssetTimeframe()).Returns(atf); mock.Setup(q => q.getAnalysisType()).Returns(type); return mock; }
/// <summary> /// /// </summary> /// <param name="p_equipments"></param> /// <param name="p_aroundStation"></param> /// <param name="p_analysisType"></param> /// <param name="p_IllegalSignal">专用于非法信号</param> public InterferedCalculateManage(List <ActivityEquipmentInfo> p_equipments, List <RoundStationInfo> p_aroundStation, AnalysisType p_analysisType, List <AnalysisResult> p_IllegalSignal = null) { this._equipments = p_equipments; this._aroundStation = p_aroundStation; this._analysisType = p_analysisType; this._illegalSignal = p_IllegalSignal; CalcInterfereAnalyse(); }
public static List<AnalysisType> createAnalysisTypeList(AnalysisType[] types) { List<AnalysisType> list = new List<AnalysisType>(); foreach (var type in types) { list.Add(type); } return list; }
public void SetAnalysisType(int tabIndex, AnalysisType type) { if (tabIndex < m_CustomBarCellList.Count) { Setting_CustomBarCellData cell = m_CustomBarCellList[tabIndex]; cell.AnalysisType = (int)type; IsDrty = true; } }
public AnalysisTypeModel Create(AnalysisType AType) { return(new AnalysisTypeModel() { Id = AType.Id, Title = AType.Title, Description = AType.Description }); }
/// <summary> /// /// </summary> /// <param name="equs">设备集合</param> /// <param name="aroundstation">周围台站集合</param> /// <param name="analysisType">非法信息</param> /// <returns></returns> public static InterferenceAnalysisResult Calculator(List <ActivityEquipment> equs, List <ActivitySurroundStation> aroundstation, AnalysisType analysisType) { ConvertToCalcCondition(equs, aroundstation); InterferenceAnalysisResult Interfresult = new InterferenceAnalysisResult(); if ((analysisType & AnalysisType.SameFreq) == AnalysisType.SameFreq) { //同频干扰计算 SameFreqCalculator samefreqCalc = new SameFreqCalculator(EquFreqs, StationFreqs); SameFreqCompareResult[] sameInterfResult = samefreqCalc.CalcSameFreqInterference(); if (sameInterfResult != null && sameInterfResult.Length > 0) { Interfresult.SameFreqInterfResult = sameInterfResult; Interfresult.SameFreqInterfResultCount = sameInterfResult.Length; } } if ((analysisType & AnalysisType.ADJFreq) == AnalysisType.ADJFreq) { //邻频干扰计算 AdjFreqCalculator adjfreqCalc = new AdjFreqCalculator(EquFreqs, StationFreqs); AdjFreqCompareResult[] adjInterfResult = adjfreqCalc.CalcAdjFreqInterference(); if (adjInterfResult != null && adjInterfResult.Length > 0) { Interfresult.ADJFreqInterfResult = adjInterfResult; Interfresult.ADJFreqInterfResultCount = adjInterfResult.Length; } } if ((analysisType & AnalysisType.IM) == AnalysisType.IM) { //互调干扰计算 IMOrder order = IMOrder.Second | IMOrder.Third | IMOrder.Fifth; IMAnalysisResult imresult = new IMAnalysisResult(); IMCalculator calculator = new IMCalculator(EquTransmitters, EquReceivers, StationTransmitters, StationReceivers); imresult.SetReceiverImResult(calculator.CalcReceiverIMInterference(order)); //imresult.SetTransmitterImResult(calculator.CalcTransmitterIMInterference()); if (imresult != null) { Interfresult.IMInterfResult = imresult; int transcount = 0; int receivcount = 0; if (imresult.GetReceiverImResult() != null && imresult.GetReceiverImResult().Values.Length > 0) { receivcount = imresult.GetReceiverImResult().Values.Length; } //if (imresult.GetTransmitterImResult() != null && imresult.GetTransmitterImResult().Values.Length > 0) //{ // transcount = imresult.GetTransmitterImResult().Values.Length; //} Interfresult.IMInterfResultCount = transcount + receivcount; } } return(Interfresult); }
public ActionResult Edit([Bind(Include = "ID,name")] AnalysisType analysisType) { if (ModelState.IsValid) { db.Entry(analysisType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(analysisType)); }
public void LoadData(DataTable dt, AnalysisType type) { xList = new ArrayList(); yList = new ArrayList(); if (type == AnalysisType.DIA_SYS_TYPE) { xLabel = "DIA"; yLabel = "SYS"; xUnit = "mmHg"; yUnit = "mmHg"; foreach (DataRow row in dt.Rows) { xList.Add(Convert.ToDouble(row["DIA"].ToString())); yList.Add(Convert.ToDouble(row["SYS"].ToString())); } } if (type == AnalysisType.PULSE_SYS_TYPE) { xLabel = "Pulse"; yLabel = "SYS"; xUnit = "BPM"; yUnit = "mmHg"; foreach (DataRow row in dt.Rows) { xList.Add(Convert.ToDouble(row["HeartRate"].ToString())); yList.Add(Convert.ToDouble(row["SYS"].ToString())); } } if (type == AnalysisType.PULSE_DIA_TYPE) { xLabel = "Pulse"; yLabel = "DIA"; xUnit = "BPM"; yUnit = "mmHg"; foreach (DataRow row in dt.Rows) { xList.Add(Convert.ToDouble(row["HeartRate"].ToString())); yList.Add(Convert.ToDouble(row["DIA"].ToString())); } } if (type == AnalysisType.PULSE_MAP_TYPE) { xLabel = "Pulse"; yLabel = "MAP"; xUnit = "BPM"; yUnit = "mmHg"; foreach (DataRow row in dt.Rows) { xList.Add(Convert.ToDouble(row["HeartRate"].ToString())); yList.Add(Convert.ToDouble(row["MAP"].ToString())); } } cart = new Statistics(xList, yList); InitDataToChart(); }
/// <summary> /// Method for displaying information vased on a valid option selected by the Administrator /// Will make the 'Summary' options available if selceted /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboAnalysisType_SelectionChanged(object sender, SelectionChangedEventArgs e) { //The selectedIndex will be 0 if an option is not selected if (cboAnalysisType.SelectedIndex > 0) { if (cboAnalysisType.SelectedIndex == 1) { analysisType = AnalysisType.Summary; } } }
private void AssertResultFileDoesNotExist(ProjectInfo projectInfo, AnalysisType resultType) { bool found = projectInfo.TryGetAnalyzerResult(resultType, out AnalysisResult result); if (found) { this.TestContext.AddResultFile(result.Location); } Assert.IsFalse(found, "Analysis result found unexpectedly. Result type: {0}", resultType); }
private void AssertResultFileDoesNotExist(ProjectInfo projectInfo, AnalysisType resultType) { var found = projectInfo.TryGetAnalyzerResult(resultType, out AnalysisResult result); if (found) { TestContext.AddResultFile(result.Location); } found.Should().BeFalse("Analysis result found unexpectedly. Result type: {0}", resultType); }
public ActionResult Create([Bind(Include = "ID,name")] AnalysisType analysisType) { if (ModelState.IsValid) { db.analysisTypes.Add(analysisType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(analysisType)); }
public static AnalysisWalker Generate(Document sourceFile, SemanticModel semanticModel, AnalysisResult result, AnalysisType type) { switch (type) { case AnalysisType.ConcurrencyUsage: return new ConcurrencyUsageWalker(sourceFile, semanticModel, (ConcurrencyUsageResult)result); case AnalysisType.AsyncAwaitAntiPatterns: return new AsyncAwaitAntiPatternsWalker(sourceFile, semanticModel, (AsyncAwaitAntiPatternsResult)result); default: throw new NotImplementedException(type.ToString()); } }
public static AnalysisResult Generate(AnalysisType type) { switch (type) { case AnalysisType.ConcurrencyUsage: return new ConcurrencyUsageResult(); case AnalysisType.AsyncAwaitAntiPatterns: return new AsyncAwaitAntiPatternsResult(); default: throw new NotImplementedException(type.ToString()); } }
protected OlapAxisLayoutSerializer() { EmptyDataString = string.Empty; CurrencyFormatString = OlapControl.__CurrencyFormatString; AxesLayout = new SerializedLayout(); SizeMode = SizeMode.Increase; _analysisType = AnalysisType.Grid; _AnalysisTypeWasset = false; SuppressSaveOLAPSlices = false; }
/// <summary> /// (Constructor) Adds various drawing Polygons. /// </summary> public SlopePlotCanvas( SlopeCanvas source ) { this.source = source; this.analysisType = source.AnalysisType; this.dpiX = source.DpiX; this.dpiY = source.DpiY; this.FilePath = source.FilePath; this.SizeChanged += new SizeChangedEventHandler( SlopePlotCanvas_SizeChanged ); // For zooming to a particular area zoomRect = new ZoomRect(); // Initialize material type list materialTypes = source.MaterialTypes; // Initialize list of FEA parameters feaParams = source.FEAParameters; // Initialize mesh substructs = new List<MaterialBlock>(); nodes = new List<feNode>(); deformedNodes = new List<feNode>(); triElements = new List<fe3NodedTriElement>(); deformedTriMesh = new List<fe3NodedTriElement>(); stressTriMesh = new List<fe3NodedTriElement>(); // Initialize disp vectors disp = new List<List<double>>(); dispVectors = new List<DisplacementVector>(); // Initialize plastic points plasticPoints = new List<PlasticPoint>(); // Initialize stress vectors sxxE = new List<double>(); syyE = new List<double>(); sxyE = new List<double>(); szzE = new List<double>(); fbarE = new List<double>(); sxxN = new List<double>(); syyN = new List<double>(); sxyN = new List<double>(); szzN = new List<double>(); fbarN = new List<double>(); // Intialize analysis phase selectedPhase = source.AnalysisPhases[1]; // Load mesh LoadNodeData(); LoadElementData(); }
public static string getTypeString(AnalysisType type) { string result = string.Empty; try { byTypes.TryGetValue(type, out result); return result; } catch (Exception) { return string.Empty; } }
public ActionResult InitializeSimulation(string pair, string timeframe) { //Restart simulation object. var service = this.ssf.GetService(); var types = new AnalysisType[] { AnalysisType.Price, AnalysisType.Trendline }; var result = service.Start(pair, timeframe, types); var json = new { pair = pair, timeframe = timeframe, result = result }; Debug.WriteLine(string.Format("+;Initializing simulation [{0}, {1}]", pair, timeframe)); return Json(json, JsonRequestBehavior.AllowGet); }
public IAnalyzer getAnalyzer(AnalysisType type, AssetTimeframe atf) { switch (type) { case AnalysisType.Price: return new PriceAnalyzer(atf); case AnalysisType.MACD: return new MacdAnalyzer(atf); case AnalysisType.ADX: return new AdxAnalyzer(atf); case AnalysisType.Candlestick: return new CandlestickAnalyzer(atf); case AnalysisType.Trendline: return new TrendlineAnalyzer(atf); case AnalysisType.Unknown: return null; default: return null; } }
public void getAnalyzers_returns_the_proper_analyzers_for_the_given_analysis_types() { AnalyzerFactory factory = AnalyzerFactory.Instance(); Asset asset = new Asset(1, "a"); Timeframe timeframe = Timeframe.GetTimeframe(TimeframeSymbol.M5); AnalysisType[] typesArr = new AnalysisType[] { AnalysisType.Price, AnalysisType.MACD, AnalysisType.Trendline }; IEnumerable<AnalysisType> types = new List<AnalysisType>(typesArr); var analyzers = factory.getAnalyzers(asset, timeframe, types); //Check number of items in result dictionary. Assert.AreEqual(typesArr.Length, analyzers.Count); //Check if Price analyzers is correctly set. try { IAnalyzer analyzer; analyzers.TryGetValue(AnalysisType.Price, out analyzer); Assert.IsTrue(typeof(IPriceAnalyzer).IsAssignableFrom(analyzer.GetType())); } catch (ArgumentNullException) { Assert.Fail("Price analyzer not found"); } //Check if MACD analyzers is correctly set. try { IAnalyzer analyzer; analyzers.TryGetValue(AnalysisType.MACD, out analyzer); Assert.IsTrue(typeof(IMacdAnalyzer).IsAssignableFrom(analyzer.GetType())); } catch (ArgumentNullException) { Assert.Fail("MACD analyzer not found"); } //Check if Trendline analyzers is correctly set. try { IAnalyzer analyzer; analyzers.TryGetValue(AnalysisType.Trendline, out analyzer); Assert.IsTrue(typeof(ITrendlineAnalyzer).IsAssignableFrom(analyzer.GetType())); } catch (ArgumentNullException) { Assert.Fail("Trendline analyzer not found"); } }
public void after_setup_properties_are_correctly_set() { Asset asset = new Asset(1, "USD"); Timeframe timeframe = Timeframe.GetTimeframe(TimeframeSymbol.M5); AnalysisType[] types = new AnalysisType[] { AnalysisType.Price }; Mock<IQuotationService> mockQuotationService = UnitTestTools.mockedQuotationService(); mockQuotationService.Setup(q => q.getLastCalculationDate(It.IsAny<string>(), It.IsAny<string>())).Returns(new DateTime()); var service = new ProcessService(asset, timeframe); service.Setup(types); Assert.AreEqual(service.getAsset(), asset); Assert.AreEqual(service.getTimeframe(), timeframe); }
private static void ExtractResult(List<App> apps, AnalysisType type, string fileName) { using (StreamWriter file = new StreamWriter(fileName)) { AnalysisResult temp = AnalysisResultFactory.Generate(type); file.WriteLine(App.ToStringColumns() + temp.ToStringColumns()); foreach (var app in apps) { string info = app.ToString(); if (app.Projects.Count() == 0) { info += temp; } else { var list = app.Projects.Where(p => p.AnalysisResults.Any(a => a.Type == type)) .Select(p => p.AnalysisResults.Single(a => a.Type == type)).ToList(); info += list.Any() ? list.Aggregate((x, y) => x + y) : temp; } file.WriteLine(info); } } }
/// <summary> /// Creates the list of project files to be analyzed. /// </summary> /// <param name="core"><see cref="T:StyleCopCore">Core object</see> that hosts the environment.</param> /// <param name="type">The analyze type being performed.</param> /// <returns>Returns the list of projects.</returns> internal static IList<CodeProject> GetProjectList(StyleCopCore core, AnalysisType type) { Param.AssertNotNull(core, "core"); Param.Ignore(type); // Create a list to store the list of code projects to be analyzed. List<CodeProject> codeProjects = new List<CodeProject>(); DTE applicationObject = GetDTE(); if (type == AnalysisType.Solution || type == AnalysisType.Project) { // Create a project enumerator for the correct VS project list. ProjectCollection enumerator = new ProjectCollection(); if (type == AnalysisType.Solution) { enumerator.SolutionProjects = applicationObject.Solution.Projects; } else { enumerator.SelectedProjects = (System.Collections.IEnumerable)applicationObject.ActiveSolutionProjects; } // Enumerate through the VS projects. foreach (Project project in enumerator) { if (project != null) { EnumerateProject( project, new ProjectInvoker(AddCodeProject), new ProjectItemInvoker(AddFileToProject), codeProjects, null); } } } else if (type == AnalysisType.Item || type == AnalysisType.Folder) { GetSelectedItemFiles(codeProjects); } else if (type == AnalysisType.File) { Document document = applicationObject.ActiveDocument; if (document != null) { CodeProject codeProject = null; string projectPath = GetProjectPath(document.ProjectItem.ContainingProject); if (projectPath != null) { codeProject = new CodeProject( projectPath.GetHashCode(), projectPath, GetProjectConfiguration(document.ProjectItem.ContainingProject)); } else if (document.FullName != null && document.FullName.Length > 0) { codeProject = new CodeProject( document.FullName.GetHashCode(), Path.GetDirectoryName(document.FullName), new StyleCop.Configuration(null)); } if (codeProject != null) { core.Environment.AddSourceCode(codeProject, document.FullName, document); codeProjects.Add(codeProject); } } } else { Debug.Fail("Unknown analysis type requested."); } return codeProjects; }
/// <summary> /// Determines whether the StyleCop menu items should be shown. /// </summary> /// <param name="helper">The analysis helper instance.</param> /// <param name="type">Indicates the type of solution artifacts to search.</param> /// <returns>The type of solution node selected.</returns> internal static bool SupportsStyleCop(AnalysisHelper helper, AnalysisType type) { Param.Ignore(helper, type); DTE applicationObject = GetDTE(); if (type == AnalysisType.Solution || type == AnalysisType.Project) { // Create a project enumerator for the correct VS project list. ProjectCollection enumerator = new ProjectCollection(); if (type == AnalysisType.Solution) { enumerator.SolutionProjects = applicationObject.Solution.Projects; } else { enumerator.SelectedProjects = (System.Collections.IEnumerable)applicationObject.ActiveSolutionProjects; } // Enumerate through the VS projects. foreach (Project project in enumerator) { if (project != null) { if (EnumerateProject( project, new ProjectInvoker(IsKnownProjectTypeVisitor), new ProjectItemInvoker(IsKnownFileTypeVisitor), helper, null) != null) { return true; } } } } else if (type == AnalysisType.Item || type == AnalysisType.Folder) { if (AreSelectedFilesKnownFileTypes(helper)) { return true; } } else if (type == AnalysisType.File) { Document document = applicationObject.ActiveDocument; if (document != null && !string.IsNullOrEmpty(document.FullName)) { string fileExtension = Path.GetExtension(document.FullName); if (fileExtension.Length > 0 && fileExtension.StartsWith(".", StringComparison.Ordinal)) { fileExtension = fileExtension.Substring(1, fileExtension.Length - 1); } if (IsKnownFileExtension(fileExtension, helper.Core)) { return true; } } } return false; }
/// <summary> /// Sets the active ProjectItem to Excluded or not. /// </summary> /// <param name="type">Type of analysis.</param> /// <param name="value">The value to set it to.</param> /// <returns>True if we've been able to set the value.</returns> internal static bool SetItemExcluded(AnalysisType type, bool value) { Param.Ignore(type); DTE applicationObject = GetDTE(); if (type == AnalysisType.Solution || type == AnalysisType.Project || type == AnalysisType.Folder) { return false; } if (type == AnalysisType.Item) { // Check whether there are any selected files. if (applicationObject.SelectedItems.Count == 1) { foreach (SelectedItem selectedItem in applicationObject.SelectedItems) { if (selectedItem.ProjectItem != null && selectedItem.ProjectItem.ContainingProject != null) { return SetProjectItemExcluded(selectedItem.ProjectItem, value); } return false; } } return false; } if (type == AnalysisType.File) { Document document = applicationObject.ActiveDocument; if (document != null && !string.IsNullOrEmpty(document.FullName)) { return SetProjectItemExcluded(document.ProjectItem, value); } } return false; }
/// <summary> /// Determines whether the StyleCop menu items should be shown. /// </summary> /// <param name="helper">The analysis helper instance.</param> /// <param name="type">Indicates the type of solution artifacts to search.</param> /// <returns>The type of solution node selected.</returns> internal static bool SupportsStyleCop(AnalysisHelper helper, AnalysisType type) { Param.Ignore(helper, type); DTE applicationObject = GetDTE(); if (type == AnalysisType.Solution || type == AnalysisType.Project) { // Create a project enumerator for the correct VS project list. ProjectCollection enumerator = new ProjectCollection(); if (type == AnalysisType.Solution) { enumerator.SolutionProjects = applicationObject.Solution.Projects; } else { enumerator.SelectedProjects = (IEnumerable)applicationObject.ActiveSolutionProjects; } // Enumerate through the VS projects. foreach (Project project in enumerator) { if (project != null) { // If we've already cached a value for whether this project supports StyleCop, use it, since it is very // expensive to constantly scan massive unmanaged project trees through COM. This used to render Visual // Studio unusable in largely unmanaged solutions (#6662). bool isEnabled; if (ProjectEnabledCache.ContainsKey(project.UniqueName)) { isEnabled = ProjectEnabledCache[project.UniqueName]; } else { isEnabled = EnumerateProject(project, IsKnownProjectTypeVisitor, IsKnownFileTypeVisitor, helper, null) != null; ProjectEnabledCache.Add(project.UniqueName, isEnabled); } if (isEnabled) { return true; } } } return false; } else if (type == AnalysisType.Item || type == AnalysisType.Folder) { if (AreSelectedFilesKnownFileTypes(helper)) { return true; } } else if (type == AnalysisType.File) { Document document = applicationObject.ActiveDocument; if (document != null && !string.IsNullOrEmpty(document.FullName)) { string fileExtension = Path.GetExtension(document.FullName); if (fileExtension.Length > 0 && fileExtension.StartsWith(".", StringComparison.Ordinal)) { fileExtension = fileExtension.Substring(1, fileExtension.Length - 1); } if (IsKnownFileExtension(fileExtension, helper.Core)) { return true; } } } return false; }
private Mock<IQuotationService> mockedQuotationService(AssetTimeframe atf, DateTime lastAnalysisDate, AnalysisType type) { Mock<IQuotationService> obj = new Mock<IQuotationService>(); obj.Setup(mqs => mqs.getLastCalculationDate(atf, type)).Returns(lastAnalysisDate); return obj; }
/// <summary> /// Gathers the list of files to analyze and kicks off the worker thread. /// </summary> /// <param name="full">True if a full analyze should be performed.</param> /// <param name="type">Type of files that should be analyzed.</param> internal void Analyze(bool full, AnalysisType type) { Param.Ignore(full, type); StyleCopTrace.In(full, type); // Save any documents that have been changed. if (this.SaveOpenDocuments()) { // Get the list of projects to be analyzed. // Depending on the AnalysisType we: //// 1. analyze all the files in the solution/project/folder //// 2. analyze the selected file in the solution browser/code pane //// 3. If its a single file we may still analyze multiple files. We do this if the selected file has a dependancy on another file. //// so if you analyze a designer.cs file we actually analyze the parent file and all its dependants. //// This is generally because we can only be sure of issues relating to partial //// types if we have all the partial types to check against. IList<CodeProject> projects = ProjectUtilities.GetProjectList(this.core, type, out this.analysisFilePath, this); this.analysisType = type; this.ClearEnvironmentPriorToAnalysis(); this.SignalAnalysisStarted(); this.violationCount = 0; if (projects.Count == 0) { this.NoFilesToAnalyze(); } else { AnalysisThread analyze = new AnalysisThread(full, projects, this.core); analyze.Complete += this.AnalyzeComplete; System.Threading.Thread thread = new System.Threading.Thread(analyze.AnalyzeProc); if (thread != null) { thread.IsBackground = true; this.violations = new List<ViolationInfo>(); thread.Start(); } } } StyleCopTrace.Out(); }
public AnalysisChart(DataTable dt, AnalysisType type) { InitializeComponent(); LoadData(dt,type); }
public void LoadData(ArrayList xlist,ArrayList ylist, AnalysisType type) { xList = xlist; yList = ylist; if (type == AnalysisType.DIA_SYS_TYPE) { xLabel = "DIA"; yLabel = "SYS"; xUnit = "mmHg"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_SYS_TYPE) { xLabel = "Pulse"; yLabel = "SYS"; xUnit = "BPM"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_DIA_TYPE) { xLabel = "Pulse"; yLabel = "DIA"; xUnit = "BPM"; yUnit = "mmHg"; } if (type == AnalysisType.PULSE_MAP_TYPE) { xLabel = "Pulse"; yLabel = "MAP"; xUnit = "BPM"; yUnit = "mmHg"; } cart = new Statistics(xList, yList); InitDataToChart(); }
/// <summary> /// Creates the list of project files to be analyzed. /// </summary> /// <param name="core"><see cref="T:StyleCopCore">Core object</see> that hosts the environment.</param> /// <param name="type">The analyze type being performed.</param> /// <param name="analysisFilePath">The path to the initial file we are analyzing.</param> /// <param name="analysisHelper">The analysis helper.</param> /// <returns>Returns the list of projects.</returns> internal static IList<CodeProject> GetProjectList(StyleCopCore core, AnalysisType type, out string analysisFilePath, AnalysisHelper analysisHelper) { Param.AssertNotNull(core, "core"); Param.Ignore(type); // Create a list to store the list of code projects to be analyzed. List<CodeProject> codeProjects = new List<CodeProject>(); DTE applicationObject = GetDTE(); analysisFilePath = null; switch (type) { case AnalysisType.Project: case AnalysisType.Solution: // Create a project enumerator for the correct VS project list. ProjectCollection enumerator = new ProjectCollection(); if (type == AnalysisType.Solution) { enumerator.SolutionProjects = applicationObject.Solution.Projects; } else { enumerator.SelectedProjects = (IEnumerable)applicationObject.ActiveSolutionProjects; } // Enumerate through the VS projects. foreach (Project project in enumerator) { // We continue if we know the project type or if its a misc item or a solution folder if (project != null && (IsKnownProjectType(project, analysisHelper) || project.Kind == Constants.vsProjectKindMisc || project.Kind == Constants.vsProjectKindSolutionItems)) { EnumerateProject(project, AddCodeProject, AddFileToProject, codeProjects, null); } } break; case AnalysisType.Folder: case AnalysisType.Item: analysisFilePath = GetSelectedItemFiles(codeProjects); break; case AnalysisType.File: var document = applicationObject.ActiveDocument; if (document != null) { CodeProject codeProject = null; string projectPath = GetProjectPath(document.ProjectItem.ContainingProject); if (projectPath != null) { codeProject = new CodeProject(projectPath.GetHashCode(), projectPath, GetProjectConfiguration(document.ProjectItem.ContainingProject), TargetFrameworkVersion(document.ProjectItem.ContainingProject)); } else if (!string.IsNullOrEmpty(document.FullName)) { codeProject = new CodeProject(document.FullName.GetHashCode(), Path.GetDirectoryName(document.FullName), new StyleCop.Configuration(null)); } if (codeProject != null) { // If this is a designer.cs file (and so a dependant of another file) then we need to add it but also its parent and siblings. analysisFilePath = document.FullName; var allFilesForProjectItem = GetAllFilesForProjectItem(document.ProjectItem); foreach (var path in allFilesForProjectItem) { core.Environment.AddSourceCode(codeProject, path, null); } codeProjects.Add(codeProject); } } break; default: Debug.Fail("Unknown analysis type requested."); break; } return codeProjects; }
/// <summary> /// Initializes a new instance of the <see cref="BaseAnalysisHandler"/> class. /// </summary> /// <param name="fullAnalysis">Set to true if StyleCop should run a full analysis, false otherwise.</param> /// <param name="analysisType">The type of analysis this class will run.</param> protected BaseAnalysisHandler(bool fullAnalysis, AnalysisType analysisType) { this.FullAnalysis = fullAnalysis; this.TypeOfAnalysis = analysisType; }
/// <summary> /// Initializes a new instance of the <see cref="BaseAnalysisHandler"/> class. /// </summary> /// <param name="analysisType">The type of analysis this class will run.</param> protected BaseAnalysisHandler(AnalysisType analysisType) : this(false, analysisType) { }
public TimeSeriesOptions() { analysisType = AnalysisType.TimeSeries; InitializeComponent(); this.aggregateOptions1.AggregateTypeChanged += new EventHandler<EventArgs>(aggregateOptions1_AggregateTypeChanged); }
public AnalysisChart(ArrayList xlist, ArrayList ylist, AnalysisType type) { InitializeComponent(); LoadData(xlist, ylist, type); }
/// <summary> /// Determines whether the selected item is included in StyleCop analysis. /// </summary> /// <param name="helper">The analysis helper instance.</param> /// <param name="type">Indicates the type of solution artifacts to search.</param> /// <returns>True if the selected item would be included in analysis.</returns> internal static bool IsItemIncluded(AnalysisHelper helper, AnalysisType type) { Param.Ignore(helper, type); DTE applicationObject = GetDTE(); if (type == AnalysisType.Solution || type == AnalysisType.Project || type == AnalysisType.Folder) { return true; } if (type == AnalysisType.Item) { // Check whether there are any selected files. // More than 1 selected we just return true if (applicationObject.SelectedItems.Count == 0 || applicationObject.SelectedItems.Count > 1) { return true; } foreach (SelectedItem selectedItem in applicationObject.SelectedItems) { if (selectedItem.ProjectItem != null && selectedItem.ProjectItem.ContainingProject != null) { return CheckProjectItemIsIncluded(selectedItem.ProjectItem); } return true; } return false; } if (type == AnalysisType.File) { Document document = applicationObject.ActiveDocument; if (document != null && !string.IsNullOrEmpty(document.FullName)) { return CheckProjectItemIsIncluded(document.ProjectItem); } } return false; }
/// <summary> /// Attempts to locate a code editor document for the given file within the given project. /// </summary> /// <param name="projectItem">The project item to operate on.</param> /// <param name="path">The path to the project item.</param> /// <param name="analysisType">The type of analysis being completed.</param> /// <param name="projectContext">The project context.</param> /// <param name="fileContext">Contains the path to the file.</param> /// <returns>Returns the document for the given file if found.</returns> internal static object OpenCodeEditor(ProjectItem projectItem, string path, AnalysisType analysisType, ref object projectContext, ref object fileContext) { Param.AssertNotNull(projectItem, "projectItem"); Param.AssertValidString(path, "path"); Param.Ignore(projectContext); Param.AssertNotNull(fileContext, "fileContext"); string filePath = (string)fileContext; if (path == filePath) { projectItem.Open(Constants.vsViewKindCode); return projectItem.Document; } return null; }