public TypeMeasureWidget(TypeMeasure typeMeasure) { xmlTypeMeasureWidget = new Glade.XML(null, "measures.glade", "table3", null); xmlTypeMeasureWidget.Autoconnect(this); linesPerMethod.Text = typeMeasure.LinesPerMethod.ToString(); parametersPerMethod.Text = typeMeasure.ParametersPerMethod.ToString(); maxLinesInMethod.Text = typeMeasure.MaxLinesInMethod.ToString(); maxParametersInMethod.Text = typeMeasure.MaxParametersInMethod.ToString(); numberOfFields.Text = typeMeasure.Fields.ToString(); }
public TypeMeasureWidget (TypeMeasure typeMeasure) { xmlTypeMeasureWidget = new Glade.XML (null,"measures.glade", "table3", null); xmlTypeMeasureWidget.Autoconnect (this); linesPerMethod.Text = typeMeasure.LinesPerMethod.ToString (); parametersPerMethod.Text = typeMeasure.ParametersPerMethod.ToString (); maxLinesInMethod.Text = typeMeasure.MaxLinesInMethod.ToString (); maxParametersInMethod.Text = typeMeasure.MaxParametersInMethod.ToString (); numberOfFields.Text = typeMeasure.Fields.ToString (); }
public Measure this[TypeMeasure typeMeasure] { get { return(FindByTypeMeasure(typeMeasure)); } set { Measure measure = FindByTypeMeasure(typeMeasure); measure = measure ? measure : value; } }
public void MethodWithThreeparameterTest() { IEnumerable results = measureFinder.FindByNumberOfParameters(measures, 3); IEnumerator resultEnumerator = results.GetEnumerator(); Assert.IsNotNull(results); Assert.AreEqual(1, ((ICollection)results).Count); Assert.IsTrue(resultEnumerator.MoveNext()); TypeMeasure typeMeasure = (TypeMeasure)resultEnumerator.Current; Assert.AreEqual(2, ((ICollection)typeMeasure.MethodMeasures).Count); }
public void SetValueMeasure(TypeMeasure typeMeasure, float value) { Measure measure = Measures[typeMeasure]; if (measure != null) { measure.SetValue(value); } else { Debug.LogError(typeMeasure + " отсуствует на машине."); } }
public void CountMethodMeasureTest() { measures = measureCalculator.ProcessMeasures(assembly); IEnumerator measureEnumerator = measures.GetEnumerator(); IEnumerator typeEnumerator = assembly.MainModule.Types.GetEnumerator(); while (measureEnumerator.MoveNext() && typeEnumerator.MoveNext()) { TypeDefinition type = (TypeDefinition)typeEnumerator.Current; TypeMeasure typeMeasure = (TypeMeasure)measureEnumerator.Current; Assert.AreEqual(type.Methods.Count, ((ICollection)typeMeasure.MethodMeasures).Count); } }
private Measure FindByTypeMeasure(TypeMeasure typeMeasure) { Measure measure = null; for (int i = 0; i < Items.Count; i++) { if (Items[i].TypeMeasure == typeMeasure) { measure = Items[i]; } } return(measure); }
private MethodMeasure FindMethodMeasure(string type, string method, string parameters) { TypeMeasure typeMeasure = FindTypeMeasure(type); foreach (MethodMeasure methodMeasure in typeMeasure.MethodMeasures) { if (String.Compare(methodMeasure.Name, method) == 0 && String.Compare(methodMeasure.GetParameters(), parameters) == 0) { return(methodMeasure); } } return(null); }
public Visualizer CreateVisualizer(TypeMeasure visType, Unit visUnit) { var assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (var assembly in assemblies) { var assemblyTypes = assembly.GetTypes(); foreach (var type in assemblyTypes) { if (typeof(Visualizer).IsAssignableFrom(type) && type.IsDefined(typeof(SensorAttribut), true)) { var attribut = (SensorAttribut)Attribute.GetCustomAttribute(type, typeof(SensorAttribut)); if (attribut.type == visType) { return((Visualizer)Activator.CreateInstance(type)); } } } } return(null); }
internal static void ToDraw(int[] time, double[] valEntry, double[] valAlgo, TypeAction ta, TypeMeasure tm) { _npSurface.Clear(); _npSurface.Title = $"{tm} : {ta}"; _npSurface.BackColor = Color.White; NPlot.Grid grid = new NPlot.Grid(); _npSurface.Add(grid, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); if (tm == TypeMeasure.Distance) { NPlot.LinePlot plot = new NPlot.LinePlot(); plot.AbscissaData = time; plot.DataSource = valAlgo; plot.Label = "Algorithm"; plot.Color = Color.Blue; _npSurface.Add(plot, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); } else { NPlot.LinePlot plotAlgo = new NPlot.LinePlot(); NPlot.LinePlot plotEntry = new NPlot.LinePlot(); plotAlgo.AbscissaData = time; plotAlgo.DataSource = valAlgo; plotAlgo.Label = "Algorithm"; plotAlgo.Color = Color.Blue; _npSurface.Add(plotAlgo, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); plotEntry.AbscissaData = time; plotEntry.DataSource = valEntry; plotEntry.Label = "Entry"; plotEntry.Color = Color.Red; _npSurface.Add(plotEntry, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Left); } _npSurface.XAxis1.Label = "Time"; _npSurface.XAxis1.NumberFormat = "{0:##0}"; _npSurface.XAxis1.LabelFont = AxisFont; _npSurface.XAxis1.TickTextFont = TickFont; _npSurface.YAxis1.Label = $"{tm}"; _npSurface.YAxis1.NumberFormat = "{0:##0.0}"; _npSurface.YAxis1.LabelFont = AxisFont; _npSurface.YAxis1.TickTextFont = TickFont; NPlot.Legend npLegend = new NPlot.Legend(); npLegend.AttachTo(NPlot.PlotSurface2D.XAxisPosition.Top, NPlot.PlotSurface2D.YAxisPosition.Right); npLegend.VerticalEdgePlacement = NPlot.Legend.Placement.Inside; npLegend.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside; npLegend.BorderStyle = NPlot.LegendBase.BorderType.Line; _npSurface.Legend = npLegend; _npSurface.Refresh(); try { if (!Directory.Exists(Path)) { DirectoryInfo di = Directory.CreateDirectory(Path); Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(Path)); } var files = Directory.GetFiles($"{Path}/", $"*plot-{ta}-{tm}*.png"); _npSurface.Bitmap.Save($"{Path}/plot-{ta}-{tm}-{files.Length}.png"); } catch (Exception e) { Console.WriteLine("The process failed: {0}", e.ToString()); } }
public SensorAttribut(Unit unit, TypeMeasure type) { this.unit = unit; this.type = type; }
public TypeMeasure MeasureType (TypeDefinition type) { TypeMeasure typeMeasure = new TypeMeasure (type); typeMeasure.LinesPerMethod = CalculateLinesPerMethod (type); typeMeasure.ParametersPerMethod = CalculateParametersPerMethod (type); typeMeasure.MaxLinesInMethod = CalculateMaxLinesInMethod (type); typeMeasure.MaxParametersInMethod = CalculateMaxParametersInMethod (type); typeMeasure.Fields = CountFields (type); return typeMeasure; }