Пример #1
0
        internal static void Main(string[] args)
        {
            var analysisSystem = new FoodAnalysis();
            var service        = new AnalysisService <Person, Meal>(analysisSystem);

            var results = service.Run();

            foreach (var result in results)
            {
                //Console.WriteLine(result.Scenario);
                //Console.WriteLine(result.Outcome);
                //switch (result.Result)
                //{
                //    case ResultStatus.Success:
                //        Console.WriteLine("It was a good choice");
                //        break;
                //    case ResultStatus.Failure:
                //        Console.WriteLine("It was a bad choice");
                //        break;
                //    case ResultStatus.Inconclusive:
                //        Console.WriteLine("They are indifferent on their decision");
                //        break;
                //    default:
                //        throw new ArgumentOutOfRangeException();
                //}
                Log.Write(result);
                Log.Write(string.Join(string.Empty, Enumerable.Repeat("-", 10)));
            }

            Console.WriteLine("Analysis Complete");
            Console.ReadLine();
        }
Пример #2
0
        //FIXME: rate-limit this, so we don't send multiple new documents while it's processing
        void OnDocumentParsed(object sender, EventArgs args)
        {
            var doc      = Document.ParsedDocument;
            var treeType = new RuleTreeType("ParsedDocument", Path.GetExtension(doc.FileName));

            AnalysisService.QueueAnalysis(doc, treeType, UpdateResults);
        }
        private async void OnCreateGraph()
        {
            IsReady = false;

            Save();

            var request = new AnalysisRequest
            {
                Spec = Document.Text,
                PackagesToAnalyze = PackagesToAnalyze != null?PackagesToAnalyze.ToArray() : null,
                                        OutputFile    = Path.GetTempFileName(),
                                        UsedTypesOnly = UsedTypesOnly,
                                        AllEdges      = AllEdges,
                                        CreateClustersForNamespaces = CreateClustersForNamespaces
            };

            try
            {
                myCTS = new CancellationTokenSource();

                var doc = await AnalysisService.Analyse(request, myCTS.Token);

                myCTS = null;

                if (doc != null)
                {
                    BuildGraph(doc);
                }
            }
            finally
            {
                IsReady = true;
            }
        }
 public DocumentFormattingHandler(ILoggerFactory factory, AnalysisService analysisService, ConfigurationService configurationService, WorkspaceService workspaceService)
 {
     _logger               = factory.CreateLogger <DocumentFormattingHandler>();
     _analysisService      = analysisService;
     _configurationService = configurationService;
     _workspaceService     = workspaceService;
 }
        //FIXME: rate-limit this, so we don't send multiple new documents while it's processing
        void OnDocumentParsed(object sender, EventArgs args)
        {
            if (!QuickTaskStrip.EnableFancyFeatures)
            {
                return;
            }
            var doc = Document.ParsedDocument;

            if (doc == null)
            {
                return;
            }
            if (src != null)
            {
                src.Cancel();
                try {
                    oldTask.Wait();
                } catch (AggregateException ex) {
                    ex.Handle(e => e is TaskCanceledException);
                }
            }
            src = new CancellationTokenSource();
            var treeType = new RuleTreeType("Document", Path.GetExtension(doc.FileName));
            var task     = AnalysisService.QueueAnalysis(Document, treeType, src.Token);

            oldTask = task.ContinueWith(t => new ResultsUpdater(this, t.Result, src.Token).Update(), src.Token);
        }
