private string BuildUrl(IAnalysisData data)
        {
            var path    = this.GetUrlPath(data);
            var encoded = Uri.EscapeUriString(path);

            return(string.Format("code://{0}", encoded));
        }
        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);
        }
 private static AnalysisDataNode ToNode(IAnalysisData data)
 {
     return new AnalysisDataNode(
         data,
         data.Members.Select(member => ToNode(member))
                     .OrderBy(node => node)
     );
 }
 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);
 }
 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();
        }
Exemple #7
0
        public CommonAnalysisDataPage(IAnalysisLogicService analysisLogicService, IAnalysisData <IAnalysisDataRow> modelAnalysisData)
        {
            this.analysisLogicService = analysisLogicService;

            this.analysisData = analysisLogicService.GetAdjustedData(modelAnalysisData);

            InitializeComponent();

            InitializeContent();
        }
Exemple #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);
        }
        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));
        }
Exemple #10
0
        public static ImageSource SelectFor(IAnalysisData data)
        {
            var info = selectInfo(data);

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

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

            return(icons[info.GetIconName()]);
        }
 private static ImageSource GetIcon(IAnalysisData data)
 {
     return(NodeIcon.SelectFor(data));
 }
 public AnalysisDataNode(IAnalysisData data, IEnumerable <AnalysisDataNode> childNodes)
     : base(GetText(data), GetIcon(data), childNodes.Cast <CodeTreeNode>())
 {
     this.Data = data;
 }
Exemple #15
0
 private IAnalysisData Analyzed(IAnalysisData data)
 {
     return(_operation is null ? data : _operation.Perform(data));
 }
 private bool AnyDescendantPassesFilter(IAnalysisData data, HashSet <IMemberData> filtered)
 {
     return(data.Members.Any(member => PassesFilter(member, filtered) || AnyDescendantPassesFilter(member, filtered)));
 }
        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);
        }
 private bool AnyDescendantPassesFilter(IAnalysisData data, HashSet<IMemberData> filtered)
 {
     return data.Members.Any(member => PassesFilter(member, filtered) || AnyDescendantPassesFilter(member, filtered));
 }