Exemplo n.º 1
0
        /// <summary>
        /// Creates a property analyzer.
        /// </summary>
        /// <param name="analyzer">Sets the analyzer for indexing and searching.</param>
        public PropertyAnalyzer(IAnalyzer analyzer)
        {
            if (analyzer == null)
                throw new ArgumentNullException("analyzer", "PropertyAnalyzer expects an analyzer in this constructor.");

            Analyzer = analyzer;
        }
Exemplo n.º 2
0
        public void Test(BlackBoxTest integrationTest)
        {
            var latinParser = new Latin.WordParser();
            var word        = latinParser.Parse(integrationTest.Latin);

            var analyzers = new IAnalyzer[]
            {
                new MemoizeAnalyzer("classical_latin"),
                new Latin.SyllableAnalyzer(),
                new Latin.AccentAnalyzer(),
            };

            foreach (var analyzer in analyzers)
            {
                analyzer.Analyze(word);
            }

            var rules     = French2.Rules();
            var sequencer = new LinearRuleSequencer(rules, new Dictionary <string, IAnalyzer>()
            {
                { "syllable", new Latin.SyllableAnalyzer() },
            });

            var derived = sequencer.Derive(ExecutionContext, word).Select(d => d.Derived).ToArray();

            var expected = integrationTest.Outputs;

            Assert.Equal(expected.Length, derived.Length);

            for (int i = 0; i < expected.Length; i++)
            {
                TestBlackBoxSample(expected, derived, i);
            }
        }
 public CertificateValidationDiagnosticSuite()
 {
     Analyzers = new IAnalyzer[]
     {
         Container.Resolve <CertificateValidationAnalyzer>()
     }.ToImmutableArray();
 }
