예제 #1
0
        private string BuildUrl(IAnalysisData data)
        {
            var path    = this.GetUrlPath(data);
            var encoded = Uri.EscapeUriString(path);

            return(string.Format("code://{0}", encoded));
        }
예제 #2
0
        private static string GetText(IAnalysisData data)
        {
            var method = data as MethodData;

            if (method == null)
            {
                return(data.Name);
            }

            var property = method.DeclaringMember as PropertyData;

            if (property != null)
            {
                if (method == property.Getter)
                {
                    return("get");
                }

                if (method == property.Setter)
                {
                    return("set");
                }
            }

            return(data.Name);
        }
예제 #3
0
 private static AnalysisDataNode ToNode(IAnalysisData data)
 {
     return new AnalysisDataNode(
         data,
         data.Members.Select(member => ToNode(member))
                     .OrderBy(node => node)
     );
 }
예제 #4
0
 private string GetUrlPath(IAnalysisData data)
 {
     return(Switch.Type(data).To <string>()
            .Case <AssemblyData>(a => a.Assembly.FullName)
            .Case <TypeData>(t => t.Inner.AssemblyQualifiedName)
            .Case <IMemberData>(m => m.Inner.ToString())
            .Result);
 }
예제 #5
0
 private static AnalysisDataNode ToNode(IAnalysisData data)
 {
     return(new AnalysisDataNode(
                data,
                data.Members.Select(member => ToNode(member))
                .OrderBy(node => node)
                ));
 }
        private void SaveAnalysisData(IAnalysisData <IAnalysisDataRow> ad, AnalysisInformation ai)
        {
            var xArray = ad.Data.Select(d => d.X).ToArray();
            var yArray = ad.Data.Select(d => d.Y).ToArray();

            var adEntity = new AnalysisData(ad.XMeaning, xArray, ad.YMeaning, yArray, ai, this.controller);

            adEntity.Save();
        }
예제 #7
0
        public CommonAnalysisDataPage(IAnalysisLogicService analysisLogicService, IAnalysisData <IAnalysisDataRow> modelAnalysisData)
        {
            this.analysisLogicService = analysisLogicService;

            this.analysisData = analysisLogicService.GetAdjustedData(modelAnalysisData);

            InitializeComponent();

            InitializeContent();
        }
예제 #8
0
        public IAnalysisData <IAdjustedDataRow> GetAdjustedData(IAnalysisData <IAnalysisDataRow> rawAnalysisModel)
        {
            //Returns X, Y and Y^ - adjusted Y.

            var fullAnalysis = (FullAnalysis <IAnalysisDataRow>)rawAnalysisModel;

            var analysisInfo = controller.GetEntityById <AnalysisInformation>(fullAnalysis.DatabaseId);
            var analysisData = analysisInfo.Data;

            var xdata = rawAnalysisModel.Data.Select(d => d.X).ToArray();
            var ydata = rawAnalysisModel.Data.Select(d => d.Y).ToArray();

            var businessLogicObject = new LinearRegression.BusinessLogic.Regression(xdata.ToList(), ydata.ToList());

            var adjustedYValues = new List <double>();

            //Checking if we already have this data in the database.
            if (controller.GetEntityById <AnalysisInformation>(fullAnalysis.DatabaseId) != null)
            {
                try
                {
                    //If we have this data, try to get the adjusted Y values from the analysis calculations.
                    adjustedYValues = analysisData.AnalysisCalculations.AdjustedY.ToList();
                }
                catch (Exception)
                {
                    //If we can't get the already calculated adjusted values, calculate them.
                    adjustedYValues = businessLogicObject.GetAdjustedYsValues();
                }
            }
            else
            {
                //Else if we don't have the data calculate the adjusted Y values.
                adjustedYValues = businessLogicObject.GetAdjustedYsValues();
            }


            int iterator = 0;

            var adjustedDataRows = new ObservableCollection <IAdjustedDataRow>();

            foreach (var row in rawAnalysisModel.Data)
            {
                adjustedDataRows.Add(new AdjustedDataRow(row.Index, row.X, row.Y, adjustedYValues[iterator]));
                iterator++;
            }

            var adjustedAnalysis = new AdjustedAnalysis(rawAnalysisModel.XMeaning, rawAnalysisModel.YMeaning, adjustedDataRows);

            return(adjustedAnalysis);
        }
예제 #9
0
        private bool PassesFilter(IAnalysisData data, HashSet <IMemberData> filtered)
        {
            var member = data as IMemberData;

            if (member == null)
            {
                return(false);
            }

            if (this.filter == null)
            {
                return(true);
            }

            return(filtered.Contains(member));
        }
예제 #10
0
        public static ImageSource SelectFor(IAnalysisData data)
        {
            var info = selectInfo(data);

            return icons[info.GetIconName()];
        }
예제 #11
0
        public IAnalysisData Perform(IAnalysisData data)
        {
            var points = data.PointSets.Select(Shifted).ToArray();

            return(new AnalysisData(data.XUnit, data.YUnit, points));
        }
예제 #12
0
        public static ImageSource SelectFor(IAnalysisData data)
        {
            var info = selectInfo(data);

            return(icons[info.GetIconName()]);
        }
예제 #13
0
 private static ImageSource GetIcon(IAnalysisData data)
 {
     return(NodeIcon.SelectFor(data));
 }
예제 #14
0
 public AnalysisDataNode(IAnalysisData data, IEnumerable <AnalysisDataNode> childNodes)
     : base(GetText(data), GetIcon(data), childNodes.Cast <CodeTreeNode>())
 {
     this.Data = data;
 }
예제 #15
0
 private IAnalysisData Analyzed(IAnalysisData data)
 {
     return(_operation is null ? data : _operation.Perform(data));
 }
예제 #16
0
 private bool AnyDescendantPassesFilter(IAnalysisData data, HashSet <IMemberData> filtered)
 {
     return(data.Members.Any(member => PassesFilter(member, filtered) || AnyDescendantPassesFilter(member, filtered)));
 }
예제 #17
0
        private bool PassesFilter(IAnalysisData data, HashSet<IMemberData> filtered)
        {
            var member = data as IMemberData;
            if (member == null)
                return false;

            if (this.filter == null)
                return true;

            return filtered.Contains(member);
        }
예제 #18
0
 private bool AnyDescendantPassesFilter(IAnalysisData data, HashSet<IMemberData> filtered)
 {
     return data.Members.Any(member => PassesFilter(member, filtered) || AnyDescendantPassesFilter(member, filtered));
 }