Пример #6
0
        /// <summary>
        /// 定时查询服务器监听timer
        /// </summary>
        /// <param name="sender">timer对象</param>
        /// <param name="e">事件参数信息</param>
        private void connectTimer_Elapsed(Object sender, ElapsedEventArgs e)
        {
            // 每2秒从服务器获取更新数据并推送至界面显示
            try
            {
                Stream          resultStream = GetResponseMessage();
                List <UserInfo> userInfoList = AnalysisService.AnalysisJsonStream(resultStream, mEncoding);

                // 判断解析后数据是否为空
                if (userInfoList != null && userInfoList.Count > 0)
                {
                    Publish(userInfoList);

                    Console.WriteLine("更新数据时间:" + DateTime.Now);
                }
                else
                {
                    Console.WriteLine("解析数据为空");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("异常信息:" + ex);
            }
            finally
            {
                // 重新开启查询timer
                connectTimer.Start();
            }
        }
        public void Graph()
        {
            DispatcherHelper.Initialize();
            var segmentPool        = new SegmentPool();
            var projectService     = Substitute.For <IProjectService>();
            var dialogService      = Substitute.For <IDialogService>();
            var busyService        = Substitute.For <IBusyService>();
            var graphService       = new GraphService(projectService);
            var imageExportService = Substitute.For <IImageExportService>();
            var analysisService    = new AnalysisService(_spanFactory, segmentPool, projectService, dialogService, busyService);

            WordPairsViewModel.Factory wordPairsFactory = () => new WordPairsViewModel(busyService);

            var globalCorrespondences = new GlobalCorrespondencesViewModel(projectService, busyService, dialogService, imageExportService, graphService, wordPairsFactory);

            CogProject project = TestHelpers.GetTestProject(_spanFactory, segmentPool);

            project.Meanings.AddRange(new[] { new Meaning("gloss1", "cat1"), new Meaning("gloss2", "cat2"), new Meaning("gloss3", "cat3") });
            project.Varieties.AddRange(new[] { new Variety("variety1"), new Variety("variety2"), new Variety("variety3") });
            project.Varieties[0].Words.AddRange(new[] { new Word("hɛ.loʊ", project.Meanings[0]), new Word("gʊd", project.Meanings[1]), new Word("bæd", project.Meanings[2]) });
            project.Varieties[1].Words.AddRange(new[] { new Word("hɛlp", project.Meanings[0]), new Word("gu.gəl", project.Meanings[1]), new Word("gu.fi", project.Meanings[2]) });
            project.Varieties[2].Words.AddRange(new[] { new Word("wɜrd", project.Meanings[0]), new Word("kɑr", project.Meanings[1]), new Word("fʊt.bɔl", project.Meanings[2]) });
            projectService.Project.Returns(project);
            analysisService.SegmentAll();
            projectService.ProjectOpened += Raise.Event();

            Assert.That(globalCorrespondences.Graph, Is.Null);

            Messenger.Default.Send(new PerformingComparisonMessage());
            var varietyPairGenerator = new VarietyPairGenerator();

            varietyPairGenerator.Process(project);
            var wordPairGenerator    = new SimpleWordPairGenerator(segmentPool, project, 0.3, ComponentIdentifiers.PrimaryWordAligner);
            var globalCorrIdentifier = new SoundCorrespondenceIdentifier(segmentPool, project, ComponentIdentifiers.PrimaryWordAligner);

            foreach (VarietyPair vp in project.VarietyPairs)
            {
                wordPairGenerator.Process(vp);
                foreach (WordPair wp in vp.WordPairs)
                {
                    wp.AreCognatePredicted = true;
                }
                vp.SoundChangeFrequencyDistribution   = new ConditionalFrequencyDistribution <SoundContext, Ngram <Segment> >();
                vp.SoundChangeProbabilityDistribution = new ConditionalProbabilityDistribution <SoundContext, Ngram <Segment> >(vp.SoundChangeFrequencyDistribution, (sc, fd) => new MaxLikelihoodProbabilityDistribution <Ngram <Segment> >(fd));
                globalCorrIdentifier.Process(vp);
            }

            Messenger.Default.Send(new ComparisonPerformedMessage());

            Assert.That(globalCorrespondences.Graph, Is.Not.Null);

            globalCorrespondences.SyllablePosition = SyllablePosition.Nucleus;
            Assert.That(globalCorrespondences.Graph, Is.Not.Null);

            Messenger.Default.Send(new DomainModelChangedMessage(true));
            Assert.That(globalCorrespondences.Graph, Is.Null);

            globalCorrespondences.SyllablePosition = SyllablePosition.Coda;
            Assert.That(globalCorrespondences.Graph, Is.Null);
        }
 public GetCommentHelpHandler(
     WorkspaceService workspaceService,
     AnalysisService analysisService)
 {
     _workspaceService = workspaceService;
     _analysisService  = analysisService;
 }
Пример #9
0
        public MainPage()
        {
            try
            {
                ComputerVisionRepository computerVisionRepository = new ComputerVisionRepository();
                BlobStorageRepository    blobStorageRepository    = new BlobStorageRepository();
                IAnalysisService         analysisService          = new AnalysisService(computerVisionRepository);
                IFileService             fileService = new FileService();
                _logger = new ConsoleLogger();
                IComputerVisionService computerVisionService = new ComputerVisionService(
                    fileService,
                    analysisService,
                    computerVisionRepository,
                    blobStorageRepository);

                this.InitializeComponent();
                this.MainPageViewModel = new MainPageViewModel(Dispatcher, _logger, fileService, computerVisionService);

                Task.Run(() => MainPageViewModel.Init());

                //MainPageViewModel.Init();
            }
            catch (Exception ex)
            {
                _logger.LogEx(ex);
            }
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*PASATCore.XMLParameter x = new XMLParameter("patient");
             * x.AddParameter("id", "P008");
             * x.AddParameter("firstname", "Felix");
             * x.AddParameter("lastname", "Jiang");
             * x.AddParameter("middlename", "J");
             * x.AddParameter("birthDate", "restore");
             * x.AddParameter("prefix", "Mr");
             * x.AddParameter("suffix", "None");
             *
             * x.AddParameter("sex", "M");
             * x.AddParameter("pregnancy", "No");
             *
             * PatientService ps = new PatientService();
             * XMLResult cc= ps.CreatePatient(x);*/

            PASATCore.AnalysisService ass = new AnalysisService();
            XMLParameter p = new XMLParameter("presentationstate");

            p.AddParameter("id", "8afa206925fce1330125fd071bc60006");
            p.AddParameter("id", "8afa206925fce1330125fd071ca1000d");

            XMLResult cc = ass.GetDescription("8af0a5d9261b4e0c01261bb5269b003d");

            string b = "false";
            bool   d = Convert.ToBoolean(b);
            int    a = 0;
        }
Пример #11
0
        static void Main(string[] args)
        {
            var userInterface   = new ConsoleUi();
            var validator       = new Validator();
            var interaction     = new UserInteraction(userInterface, validator);
            var analysisService = new AnalysisService(interaction);

            analysisService.Start();
        }
Пример #12
0
        public string GetRegionalDispatchData(RegionalDispatchesReportFilter model)
        {
            if (!ModelState.IsValid)
            {
                return("");
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(AnalysisService.GetRegionalDispatches(model)));
        }
Пример #13
0
 public AnalysisController(AnalysisService _service, IDataFromFile dataFromFile, DataTools model
                           , SequentialDataTools sTools, FallDetection d)
 {
     this._service = _service;
     _dataFromFile = dataFromFile;
     _model        = model;
     _sTools       = sTools;
     _d            = d;
 }
Пример #14
0
        public void FindCommand()
        {
            DispatcherHelper.Initialize();
            var segmentPool     = new SegmentPool();
            var projectService  = Substitute.For <IProjectService>();
            var dialogService   = Substitute.For <IDialogService>();
            var busyService     = Substitute.For <IBusyService>();
            var analysisService = new AnalysisService(_spanFactory, segmentPool, projectService, dialogService, busyService);
            var exportService   = Substitute.For <IExportService>();

            WordsViewModel.Factory wordsFactory = words => new WordsViewModel(busyService, words);
            WordViewModel.Factory  wordFactory  = word => new WordViewModel(busyService, analysisService, word);

            var segments = new SegmentsViewModel(projectService, dialogService, busyService, exportService, wordsFactory, wordFactory);

            CogProject project = TestHelpers.GetTestProject(_spanFactory, segmentPool);

            project.Meanings.AddRange(new[] { new Meaning("gloss1", "cat1"), new Meaning("gloss2", "cat2"), new Meaning("gloss3", "cat3") });
            project.Varieties.AddRange(new[] { new Variety("variety1"), new Variety("variety2") });
            project.Varieties[0].Words.AddRange(new[] { new Word("hɛ.loʊ", project.Meanings[0]), new Word("gʊd", project.Meanings[1]), new Word("bæd", project.Meanings[2]) });
            project.Varieties[1].Words.AddRange(new[] { new Word("hɛlp", project.Meanings[0]), new Word("gu.gəl", project.Meanings[1]), new Word("gu.fi", project.Meanings[2]) });
            projectService.Project.Returns(project);
            analysisService.SegmentAll();
            projectService.ProjectOpened += Raise.Event();

            WordsViewModel observedWords = segments.ObservedWords;

            observedWords.WordsView = new ListCollectionView(observedWords.Words);

            FindViewModel findViewModel = null;
            Action        closeCallback = null;

            dialogService.ShowModelessDialog(segments, Arg.Do <FindViewModel>(vm => findViewModel = vm), Arg.Do <Action>(callback => closeCallback = callback));
            segments.FindCommand.Execute(null);
            Assert.That(findViewModel, Is.Not.Null);
            Assert.That(closeCallback, Is.Not.Null);

            // already open, shouldn't get opened twice
            dialogService.ClearReceivedCalls();
            segments.FindCommand.Execute(null);
            dialogService.DidNotReceive().ShowModelessDialog(segments, Arg.Any <FindViewModel>(), Arg.Any <Action>());

            // nothing selected, no match
            findViewModel.Field  = FindField.Form;
            findViewModel.String = "nothing";
            findViewModel.FindNextCommand.Execute(null);
            Assert.That(observedWords.SelectedWords, Is.Empty);

            // nothing selected, matches
            segments.SelectedSegment = segments.Varieties[1].Segments[3];
            WordViewModel[] wordsViewArray = observedWords.WordsView.Cast <WordViewModel>().ToArray();
            findViewModel.String = "fi";
            findViewModel.FindNextCommand.Execute(null);
            Assert.That(observedWords.SelectedWords, Is.EquivalentTo(wordsViewArray[1].ToEnumerable()));
            findViewModel.FindNextCommand.Execute(null);
            Assert.That(observedWords.SelectedWords, Is.EquivalentTo(wordsViewArray[1].ToEnumerable()));
        }
Пример #15
0
 public BatchController(
     BatchService gpsService,
     SequentialDataTools stools,
     AnalysisService det
     )
 {
     this._service = gpsService;
     this._stools  = stools;
     this._det     = det;
 }
Пример #16
0
        public void Segments()
        {
            var segmentPool     = new SegmentPool();
            var busyService     = Substitute.For <IBusyService>();
            var projectService  = Substitute.For <IProjectService>();
            var dialogService   = Substitute.For <IDialogService>();
            var analysisService = new AnalysisService(_spanFactory, segmentPool, projectService, dialogService, busyService);
            var project         = TestHelpers.GetTestProject(_spanFactory, segmentPool);

            project.Meanings.Add(new Meaning("gloss1", "cat1"));
            project.Varieties.Add(new Variety("variety1"));
            var w = new Word("gugəl", project.Meanings[0]);

            project.Varieties[0].Words.Add(w);
            projectService.Project.Returns(project);

            var word = new WordViewModel(busyService, analysisService, w);

            Assert.That(word.Segments, Is.Empty);
            Assert.That(word.IsValid, Is.False);

            project.Segmenter.Segment(w);

            Assert.That(word.IsValid, Is.True);
            Assert.That(word.Segments.Select(s => s.StrRep), Is.EqualTo(new[] { "|", "g", "u", "g", "ə", "l", "|" }));

            word.Segments.Move(0, 2);

            Assert.That(word.Segments.Select(s => s.StrRep), Is.EqualTo(new[] { "g", "u", "|", "g", "ə", "l", "|" }));
            Annotation <ShapeNode> prefixAnn = w.Prefix;

            Assert.That(prefixAnn, Is.Not.Null);
            Assert.That(w.Shape.GetNodes(prefixAnn.Span).Select(n => n.OriginalStrRep()), Is.EqualTo(new[] { "g", "u" }));
            Assert.That(w.Shape.GetNodes(w.Stem.Span).Select(n => n.OriginalStrRep()), Is.EqualTo(new[] { "g", "ə", "l" }));
            Assert.That(w.Suffix, Is.Null);
            Assert.That(w.StemIndex, Is.EqualTo(2));
            Assert.That(w.StemLength, Is.EqualTo(3));

            WordSegmentViewModel seg = word.Segments[6];

            word.Segments.RemoveAt(6);
            word.Segments.Insert(5, seg);

            Assert.That(word.Segments.Select(s => s.StrRep), Is.EqualTo(new[] { "g", "u", "|", "g", "ə", "|", "l" }));
            prefixAnn = w.Prefix;
            Assert.That(prefixAnn, Is.Not.Null);
            Assert.That(w.Shape.GetNodes(prefixAnn.Span).Select(n => n.OriginalStrRep()), Is.EqualTo(new[] { "g", "u" }));
            Assert.That(w.Shape.GetNodes(w.Stem.Span).Select(n => n.OriginalStrRep()), Is.EqualTo(new[] { "g", "ə" }));
            Annotation <ShapeNode> suffixAnn = w.Suffix;

            Assert.That(suffixAnn, Is.Not.Null);
            Assert.That(w.Shape.GetNodes(suffixAnn.Span).Select(n => n.OriginalStrRep()), Is.EqualTo(new[] { "l" }));
            Assert.That(w.StemIndex, Is.EqualTo(2));
            Assert.That(w.StemLength, Is.EqualTo(2));
        }
Пример #17
0
 public GetCommentHelpHandler(
     ILoggerFactory factory,
     WorkspaceService workspaceService,
     AnalysisService analysisService,
     SymbolsService symbolsService)
 {
     _logger           = factory.CreateLogger <GetCommentHelpHandler>();
     _workspaceService = workspaceService;
     _analysisService  = analysisService;
     _symbolsService   = symbolsService;
 }
Пример #18
0
        static void Main(string[] args)
        {
            AnalysisService analysisService = new AnalysisService();
            var             logAnalysis     = analysisService.RunAnalysis();
            PrinterService  printerService  = new PrinterService();

            printerService.PrintData(logAnalysis);
            Application.EnableVisualStyles();
            Application.Run(new LogAnalysisForm(logAnalysis));
            Console.Read();
        }
 public PsesTextDocumentHandler(
     ILoggerFactory factory,
     AnalysisService analysisService,
     WorkspaceService workspaceService,
     RemoteFileManagerService remoteFileManagerService)
 {
     _logger                   = factory.CreateLogger <PsesTextDocumentHandler>();
     _analysisService          = analysisService;
     _workspaceService         = workspaceService;
     _remoteFileManagerService = remoteFileManagerService;
 }
Пример #20
0
 public CodeActionHandler(ILoggerFactory factory, AnalysisService analysisService, WorkspaceService workspaceService)
 {
     _logger              = factory.CreateLogger <TextDocumentHandler>();
     _analysisService     = analysisService;
     _workspaceService    = workspaceService;
     _registrationOptions = new CodeActionRegistrationOptions
     {
         DocumentSelector = LspUtils.PowerShellDocumentSelector,
         CodeActionKinds  = s_supportedCodeActions
     };
 }
        public void Start(string level)
        {
            ProgressManager.OnProgressUpdated += OnAnalysisProgressUpdated;
            AnalysisService service = new AnalysisService();

            var productionLevel = RepositoryHelper.ProductionLevels[level];

            AnalysisItems = RepositoryHelper.Repository.GetProductionItems(productionLevel);

            service.Start(productionLevel, AnalysisItems, RebuildList);
        }
Пример #22
0
        public void IsOrderRemaining_WithEmptyOrders_ShouldReturnFalse()
        {
            // Arrange
            Dictionary <MealType, int> orders = new Dictionary <MealType, int>();

            // Act
            AnalysisService analysisService = new AnalysisService();
            bool            result          = analysisService.IsOrderRemaining(orders);

            // Assert
            Assert.IsFalse(result, "Result should have been false.");
        }
Пример #23
0
        public void GetBestService_WithValidOrdersAndRestaurants_ShouldReturnResults()
        {
            // Arrange
            AnalysisService            analysisService = new AnalysisService();
            List <Restaurant>          restaurants     = analysisService.GetRestaurants();
            Dictionary <MealType, int> orders          = new Dictionary <MealType, int>()
            {
                { MealType.Others, 40 },
                { MealType.Vegetarian, 5 },
                { MealType.GlutenFree, 2 }
            };
            List <Result> expectedResult = new List <Result>()
            {
                new Result()
                {
                    Restaurant = new Restaurant()
                    {
                        Name = "Restaurant A"
                    },
                    ProvidedFoods = new Dictionary <MealType, int>()
                    {
                        { MealType.Others, 36 },
                        { MealType.Vegetarian, 4 },
                    }
                },
                new Result()
                {
                    Restaurant = new Restaurant()
                    {
                        Name = "Restaurant B"
                    },
                    ProvidedFoods = new Dictionary <MealType, int>()
                    {
                        { MealType.Others, 4 },
                        { MealType.Vegetarian, 1 },
                        { MealType.GlutenFree, 2 }
                    }
                }
            };

            // Act
            List <Result> results = analysisService.GetBestService(orders, restaurants);

            // Assert
            Assert.AreEqual(expectedResult.Count, results.Count, String.Format("Length of results should be {0}", expectedResult.Count));
            Assert.AreEqual(expectedResult[0].Restaurant.Name, results[0].Restaurant.Name, String.Format("Name of first restaurant should be {0}", expectedResult[0].Restaurant.Name));
            Assert.AreEqual(expectedResult[1].Restaurant.Name, results[1].Restaurant.Name, String.Format("Name of second restaurant should be {0}", expectedResult[1].Restaurant.Name));
            DictionaryComparer <MealType, int> comparer = new DictionaryComparer <MealType, int>();

            Assert.IsTrue(comparer.Equals(expectedResult[0].ProvidedFoods, results[0].ProvidedFoods), "Results should have been the same");
            Assert.IsTrue(comparer.Equals(expectedResult[1].ProvidedFoods, results[1].ProvidedFoods), "Results should have been the same");
        }
Пример #24
0
        private void ItemsReport()
        {
            var items = CommonClientFunctions.ReadItems();

            foreach (var item in items)
            {
                Console.WriteLine($"Item: {item.Name}");
                foreach (var sizeOption in item.SizeOptions)
                {
                    Console.WriteLine($"\tSize Option: {sizeOption.Size} - " +
                                      $"Sell Price: {sizeOption.Price.ToString("C", CultureInfo.CurrentCulture)} - " +
                                      $"{sizeOption.TimeToMakeInHours} hours");

                    //lowest cost materials
                    var minMaterialCost = new List <Tuple <decimal, decimal> >();
                    var maxMaterialCost = new List <Tuple <decimal, decimal> >();
                    var avgMaterialCost = new List <Tuple <decimal, decimal> >();

                    bool hasMaterialColors = false;
                    foreach (var materialCount in sizeOption.MaterialCounts)
                    {
                        var materialColorCosts = materialCount.Material.Colors.Select(c => c.Cost);
                        if (materialColorCosts.Count() == 0)
                        {
                            continue;
                        }
                        hasMaterialColors = true;
                        minMaterialCost.Add(new Tuple <decimal, decimal>(materialCount.MaterialUnitCount, materialColorCosts.Min()));
                        maxMaterialCost.Add(new Tuple <decimal, decimal>(materialCount.MaterialUnitCount, materialColorCosts.Max()));
                        avgMaterialCost.Add(new Tuple <decimal, decimal>(materialCount.MaterialUnitCount, materialColorCosts.Average()));
                    }
                    if (!hasMaterialColors)
                    {
                        continue;
                    }
                    var anserv = new AnalysisService();

                    var highestProfit = anserv.CalculateProfit(sizeOption, minMaterialCost);
                    var lowestProfit  = anserv.CalculateProfit(sizeOption, maxMaterialCost);
                    var averageProfit = anserv.CalculateProfit(sizeOption, avgMaterialCost);

                    Console.WriteLine($"\t\tMinimum Profit: {CommonClientFunctions.ConvertToMoney(lowestProfit)} - " +
                                      $"Minimum Profit Per Hour: {CommonClientFunctions.ConvertToMoney(anserv.ValuePerHour(sizeOption.TimeToMakeInHours, lowestProfit))}");

                    Console.WriteLine($"\t\tMaximum Profit: {CommonClientFunctions.ConvertToMoney(highestProfit)} - " +
                                      $"Maximum Profit Per Hour: {CommonClientFunctions.ConvertToMoney(anserv.ValuePerHour(sizeOption.TimeToMakeInHours, highestProfit))}");

                    Console.WriteLine($"\t\tAverage Profit: {CommonClientFunctions.ConvertToMoney(averageProfit)} - " +
                                      $"Average Profit Per Hour: {CommonClientFunctions.ConvertToMoney(anserv.ValuePerHour(sizeOption.TimeToMakeInHours, averageProfit))}");
                }
            }
        }
 public ConfigurationHandler(
     ILoggerFactory factory,
     WorkspaceService workspaceService,
     AnalysisService analysisService,
     ConfigurationService configurationService,
     PowerShellContextService powerShellContextService)
 {
     _logger                   = factory.CreateLogger <ConfigurationHandler>();
     _workspaceService         = workspaceService;
     _analysisService          = analysisService;
     _configurationService     = configurationService;
     _powerShellContextService = powerShellContextService;
 }
 public CodeActionHandler(ILoggerFactory factory, AnalysisService analysisService)
 {
     _logger              = factory.CreateLogger <TextDocumentHandler>();
     _analysisService     = analysisService;
     _registrationOptions = new CodeActionRegistrationOptions
     {
         DocumentSelector = new DocumentSelector(new DocumentFilter()
         {
             Language = "powershell"
         }),
         CodeActionKinds = s_supportedCodeActions
     };
 }
Пример #27
0
        public void GetBestService_WithNullOrders_ShouldReturnEmptyResults()
        {
            // Arrange
            AnalysisService            analysisService = new AnalysisService();
            List <Restaurant>          restaurants     = analysisService.GetRestaurants();
            Dictionary <MealType, int> orders          = null;

            // Act
            List <Result> results = analysisService.GetBestService(orders, restaurants);

            // Assert
            Assert.IsTrue(results.Count == 0, "Results should have been empty.");
        }
Пример #28
0
 public static IServiceCollection AddPsesLanguageServices(
     this IServiceCollection collection,
     ProfilePaths profilePaths,
     HashSet <string> featureFlags,
     bool enableConsoleRepl,
     bool useLegacyReadLine,
     PSHost internalHost,
     HostDetails hostDetails,
     string[] additionalModules)
 {
     return(collection.AddSingleton <WorkspaceService>()
            .AddSingleton <SymbolsService>()
            .AddSingleton <ConfigurationService>()
            .AddSingleton <PowerShellContextService>(
                (provider) =>
                PowerShellContextService.Create(
                    provider.GetService <ILoggerFactory>(),
                    provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>(),
                    profilePaths,
                    featureFlags,
                    enableConsoleRepl,
                    useLegacyReadLine,
                    internalHost,
                    hostDetails,
                    additionalModules))
            .AddSingleton <TemplateService>()
            .AddSingleton <EditorOperationsService>()
            .AddSingleton <RemoteFileManagerService>()
            .AddSingleton <ExtensionService>(
                (provider) =>
     {
         var extensionService = new ExtensionService(
             provider.GetService <PowerShellContextService>(),
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>());
         extensionService.InitializeAsync(
             serviceProvider: provider,
             editorOperations: provider.GetService <EditorOperationsService>())
         .Wait();
         return extensionService;
     })
            .AddSingleton <AnalysisService>(
                (provider) =>
     {
         return AnalysisService.Create(
             provider.GetService <ConfigurationService>(),
             provider.GetService <OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer>(),
             provider.GetService <ILoggerFactory>().CreateLogger <AnalysisService>());
     }));
 }
Пример #29
0
        private FavoriteLiveSongList GetAnalysisPart(Song song)
        {
            var setSongService  = new SetSongService(Ioc.GetInstance <ISetSongRepository>());
            var analysisService = new AnalysisService(Ioc.GetInstance <IAnalysisRepository>());
            var songService     = new SongService(Ioc.GetInstance <ISongRepository>());

            //Get all Analysis for that Song but in groups of SetSong
            var analysis = analysisService.GetAnalysisBySong(song.SongId).GroupBy(x => x.SetSongId);

            double      highestRating = 0;
            double?     rating        = 0;
            List <Guid> setSongIds    = new List <Guid>();

            //If there are no analysis then there is nothing to see here
            if (analysis.Count() == 0)
            {
                return(null);
            }

            var fave = new FavoriteLiveSongList(SetSong.FromSong(song));

            //If there are 1 or more analysis then we need to find out which is the highest ranked
            foreach (var a in analysis)
            {
                rating = a.Average(x => x.Rating);
                var setSongId = a.First().SetSongId;

                if (rating.HasValue && rating.Value > highestRating)
                {
                    highestRating          = rating.Value;
                    fave.HighestRatedShows = new List <Show>();

                    var setSong = (SetSong)setSongService.GetSetSong(setSongId);
                    var show    = GetShowFromSetSong(setSongId);
                    fave.HighestRatedShows.Add(show);
                }
                else if (rating.HasValue && rating.Value == highestRating)
                {
                    var setSong = (SetSong)setSongService.GetSetSong(setSongId);
                    var show    = GetShowFromSetSong(setSongId);

                    fave.HighestRatedShows.Add(show);
                }
            }

            fave.HighestRating = highestRating;

            return(fave);
        }
Пример #30
0
 public PsesConfigurationHandler(
     ILoggerFactory factory,
     WorkspaceService workspaceService,
     AnalysisService analysisService,
     ConfigurationService configurationService,
     PowerShellContextService powerShellContextService,
     ILanguageServerFacade languageServer)
 {
     _logger                   = factory.CreateLogger <PsesConfigurationHandler>();
     _workspaceService         = workspaceService;
     _configurationService     = configurationService;
     _powerShellContextService = powerShellContextService;
     _languageServer           = languageServer;
     ConfigurationUpdated     += analysisService.OnConfigurationUpdated;
 }
Пример #31
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*PASATCore.XMLParameter x = new XMLParameter("patient");
            x.AddParameter("id", "P008");
            x.AddParameter("firstname", "Felix");
            x.AddParameter("lastname", "Jiang");
            x.AddParameter("middlename", "J");
            x.AddParameter("birthDate", "restore");
            x.AddParameter("prefix", "Mr");
            x.AddParameter("suffix", "None");

            x.AddParameter("sex", "M");
            x.AddParameter("pregnancy", "No");

            PatientService ps = new PatientService();
            XMLResult cc= ps.CreatePatient(x);*/

            PASATCore.AnalysisService ass = new AnalysisService();
            XMLParameter p = new XMLParameter("presentationstate");
            p.AddParameter("id", "8afa206925fce1330125fd071bc60006");
            p.AddParameter("id", "8afa206925fce1330125fd071ca1000d");

            XMLResult cc= ass.GetDescription("8af0a5d9261b4e0c01261bb5269b003d");

            string b = "false";
            bool d = Convert.ToBoolean(b);
            int a = 0;
        }
Пример #32
0
		public static Task SetAnalysisSubscriptions(this DartAnalysisService service, AnalysisService[] subscriptions, string root)
		{
			return service.SetAnalysisSubscriptions(subscriptions.ToDictionary(s => s, s => new[] { root }));
		}