Exemplo n.º 4
0
        private static void Setup(string[] args)
        {
            _help           = args.Any(x => (x == "/help") || (x == "/h"));
            _install        = args.Any(x => x == "/install");
            _waitKeyPressed = args.Any(x => (x == "/i") || (x == "/interactive"));

            _processor = new MSBuildLogProcessor();
            _analyzer  = new SimpleAnalyzer();

            if (args.Contains("/csv"))
            {
                SetupCSVReporter(args);
            }
            else if (args.Contains("/tc"))
            {
                _reporter = new TeamCityReporter();
            }
            else
            {
                _reporter = new SimpleReporter();
            }

            _logFile = args.FirstOrDefault(File.Exists);

            if (args.Length == 0)
            {
                _help = _waitKeyPressed = true;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Reads and reflects the given VB Classic text file into a usable form.
        /// </summary>
        /// <param name="partitionedFile">An instance of <see cref="VbPartitionedFile"/> representing the VB Classic module to reflect.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"><paramref name="partitionedFile"/> was null.</exception>
        /// <exception cref="InvalidOperationException">There was no analyzer considered fitting for the underlying file.</exception>
        public static IVbModule GetReflectedModule(VbPartitionedFile partitionedFile)
        {
            if (partitionedFile == null)
            {
                throw new ArgumentNullException("partitionedFile");
            }

            if (Tokenizer == null)
            {
                throw new InvalidOperationException("No tokenizer defined for analyzing the file!");
            }

            IReadOnlyList <IToken> tokens = Tokenizer.GetTokens(partitionedFile.GetMergedContent());

            TokenStreamReader reader = new TokenStreamReader(tokens);

            IAnalyzer analyzer = null;

            if (!AnalyzerFactory.TryGetAnalyzerForFile(reader, out analyzer))
            {
                // TODO: Dedicated exception for this.
                throw new InvalidOperationException("Could not analyze the given file!");
            }

            reader.Rewind();

            return(analyzer.Analyze(reader));
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            userId   = args[0];
            password = args[1];
            aimeId   = int.Parse(args[2]);

            if (UPDATE_HISTORY)
            {
                GetMusicDataTable();
                UpdateHistory();
            }
            else
            {
                var historyCsvPath = "./playlog/history.csv";
                if (File.Exists(historyCsvPath))
                {
                    history = ReadHistory(historyCsvPath);
                }

                var analyzers = new IAnalyzer[]
                {
                    new DeductionAnalyzer(history),
                    new Analyzer1(history),
                };

                foreach (var analyzer in analyzers)
                {
                    analyzer.Analyze();
                    analyzer.Dump();
                }

                Console.WriteLine("解析完了");
            }
            Console.ReadLine();
        }
Exemplo n.º 7
0
 public AnalyzerPresenter(IAnalyzerView view, IMessageService service, IAnalyzer analyzer)
 {
     this.view               = view;
     this.service            = service;
     this.analyzer           = analyzer;
     view.ApplyAnalyzeClick += View_ApplyAnalyzeClick;
 }
Exemplo n.º 8
0
        protected StreamUpsertOperation(string directory, IAnalyzer analyzer, Stream stream, Compression compression, string primaryKey)
            : base(directory, analyzer, compression, primaryKey)
        {
            var bs = new BufferedStream(stream);

            Reader = new StreamReader(bs, Encoding.UTF8);
        }
Exemplo n.º 9
0
 public CliLineDocUpsertOperation(string directory, IAnalyzer analyzer, Stream file, int skip, int take, Compression compression, string primaryKey)
     : base(directory, analyzer, file, compression, primaryKey)
 {
     _take      = take;
     _skip      = skip;
     _cursorPos = Console.CursorLeft;
 }
Exemplo n.º 10
0
        private void MetaMenuItem_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.MenuItem tv = sender as System.Windows.Controls.MenuItem;
            FileViewModel fileTopic             = tv.DataContext as FileViewModel;
            var           results = new Dictionary <string, object>();

            if (fileTopic.LogFile != null)
            {
                string tmpStr = string.Empty;
                {
                    foreach (Type analyzerType in PluginFactory.FindAnalyzers(fileTopic.LogFile.GetType()))
                    {
                        IAnalyzer analyzer = PluginFactory.CreateAnalyzer(analyzerType);
                        foreach (var result in analyzer.Analyze(fileTopic.LogFile))
                        {
                            results.Add(result.Key, result.Value);
                        }
                    }
                }

                foreach (var item in results)
                {
                    tmpStr += item.Key + ": " + item.Value.ToString() + Environment.NewLine;
                }
                MessageBox.Show(tmpStr, Properties.Resources.computedDataCaption);
            }
        }
Exemplo n.º 11
0
 public void ProcessFile(string fileName, IAnalyzer analyzer)
 {
     var sw = Stopwatch.StartNew();
     StreamReader reader;
     if (!TryOpenFile(fileName, out reader))
         return;
     using(reader)
     {
         PrintFileInfo(fileName, reader);
         ProgressNotifier progressNotifier = ProgressNotifier.Start("Reading and analyzing..", reader.BaseStream.Length - reader.BaseStream.Position);
         var chars = new char[4 * 1024];
         int read;
         while((read = reader.Read(chars, 0, chars.Length)) > 0)
         {
             for(int i = 0; i < read; i++)
             {
                 analyzer.TreatChar(chars[i]);
             }
             progressNotifier.ReportCompleted(reader.BaseStream.Position);
         }
         progressNotifier.Finish();
     }
     var analysisResult = analyzer.Finish();
     Console.Out.WriteLine("----");
     Console.Out.WriteLine(analysisResult.ToHumanReadableText());
     Console.Out.WriteLine("----");
     Console.Out.WriteLine("Working time: " + sw.Elapsed);
 }
Exemplo n.º 12
0
        public void Setup()
        {
            this.productDataInterpreter = new Mock <IInterpreter <int> >(MockBehavior.Strict);
            this.queryInterpreter       = new Mock <IInterpreter <string> >(MockBehavior.Strict);

            this.analyzer = new Analyzer(this.productDataInterpreter.Object, this.queryInterpreter.Object);
        }
Exemplo n.º 13
0
 public StaticAnalyzer(IStaticProvider provider, IAnalyzer embeddedAnalyzer, IDictionary <int, ISolverSubdomain> subdomains)
 {
     this.provider      = provider;
     this.childAnalyzer = embeddedAnalyzer;
     this.subdomains    = subdomains;
     this.childAnalyzer.ParentAnalyzer = this;
 }
Exemplo n.º 14
0
        public async Task <IActionResult> QueueAnalyzes(
            Guid mrRecordId,
            [FromBody] QueueAnalyzesRequest request,
            [FromServices] IAnalyzer analyzer)
        {
            var targetRecord = await dbContext.MrRecords.SingleOrDefaultAsync(r => r.Id == mrRecordId);

            if (targetRecord == null)
            {
                return(NotFound());
            }

            var algs = await dbContext.MrAlgorithms.Where(a => request.Algorithms.Contains(a.Id)).ToListAsync();

            if (algs.Count != request.Algorithms.Count)
            {
                return(NotFound());
            }

            var analyzes = algs.Select(a => new MrAnalyze
            {
                MrAlgorithm = a,
                MrRecord    = targetRecord,
                Status      = MrAnalyzeStatus.InQueue
            }).ToList();

            dbContext.AddRange(analyzes);
            await dbContext.SaveChangesAsync();

            await Task.WhenAll(analyzes.Select(a => analyzer.Analyze(a)));

            return(Ok());
        }
Exemplo n.º 15
0
 public Processor(
     IPreProcessor preProcessor,
     IAnalyzer analyzer)
 {
     this.preProcessor = preProcessor;
     this.analyzer     = analyzer;
 }
Exemplo n.º 16
0
 public static IEnumerable <Invocation> GetInvocations(this IAnalyzer extractor, string text, string fileName = null)
 {
     using (var reader = new StringReader(text))
     {
         return(extractor.GetInvocations(reader, fileName: fileName));
     }
 }
Exemplo n.º 17
0
        internal InputAnalyzer(ObservableDictionary <string, string> parameters, IDevice device, IAnalyzer analyzer)
        {
            _parameters = parameters;
            _analyzer   = analyzer;

            _analyzerWrapper = new AnalyzerWrapper(analyzer, parameters);
            _analyzerWrapper.Run();

            _device = device;
            _input  = device.GamingInput;

            if (_input is ISkeletonInput && analyzer is ISkeletonAnalyzer)
            {
                (_input as ISkeletonInput).SkeletonChanged +=
                    (_skeleton_handler = new EventHandler <SkeletonChangedEventArgs>(InputAnalyzer_SkeletonChanged));
            }
            else if (_input is IAccelerometerInput && analyzer is IAccelerometerAnalyzer)
            {
                (_input as IAccelerometerInput).AccelerometerChanged +=
                    (_accelerometer_handler = new EventHandler <AccelerometerChangedEventArgs>(InputAnalyzer_AccelerometerChanged));
            }
            else if (_input is IBalanceBoardInput && analyzer is IBalanceBoardAnalyzer)
            {
                (_input as IBalanceBoardInput).BalanceChanged +=
                    (_ballanceBoard_handler = new EventHandler <BalanceChangedEventArgs>(InputAnalyzer_BalanceChanged));
            }
            else if (_input is IEmgSensorInput && analyzer is IEmgSignalAnalyzer)
            {
                (_input as IEmgSensorInput).MuscleActivationChanged +=
                    (_emg_handler = new EventHandler <MuscleActivationChangedEventArgs>(InputAnalyzer_MuscleActivationChanged));
            }
        }
Exemplo n.º 18
0
        public PolynomialChaosAnalyzer(Model model, IAnalyzerProvider provider, IAnalyzer embeddedAnalyzer, IDictionary <int, ISolverSubdomain> subdomains, IPCCoefficientsProvider coefficientsProvider, int expansionOrder, int simulations, bool shouldFactorizeMatrices)
        {
            this.shouldFactorizeMatrices = shouldFactorizeMatrices;
            this.childAnalyzer           = embeddedAnalyzer;
            this.provider       = provider;
            this.model          = model;
            this.subdomains     = subdomains;
            this.expansionOrder = coefficientsProvider.ExpansionOrder;
            this.simulations    = simulations;
            this.childAnalyzer.ParentAnalyzer = this;
            this.matrices             = new Dictionary <int, IMatrix2D <double> > [coefficientsProvider.NoOfMatrices + 1];
            this.randomNumbers        = new double[simulations][];
            this.coefficientsProvider = coefficientsProvider;

            NormalDistribution n = new NormalDistribution();

            n.Mu    = 0;
            n.Sigma = 1;
            string[] randoms = new string[simulations];
            for (int i = 0; i < simulations; i++)
            {
                randomNumbers[i] = new double[expansionOrder];
                for (int j = 0; j < expansionOrder; j++)
                {
                    randomNumbers[i][j] = n.NextDouble();
                }
                randoms[i] = randomNumbers[i][0].ToString();
            }
            //File.WriteAllLines(String.Format(@"randoms.txt", expansionOrder), randoms);
        }
Exemplo n.º 19
0
        public IndexWriter(string directory, IAnalyzer analyzer)
        {
            _directory = directory;
            _analyzer  = analyzer;

            _docFile            = new DocumentFile(directory);
            _fieldFiles         = new Dictionary <int, FieldFile>();
            _fieldIndexFileName = Path.Combine(_directory, "fld.ix");

            if (File.Exists(_fieldIndexFileName))
            {
                using (var fs = File.OpenRead(_fieldIndexFileName))
                {
                    _fieldIndex = Serializer.Deserialize <Dictionary <string, int> >(fs);
                }
            }
            else
            {
                _fieldIndex = new Dictionary <string, int>();
            }

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
        }
Exemplo n.º 20
0
        public FullTextIndex(StorageEnvironmentOptions options, IAnalyzer analyzer)
        {
            Analyzer           = analyzer;
            Conventions        = new IndexingConventions();
            BufferPool         = new BufferPool();
            StorageEnvironment = new StorageEnvironment(options);

            using (var tx = StorageEnvironment.NewTransaction(TransactionFlags.ReadWrite))
            {
                StorageEnvironment.CreateTree(tx, "@terms", keysPrefixing: true);
                StorageEnvironment.CreateTree(tx, "deletes", keysPrefixing: true);
                var docs = StorageEnvironment.CreateTree(tx, "docs", keysPrefixing: true);

                var metadata = StorageEnvironment.CreateTree(tx, "$metadata");
                var idVal    = metadata.Read("id");
                if (idVal == null)
                {
                    Id = Guid.NewGuid();
                    metadata.Add("id", Id.ToByteArray());
                }
                else
                {
                    int _;
                    Id = new Guid(idVal.Reader.ReadBytes(16, out _));
                }
                using (var it = docs.Iterate())
                {
                    _lastDocumentId = it.Seek(Slice.AfterAllKeys) == false ?
                                      0 :
                                      it.CurrentKey.CreateReader().ReadBigEndianInt64();
                }
                tx.Commit();
            }
        }
Exemplo n.º 21
0
        //public MonteCarloAnalyzer(Model model, IAnalyzerProvider provider, IAnalyzer embeddedAnalyzer, IDictionary<int, ISolverSubdomain> subdomains, double[] stochasticDomain, int expansionOrder, int simulations)
        public MonteCarloAnalyzer(Model model, IAnalyzerProvider provider, IAnalyzer embeddedAnalyzer, IDictionary <int, ISolverSubdomain> subdomains, GaussianFileStochasticCoefficientsProvider coefficientsProvider, int expansionOrder, int simulations)
        {
            this.childAnalyzer  = embeddedAnalyzer;
            this.provider       = provider;
            this.model          = model;
            this.subdomains     = subdomains;
            this.expansionOrder = expansionOrder;
            this.simulations    = simulations;
            this.childAnalyzer.ParentAnalyzer = this;
            //this.matrices = new Dictionary<int, IMatrix2D<double>>(subdomains.Count);
            this.matrices             = new Dictionary <int, IMatrix2D <double> > [expansionOrder + 1];
            this.randomNumbers        = new double[simulations][];
            this.coefficientsProvider = coefficientsProvider;
            //this.stochasticDomain = stochasticDomain;

            NormalDistribution n = new NormalDistribution();

            n.Mu    = 0;
            n.Sigma = 1;
            string[] randoms = new string[simulations];
            for (int i = 0; i < simulations; i++)
            {
                randomNumbers[i] = new double[expansionOrder];
                for (int j = 0; j < expansionOrder; j++)
                {
                    randomNumbers[i][j] = n.NextDouble();
                }
                randoms[i] = randomNumbers[i][0].ToString();
            }
            File.WriteAllLines(String.Format(@"randoms.txt", expansionOrder), randoms);
        }
Exemplo n.º 22
0
 public Indexer(FullTextIndex parent)
 {
     _parent = parent;
     _analyzer = _parent.Analyzer;
     _bufferPool = _parent.BufferPool;
     AutoFlush = true;
 }
Exemplo n.º 23
0
 public AnalysisBasedConstraint(IAnalyzer <IMetric> analyzer,
                                Func <V, bool> assertion, Option <string> hint)
 {
     Analyzer   = analyzer;
     _assertion = assertion;
     _hint      = hint;
 }
Exemplo n.º 24
0
 public Indexer(FullTextIndex parent)
 {
     _parent     = parent;
     _analyzer   = _parent.Analyzer;
     _bufferPool = _parent.BufferPool;
     AutoFlush   = true;
 }
Exemplo n.º 25
0
        public void Init()
        {
            base.Init();

            this.analyzer = ServiceProvider.GetService <IAnalyzer>();
            this.mediator = ServiceProvider.GetService <IMediator>();
        }
Exemplo n.º 26
0
 public Parser(Uri uri, int depth, int maxCount, HttpClient client, IAnalyzer analyzer)
 {
     #region Проверки
     if (uri is null)
     {
         throw new ArgumentNullException("uri is null");
     }
     if (depth <= 1)
     {
         throw new ArgumentOutOfRangeException("depth must be greater than 1");
     }
     if (maxCount <= 1)
     {
         throw new ArgumentOutOfRangeException("maxCount must be greater than 1");
     }
     if (client is null)
     {
         throw new ArgumentNullException("client is null");
     }
     if (analyzer is null)
     {
         throw new ArgumentNullException("analyzer is null");
     }
     #endregion
     URI              = uri;
     Depth            = depth;
     MaxCount         = maxCount;
     Client           = client;
     Analyzer         = analyzer;
     Analyzer.Finded += s => Finded.Invoke(s);
 }
Exemplo n.º 27
0
 public AnalyzerSearchTreeNode(ISymbol symbol, IAnalyzer analyzer, string analyzerHeader)
 {
     this.symbol         = symbol;
     this.analyzer       = analyzer ?? throw new ArgumentNullException(nameof(analyzer));
     this.LazyLoading    = true;
     this.analyzerHeader = analyzerHeader;
 }
Exemplo n.º 28
0
        public void AddAnalyzer <T>()
            where T : IAnalyzer
        {
            if (RootAnalyzer == null)
            {
                RootAnalyzer = Activator.CreateInstance <T>();
                return;
            }

            var analyzer     = RootAnalyzer;
            var nextAnalyzer = RootAnalyzer.NextAnalyzer;

            while (true)
            {
                if (nextAnalyzer == null)
                {
                    var instanse = Activator.CreateInstance <T>();
                    analyzer.NextAnalyzer = instanse;
                    break;
                }
                else
                {
                    analyzer     = nextAnalyzer;
                    nextAnalyzer = analyzer.NextAnalyzer;
                }
            }
        }
Exemplo n.º 29
0
 protected AbstractUseNamedArgumentsCodeRefactoringProvider(
     IAnalyzer argumentAnalyzer,
     IAnalyzer attributeArgumentAnalyzer)
 {
     _argumentAnalyzer          = argumentAnalyzer;
     _attributeArgumentAnalyzer = attributeArgumentAnalyzer;
 }
Exemplo n.º 30
0
        public IAnalyzer Analyze(IEnumerable <HandHistories.Objects.Cards.Card> playerCards, BoardCards boardCards)
        {
            try
            {
                IAnalyzer result = null;

                var highestHand = CardHelper.FindBestHand(string.Join("", playerCards.Select(c => c.CardStringValue)), boardCards.ToString());

                var analyzers = ReferenceEquals(highestHand, null) ? _combinations : _combinations.Where(x => x.IsValidAnalyzer(highestHand)).ToArray();

                if (playerCards.Count() > 2 && !string.IsNullOrEmpty(highestHand.PocketCards))
                {
                    result = analyzers.FirstOrDefault(combination => combination.Analyze(CardGroup.Parse(highestHand.PocketCards), boardCards)) ?? new StubAnalyzer();
                }
                else
                {
                    result = analyzers.FirstOrDefault(combination => combination.Analyze(playerCards, boardCards)) ?? new StubAnalyzer();
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogProvider.Log.Error(this, String.Format("Hand Analyzer Error occurred: Player cards = {0}; Board Cards = {1}", string.Join("", playerCards.Select(c => c.CardStringValue)), boardCards.ToString()), ex);
            }

            return(new StubAnalyzer());
        }
Exemplo n.º 31
0
 public CliLineDocUpsertOperation(string directory, IAnalyzer analyzer, int skip, int take, Compression compression, string primaryKey, Stream documents)
     : base(directory, analyzer, compression, primaryKey, documents)
 {
     _take           = take;
     _skip           = skip;
     _autoGeneratePk = string.IsNullOrWhiteSpace(primaryKey);
 }
Exemplo n.º 32
0
        public Processor()
        {
            var ninjectKernel = new StandardKernel(new SimpleConfigModule());

            _extension = ninjectKernel.Get <IExtension>();
            _analyzer  = ninjectKernel.Get <IAnalyzer>();
        }
Exemplo n.º 33
0
        public static void Main(string[] args)
        {
            var env     = Environment.GetEnvironmentVariable("TWITTER_ENV") ?? "Development";
            var cwd     = Directory.GetCurrentDirectory();
            var builder = new ConfigurationBuilder()
                          .SetBasePath(cwd)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env}.json", optional: true)
                          .AddEnvironmentVariables();
            var configuration     = builder.Build();
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddLanguage(configuration.GetSection("Language"));
            serviceCollection.AddTwitter(configuration.GetSection("Twitter"));
            serviceCollection.AddMeDaUmFilme();
            var services = serviceCollection.BuildServiceProvider();

            languageAnalyzer  = services.GetService <IAnalyzer>();
            meDaUmFilmeSearch = services.GetService <IMeDaUmFilmeSearch>();
            var twitter = services.GetService <Twitter.Twitter>();

            twitter.ListenAsync("@medaumfilme", Listen);
            Console.WriteLine("Waiting...");
            Console.ReadLine();
        }
Exemplo n.º 34
0
        public void runFull(IAnalyzer analyzer, DataItem item, AssetTimeframe atf)
        {
            this.atf = atf;
            if (item == null) return;
            if (item.Quotation == null) return;

            runLeftSide(analyzer, item, atf);
        }
Exemplo n.º 35
0
        /// <summary>
        /// Create a property analyzer that uses different analysis for indexing and searching.
        /// </summary>
        /// <param name="indexAnalyzer">Sets the analyzer to use for indexing a property.</param>
        /// <param name="searchAnalyzer">Sets the analyzer to use for searching a property. Optional.</param>
        public PropertyAnalyzer(IAnalyzer indexAnalyzer, IAnalyzer searchAnalyzer)
        {
            if (indexAnalyzer == null)
                throw new ArgumentNullException("indexAnalyzer", "PropertyAnalyzer expects an indexAnalyzer in this constructor.");

            IndexAnalyzer = indexAnalyzer;

            if (searchAnalyzer != null)
                SearchAnalyzer = searchAnalyzer;
        }
Exemplo n.º 36
0
		static QueryObjectParser()
		{
			Analyzers = new IAnalyzer[]
				{
					new EqualAnalyzer(), 
					new ListContainsAnalyzer(), 
					new RangeAnalyzer(), 
					new StringContainsAnalyzer(), 
					new NavigationAnalyzer(), 
				};
		}
 private static IAnalyzer factory(IAnalyzer analyzer, List<float> data_float)
 {
     switch (analyzer.Name)
     {
         case Averager.Type_Name:
             return new Averager(data_float, analyzer);
             //break;
         default:    // found no known type for that name
             return analyzer;
     }
 }
Exemplo n.º 38
0
        internal static bool TryGetAnalyzerForFile(TokenStreamReader reader, out IAnalyzer analyzer)
        {
            var best = _analyzers.FirstOrDefault(_ => _.CanAnalyze(reader.Rewind()));
            if (best != null)
            {
                analyzer = best;
                return true;
            }

            analyzer = null;
            return false;
        }
Exemplo n.º 39
0
        public void runRightSide(IAnalyzer analyzer, DataItem item, AssetTimeframe atf)
        {
            this.atf = atf;
            if (item == null) return;
            if (item.Quotation == null) return;

            //Calculate new values for peaks and troughs and apply them to the current item price.
            //If any of this is changed, this price will have flag [IsChange] set to @true.
            //This is the only thing that can be changed for items being only updated.
            CheckForExtremum(item, ExtremumType.PeakByClose, false);
            CheckForExtremum(item, ExtremumType.PeakByHigh, false);
            CheckForExtremum(item, ExtremumType.TroughByClose, false);
            CheckForExtremum(item, ExtremumType.TroughByLow, false);
            CheckPriceGap(item);
        }
Exemplo n.º 40
0
        public FullTextIndex(StorageEnvironmentOptions options, IAnalyzer analyzer)
        {
            Analyzer = analyzer;
            Conventions = new IndexingConventions();
            BufferPool = new BufferPool();
            StorageEnvironment = new StorageEnvironment(options);

            using (var tx = StorageEnvironment.NewTransaction(TransactionFlags.ReadWrite))
            {
                ReadMetadata(tx);
                ReadLastDocumentId(tx);
                ReadFields(tx);

                tx.Commit();
            }
        }
Exemplo n.º 41
0
        private void AddDocument(Document document, IAnalyzer analyzer)
        {
            if (document.Key == Guid.Empty)
                document.Key = Guid.NewGuid();

            DocumentStorage.Add(document);

            System.Diagnostics.Debug.Assert(document.Value.CanSeek);
            document.Value.Seek(0, SeekOrigin.Begin);
            var termPositions = analyzer.GetTermPositions(document.Value);
            foreach(var termPositionsGroup in termPositions.GroupBy(a=>a.Term))
            {
                var term = new Term(
                    termPositionsGroup.Key,
                    termPositionsGroup.Select(a => new DocumentLocation { Document = document.Key, Span = a.Span }));

                TermStorage.Add(term);
            }
        }
Exemplo n.º 42
0
 public void runFull(IAnalyzer analyzer, DataItem item, AssetTimeframe atf)
 {
 }
Exemplo n.º 43
0
 public void runFull(IAnalyzer analyzer, int index, AssetTimeframe atf)
 {
 }
Exemplo n.º 44
0
 public GenericTranslator(IAnalyzer analyzer)
 {
     this.analyzer = analyzer;
 }
Exemplo n.º 45
0
 public SingleDocumentIndex(Document document, IAnalyzer analyzer)
     : this(document, analyzer, new MemoryStream(), new MemoryStream(), new MemoryStream(), new MemoryStream())
 {
 }
Exemplo n.º 46
0
 public SingleDocumentIndex(Document document, IAnalyzer analyzer, Stream termIndexStream, Stream termRecordStorageStream, Stream documentIndexStream, Stream documentRecordStorageStream)
     : this(document, analyzer, new TermStorage(termIndexStream, termRecordStorageStream), new DocumentStorage(documentIndexStream, documentRecordStorageStream))
 {
 }
Exemplo n.º 47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:AnalyzerException"/> class.
 /// </summary>
 public AnalyzerException(IAnalyzer analyzer) {
     Analyzer = analyzer;
 }
Exemplo n.º 48
0
 public MetricsWorker(ICloudService cloudService, IAnalyzer analyzer, IPluginFactory pluginFactory)
 {
     Analyzer = analyzer;
     PluginFactory = pluginFactory;
 }
Exemplo n.º 49
0
 public void runRightSide(IAnalyzer analyzer, int index, AssetTimeframe atf)
 {
     DataItem item = analyzer.getDataItem(index);
     runRightSide(analyzer, item, atf);
 }
Exemplo n.º 50
0
 public TextAnalyzer()
 {
     Analyzer = new ZalAnalyzer();
 }
Exemplo n.º 51
0
        private void runLeftSide(IAnalyzer analyzer, DataItem item, AssetTimeframe atf)
        {
            //Check if quotation is missing (but only in the middle of not-missing quotations,
            //because missing quotations at the end of array was excluded one line above).
            //If it is copy data from the previous quotation.
            if (!item.Quotation.IsComplete())
            {
                var previousQuotation = (item.Index > 0 ? analyzer.getDataItem(item.Index - 1).Quotation : null);
                if (previousQuotation != null)
                {
                    item.Quotation.CompleteMissing(previousQuotation);
                    //_dataService.UpdateQuotation(item.Quotation, Symbol);
                }

            }

            //Ensure that [Price] object is appended to this [DataItem].
            item.Price = new Price();
            item.Price.Date = item.Date;
            if (item.Index > 0) item.Price.CloseDelta = CalculateDeltaClosePrice(item.Quotation.Close, item.Index);
            item.Price.Direction2D = CalculateDirection2D(item.Index);
            item.Price.Direction3D = CalculateDirection3D(item.Index);

            //Calculate new values for peaks and troughs and apply them to the current item price.
            //If any of this is changed, this price will have flag [IsChange] set to @true.
            //This is the only thing that can be changed for items being only updated.
            CheckForExtremum(item, ExtremumType.PeakByClose, true);
            CheckForExtremum(item, ExtremumType.PeakByHigh, true);
            CheckForExtremum(item, ExtremumType.TroughByClose, true);
            CheckForExtremum(item, ExtremumType.TroughByLow, true);
            CheckPriceGap(item);
        }
Exemplo n.º 52
0
 public Analyzer(IAnalyzer analyyzer_interface_object)
 {
     Name = analyyzer_interface_object.Name;
     Description = analyyzer_interface_object.Description;
     _IAanlyzer = analyyzer_interface_object;
 }
Exemplo n.º 53
0
 public SimplifierTest()
 {
     simplifier = new Simplifier();
 }
Exemplo n.º 54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:AnalyzerException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="analyzer">The analyzer which the exception occurred.</param>
 /// <param name="message">The error message that explains the reason for the exception. </param>
 /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. </param>
 public AnalyzerException(IAnalyzer analyzer, string message, Exception innerException)
     : base(message, innerException) {
     Analyzer = analyzer;
 }
Exemplo n.º 55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Exception"/> class with a specified error message.
 /// </summary>
 /// <param name="analyzer">The analyzer which the exception occurred.</param>
 /// <param name="message">The message that describes the error. </param>
 public AnalyzerException(IAnalyzer analyzer, string message) : base(message) {
     Analyzer = analyzer;
 }
Exemplo n.º 56
0
 public void runRightSide(IAnalyzer analyzer, int index, AssetTimeframe atf)
 {
 }
Exemplo n.º 57
0
 public void runRightSide(IAnalyzer analyzer, DataItem item, AssetTimeframe atf)
 {
 }
Exemplo n.º 58
0
 public SingleDocumentIndex(Document document, IAnalyzer analyzer, TermStorage termStorage, DocumentStorage documentStorage)
 {
     TermStorage = termStorage;
     DocumentStorage = documentStorage;
     AddDocument(document, analyzer);
 }
Exemplo n.º 59
0
 public TextAnalyzer(IAnalyzer _Analyzer)
 {
     Analyzer = _Analyzer;
 }
Exemplo n.º 60
0
 public Averager(List<float> data, IAnalyzer analyzer)
 {
     _Data = data;
     Name = analyzer.Name;
     Description = analyzer.Description;
 }