public SummaryOutputProcessor(IDataProcessor processor)
            : base(processor)
        {
            charturlBase = ConfigurationUtil.CurrentConfiguration.AppSettings.Settings[Constants.ChartUrl].Value;

            if (string.IsNullOrEmpty(charturlBase))
            {
                charturlBase = "http://chart.finance.yahoo.com/z?s={0}&t=1y&q=c&l=on&z=l&p=e20,e50,e200,p&a=v,m26-12-9";
            }

            table = new DataTable();
            table.Columns.Add(FieldConstant.Ticker, typeof(string));
            table.Columns.Add(FieldConstant.Company, typeof(string));
            table.Columns.Add(FieldConstant.Industry , typeof(string));
            table.Columns.Add(FieldConstant.Price, typeof(float));
            table.Columns.Add(FieldConstant.PEG, typeof(float));
            table.Columns.Add(FieldConstant.ROA, typeof(string));
            table.Columns.Add(FieldConstant.ROE, typeof(string));
            table.Columns.Add(FieldConstant.InsiderTran, typeof(string));
            table.Columns.Add(FieldConstant.InstOwn, typeof(string));
            table.Columns.Add(FieldConstant.AnalystRecom, typeof(string));
            table.Columns.Add(FieldConstant.EarningDates, typeof(string));
            table.Columns.Add(FieldConstant.DividendPayDate, typeof(string));
            table.Columns.Add(FieldConstant.ExDividendDate, typeof(string));
            table.Columns.Add(FieldConstant.DividendYield, typeof(string));
            table.Columns.Add(FieldConstant.TargetPrice1y, typeof(float));
            table.Columns.Add(FieldConstant.CurrentTargetPriceDiff, typeof(float));
            table.Columns.Add(FieldConstant._50Day, typeof(float));
            table.Columns.Add(FieldConstant._20Day, typeof(float));
            table.Columns.Add(FieldConstant._200Day, typeof(float));
            table.Columns.Add(FieldConstant.StockChartUrl, typeof(string));
            table.Columns.Add(HistoricalDataAdapter.CurrentPE, typeof(float));
        }
        public void SetData(object data)
        {
            var dataProcessor = data as IDataProcessor;

            _dataProcessor     = dataProcessor ?? throw new InvalidOperationException($"Аргумент {nameof(data)} должен наследовать интерфейс {nameof(IDataProcessor)}");
            _dataProcessorInfo = new DataProcessorInfo(dataProcessor);
            _dataProcessor.Awake();

            if (_dataProcessorInfo.Outputs.Count > 1)
            {
                throw new NotImplementedException();
            }

            var output = _dataProcessorInfo.Outputs.Single();

            _outputDataRenderer = DataRendererUtil.GetRendererFor(output.Type);
            _outputDataRenderer.OnUpdateRequest       += RequestUpdate;
            _outputDataRenderer.UpdateControlsRequest += () => UpdateControlsRequest?.Invoke();

            var outputObject = output.Get();

            if (outputObject != null)
            {
                _outputDataRenderer.SetData(outputObject);
            }

            _dataProcessor.Updated += DataProcessorUpdated;
        }
Пример #3
0
        public Processor(
            IProgressReporter progress,
            JsonSerializer serialiser,
            IConfigurationRepository configRepository,
            IDataProcessor processor,
            IInputFactory inputFactory)
        {
            if (serialiser == null)
            {
                throw new ArgumentNullException(nameof(serialiser));
            }

            if (progress == null)
            {
                throw new ArgumentNullException(nameof(progress));
            }

            if (configRepository == null)
            {
                throw new ArgumentNullException(nameof(configRepository));
            }

            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            this.serialiser       = serialiser;
            this.configRepository = configRepository;
            this.processor        = processor;
            this.inputFactory     = inputFactory;
            this.progress         = progress;
        }
        } // end default constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="ReportingEngine"/> class.
        /// </summary>
        /// <param name="configurationProvider">The <see cref="IConfigurationProvider"/> instance used to load configuration data.</param>
        /// <param name="dataProcessor">The <see cref="IDataProcessor"/> instance used to process the raw data into a format the report can use.</param>
        /// <param name="fileSystemProvider">The <see cref="IFileSystemProvider"/> instance used to load files into memory.</param>
        /// <param name="reportViewer">The <see cref="IReportViewer"/> instance used to display reports.</param>
        public ReportingEngine(IConfigurationProvider configurationProvider, IDataProcessor dataProcessor, IFileSystemProvider fileSystemProvider, IReportViewer reportViewer)
        {
            this._configurationProvider = configurationProvider;
            this._dataProcessor         = dataProcessor;
            this._fileSystemProvider    = fileSystemProvider;
            this._reportViewer          = reportViewer;
        } // end overloaded constructor
Пример #5
0
 public UsbConnectedMiddleware(RequestDelegate next, IDataProcessor dataProcessor, ICo2DeviceHandler co2DeviceHandler, IMemoryCache memoryCache)
 {
     _next             = next;
     _cache            = memoryCache;
     _dataProcessor    = dataProcessor;
     _co2DeviceHandler = co2DeviceHandler;
 }
Пример #6
0
        public DataObject Process(ResourceID ID, ResourceManager ResourceManager)
        {
            IDataProcessor processor = ResourceManager.GetDataProcessor("burngfxmap");
            MapData        data      = processor.Process(ID, ResourceManager) as MapData;

            return(data);
        }
        //requires a data processor to ensure unique row ids
        public ElasticsearchStorage(IDataProcessor DataProcessor, string Server = null, string Index = null, string Username = null, string Password = null)
            : base(DataProcessor)
        {
            this.Server   = Framework.Settings.Get("ELASTICSEARCH_URL", Server);
            this.Index    = Framework.Settings.Get("ELASTICSEARCH_INDEX", Index);
            this.Username = Framework.Settings.Get("ELASTICSEARCH_USER", Username);
            this.Password = Framework.Settings.Get("ELASTICSEARCH_PWD", Password);

            if (String.IsNullOrEmpty(this.Server))
            {
                throw new Exception("No elasticsearch server defined!");
            }
            if (String.IsNullOrEmpty(this.Index))
            {
                throw new Exception("No elasticsearch index defined!");
            }

            _client = new Nest.ElasticClient(new ConnectionSettings(
                                                 new Uri(this.Server))
                                             .DefaultIndex(this.Index)
                                             .BasicAuthentication(this.Username, this.Password)
                                             .EnableHttpCompression()
                                             );

            this.Log("Elasticsearch URI: {0}", this.Server);
            this.Log("Elasticsearch Index: {0}", this.Index);
        }
 /// <summary>
 /// Initializes an instance of <see cref="StringDataProcessor"/> class
 /// </summary>
 /// <param name="logFactory">Creates and manages instance of <see cref="Logger"/></param>
 /// <param name="id">Processor ID</param>
 public StringDataProcessor(LogFactory logFactory, IDataProcessor <string, int> lengthDataProcessor, string id)
 {
     LogFactory           = logFactory;
     _lengthDataProcessor = lengthDataProcessor;
     _id     = id;
     _logger = LogFactory.GetLogger($"{typeof(StringDataProcessor).FullName}-{_id}");
 }
Пример #9
0
        /// <summary>
        /// Creates TcpServer instance.
        /// </summary>
        /// <param name="address">Listener address.</param>
        /// <param name="processor">Incoming data processing module.</param>
        public TcpServer(IPEndPoint address, IDataProcessor processor)
        {
            _dataProcessor = processor;

            _listenerSocket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            _listenerSocket.Bind(address);
        }
        public void AddProcessor_ArgChecks()
        {
            var a  = new NameType("a", typeof(bool));
            var b  = new NameType("b", typeof(bool));
            var c  = new NameType("c", typeof(bool));
            var d  = new NameType("d", typeof(bool));
            var e  = new NameType("e", typeof(bool));
            var f  = new NameType("f", typeof(bool));
            var e0 = Expression.Lambda(Expression.Empty(), Expression.Parameter(typeof(bool)));
            var e1 = (Expression <Func <bool, bool> >)(v => v);
            var e2 = (Expression <Func <bool, bool, bool> >)((v1, v2) => v1);

            Assert.Throws <ArgumentNullException>(() => _b.AddProcessor(null, a, b), "null expr");
            Assert.Throws <ArgumentException>(() => _b.AddProcessor(e1, NameType.Empty, a), "invalid out");
            Assert.Throws <ArgumentException>(() => _b.AddProcessor(e1, b, NameType.Empty), "invalid in");
            Assert.Throws <ArgumentException>(() => _b.AddProcessor(e1, a), "empty in");
            Assert.Throws <ArgumentNullException>(() => _b.AddProcessor(e1, a, null), "null in");
            Assert.Throws <ArgumentException>(() => _b.AddProcessor(e1, a, a, b), "wrong name count");
            Assert.Throws <ArgumentException>(() => _b.AddProcessor(e0, a, b), "void return type");

            _b.AddProcessor(e1, a, b);
            _b.AddListener(e1, a);
            Assert.Throws <InvalidOperationException>(() => _b.AddProcessor(e1, a, b), "output defined");

            _b.AddInput <bool>("d");
            Assert.Throws <InvalidOperationException>(() => _b.AddProcessor(e1, d, c), "output defined 2");

            _dp = _b.Build();

            Assert.Throws <InvalidOperationException>(() => _b.AddProcessor(e1, e, f), "after build");
        }
Пример #11
0
 static void writeReport(IDataProcessor p, string name)
 {
     Console.WriteLine("File '{0}' has been processed:\r\n" +
                       "\tCycles = {1}\r\n" +
                       "\tMultiparent nodes = {2}\r\n", name, p.CyclesCount, p.MultiParentCount
                       );
 }
        public When_Import_Is_Called_To_Import_LearningAimReferenceStaging()
        {
            var config = new MapperConfiguration(c => c.AddMaps(typeof(LearningAimReferenceStagingMapper).Assembly));
            var mapper = new Mapper(config);
            var logger = Substitute.For <ILogger <FileImportService <LearningAimReferenceStagingFileImportDto, LearningAimReferenceStagingDto, LearningAimReferenceStaging> > >();

            _fileReader    = Substitute.For <IFileReader <LearningAimReferenceStagingFileImportDto, LearningAimReferenceStagingDto> >();
            _dataProcessor = Substitute.For <IDataProcessor <LearningAimReferenceStaging> >();

            _repository = Substitute.For <IBulkInsertRepository <LearningAimReferenceStaging> >();
            _repository.MergeFromStagingAsync().Returns(2);

            _stagingFileImportDto = new LearningAimReferenceStagingFileImportDto
            {
                FileDataStream = new MemoryStream()
            };

            _fileReaderResults = Build(2);

            _fileReader.ValidateAndParseFileAsync(_stagingFileImportDto)
            .Returns(Task.FromResult(_fileReaderResults));

            var service = new FileImportService <LearningAimReferenceStagingFileImportDto, LearningAimReferenceStagingDto, LearningAimReferenceStaging>(logger, mapper, _fileReader, _repository, _dataProcessor);

            _result = service.BulkImportAsync(_stagingFileImportDto).GetAwaiter().GetResult();
        }
Пример #13
0
        public DataObject GetData(ResourceID id, ResourceLoadType loadType)
        {
            DataObject obj;

            if (dataObjects.ContainsKey(id))
            {
                obj = dataObjects[id];
            }
            else if (loadType == ResourceLoadType.Now)
            {
                IDataProcessor processor = GetDataProcessor(id.Format);

                engine.IncreaseLoadingCount();
                obj = processor.Process(id, this);
                Log.Debug("load \"" + id + "\"");
                obj.resourceManager = this;
                obj.DataName        = id;
                obj.PostProcess();
                engine.DecreaseLoadingCount();

                dataObjects.Add(id, obj);
            }
            else
            {
                obj = new NullDataObject(id, this);
            }

            return(obj);
        }
 public DataMapperApp(
     IDataProcessor processor,
     ILogger <DataMapperApp> logger)
 {
     this.processor = processor;
     this.logger    = logger;
 }
        private async Task <object> ProcessData(string inputPath)
        {
            Console.WriteLine($"Reading data from {inputPath}");

            await using var fileStream = File.OpenRead(inputPath);

            var totalLineCount = 0;
            var validLineCount = 0;

            IDataProcessor dataProcessor = null;

            await foreach (var dataLine in _fileReader.Read(fileStream, 0))
            {
                if (totalLineCount == 0)
                {
                    dataProcessor = _dataProcessorFactory.Create(dataLine);
                }
                else
                {
                    if (dataProcessor.ProcessLine(dataLine))
                    {
                        validLineCount++;
                    }
                }

                totalLineCount++;
            }

            Console.WriteLine($"Finished reading data - {totalLineCount} total lines; {validLineCount} valid lines");

            return(dataProcessor.GetSummary());
        }
        public DataProcessorWorkspacePanelItemController(IDataProcessor dataProcessor, WorkspacePanelItem view) : base(view)
        {
            DataProcessor     = dataProcessor;
            DataProcessorInfo = new DataProcessorInfo(dataProcessor);

            dataProcessor.Updated += UpdateView;
        }
        public void Processor_Optional_Two()
        {
            var w1 = _b.AddInput <int>("in1");
            var w2 = _b.AddInput <int>("in2");

            _b.AddProcessorExpression <int, int, int>(
                "in1", "in2", "out",
                (i, j) => i == 0 ? Maybe <int> .Nothing : Maybe <int> .Just(j));
            _b.AddListener <int>("out", SetActual);
            _dp = _b.Build();

            w1.Send(1);
            w2.Send(1);
            Assert.AreEqual(1, _actual);

            w2.Send(2);
            w1.Send(1);
            Assert.AreEqual(2, _actual);

            w1.Send(0);
            w2.Send(3);
            Assert.AreEqual(2, _actual);

            w2.Send(4);
            w1.Send(0);
            Assert.AreEqual(2, _actual);
        }
Пример #18
0
        /// <summary>
        /// Creates TcpServer instance.
        /// </summary>
        /// <param name="address">Listener address.</param>
        /// <param name="processor">Incoming data processing module.</param>
        public TcpServer(IPEndPoint address, IDataProcessor processor)
        {
            _dataProcessor = processor;

            _listenerSocket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            _listenerSocket.Bind(address);
        }
        public void Processor_Optional_Chained()
        {
            var w1 = _b.AddInput <int>("in1");

            _b.AddProcessorExpression <int, int>(
                "in1", "in2",
                i => i == 10 ? Maybe <int> .Nothing : Maybe <int> .Just(i));
            _b.AddProcessorExpression <int, int>(
                "in2", "out",
                i => i + 1);
            _b.AddListener <int>("out", SetActual);
            _dp = _b.Build();

            w1.Send(1);
            Assert.AreEqual(2, _actual);

            w1.Send(2);
            Assert.AreEqual(3, _actual);

            w1.Send(10);
            Assert.AreEqual(3, _actual);

            w1.Send(11);
            Assert.AreEqual(12, _actual);
        }
        public void OneIn_ZeroOut()
        {
            var w = _b.AddInput <int>("bob");

            _dp = _b.Build();
            w.Send(1);
            w.Send(2);
        }
Пример #21
0
 public PeriodicalFileWatcher(FileWatcherOptions options, IDataProcessor<string> dataProcessor, ILogger logger)
 {
     _options = options;            
     _dataProcessor = dataProcessor;
     _processedFiles = new ConcurrentDictionary<string, bool>();
     _ctSrc = new CancellationTokenSource();
     _logger = logger;
 }
 public TenantRelocationProcessor(IDataProcessor next, IPropertyLookup organizationPropertyLookup, ExcludedObjectReporter reporter, GetTenantRelocationStateDelegate getTenantRelocationState, Guid invocationId, bool isIncrementalSync) : base(next)
 {
     this.organizationPropertyLookup = organizationPropertyLookup;
     this.reporter = reporter;
     this.getTenantRelocationState = getTenantRelocationState;
     this.invocationId             = invocationId;
     this.isIncrementalSync        = isIncrementalSync;
 }
 public DataProcessorPropertyInfo(PropertyInfo propertyInfo, IDataProcessor owner, OutputAttribute outputAttribute)
 {
     Owner         = owner;
     Name          = outputAttribute.Name;
     Description   = outputAttribute.Description;
     Direction     = DataProcessorPropertyDirection.Input;
     _propertyInfo = propertyInfo;
 }
 /// <summary>
 ///     注册数组数据处理器
 /// </summary>
 /// <param name="processor">数据处理器实例</param>
 /// <exception cref="ArgumentNullException">参数不能为空</exception>
 public void Regist(IDataProcessor processor)
 {
     if (processor == null)
     {
         throw new ArgumentNullException("processor");
     }
     _processors[processor.TypeId] = processor;
 }
Пример #25
0
 /// <summary>
 /// 初始化异步拆包及异步发送 接收由用户连接后ServerBiz启动
 /// </summary>
 public UserToken(Action <string, string> disconnect, IDataProcessor Processor, NetType netType)
 {
     NetType         = netType;
     TokenTime       = 10000;
     this.Disconnect = disconnect;
     this.Processor  = Processor;
     SetAsynEventArgs();
 }
Пример #26
0
 /// <summary>
 /// Prepara y crea el servidor TCP
 /// </summary>
 public TCPServer(IDataProcessor dataProcessor, int port, string ip)
 {
     this.port     = port;
     this.ip       = ip;
     client        = null;
     ns            = null;
     DataProcessor = dataProcessor;
 }
Пример #27
0
 public ReportConfigurationUI(Form form)
 {
     this.ConstructForms(form);
     _Form     = form;
     processor = new DeviceProcessor();
     InitEvents();
     _Form.Load += new EventHandler(LoadReportConfiguration);
 }
Пример #28
0
 public AddData(IDataProcessor processor, IDataStore store)
 {
     this.processor = processor;
     this.store     = store;
     DataAdded     += (s, e) =>
     {
         (this.store as IAddData).CallDataAdded(e);
     };
 }
Пример #29
0
        private static void WriteGetTop10MakelaarsResult(IDataProcessor dataProcessor, bool withGarden = false)
        {
            Console.WriteLine("------------------------------------------------------------");
            var results = dataProcessor.GetTop10Makelaars("Amsterdam", withGarden);

            results.ForEach(x => Console.WriteLine($"{x.Count} objecten bij makelaar '{x.Name}'."));
            Console.WriteLine("------------------------------------------------------------");
            Console.WriteLine("");
        }
Пример #30
0
 public void Register <T>(IDataProcessor <T> processor)
 {
     dataProcessors.Add(new DataProcessorInfo
     {
         DataProcessor     = processor,
         DataType          = typeof(T),
         ProcessMethodInfo = processor.GetType().GetMethod("ProcessData")
     });
 }
Пример #31
0
 public GetData(IDataProcessor processor, IDataStore store)
 {
     this.processor = processor;
     this.store     = store;
     DataRetrieved += (s, e) =>
     {
         (this.store as IGetData).CallDataRetrieved(e);
     };
 }
 public YahooFinanceProcessor(IDataProcessor processor)
     : base(processor)
 {
     exportUrl = ConfigurationUtil.CurrentConfiguration.AppSettings.Settings[Constants.YahooFinanceURL].Value;
     if (string.IsNullOrEmpty(exportUrl))
     {
         exportUrl = "http://finance.yahoo.com/d/quotes.csv?s={0}&f={1}";
     }
 }
 public DataProcessorPropertyInfo(PropertyInfo propertyInfo, IDataProcessor owner, InputAttribute inputAttribute)
 {
     Owner         = owner;
     Name          = inputAttribute.Name;
     Description   = inputAttribute.Description;
     Required      = inputAttribute.Required;
     Direction     = DataProcessorPropertyDirection.Input;
     _propertyInfo = propertyInfo;
 }
Пример #34
0
        public void AddDataProcessor(IDataProcessor processor)
        {
            if (processors.Contains(processor))
            {
                return;
            }

            processors.Add(processor);
        }
Пример #35
0
 protected BaseProcessor(IDataProcessor processor)
 {
     if (processor != null)
     {
         innerProcessor = processor;
         innerProcessor.DataProcessingCompleted += innerProcessor_DataProcessingCompleted;
         innerProcessor.DataRetrieveError += innerProcessor_DataRetrieveError;
         innerProcessor.UpdateStatus += innerProcessor_UpdateStatus;
     }
 }
Пример #36
0
        /// <summary>
        /// Creates CommunicationServer instance.
        /// </summary>
        /// <param name="config">Server configuration.</param>
        public CommunicationServer(ServerConfig config)
        {
            // TODO Communication server should be a backup by default. Some work is needed here.

            Config = config;

            _componentOverseer = new ComponentOverseer(Config.CommunicationTimeout, ComponentOverseerCheckInterval);
            _workManager = new WorkManager(_componentOverseer);
            _msgProcessor = new MessageProcessor(_componentOverseer, _workManager);
            _tcpServer = new TcpServer(Config.Address, _msgProcessor);
        }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsolidatorDataProcessor"/> class
 /// </summary>
 /// <param name="destination">The receiver of the consolidated data</param>
 /// <param name="createConsolidator">Function used to create consolidators</param>
 public ConsolidatorDataProcessor(IDataProcessor destination, Func<BaseData, IDataConsolidator> createConsolidator)
 {
     _destination = destination;
     _createConsolidator = createConsolidator;
     _consolidators = new Dictionary<Symbol, IDataConsolidator>();
 }
Пример #38
0
        public void AddDataProcessor(IDataProcessor processor)
        {
            if (processors.Contains(processor)) return;

            processors.Add(processor);
        }
 public RestProcessor(IDataProcessor dataProcessor)
 {
     _dataProcessor = dataProcessor;
     _client = new RestClient(StirTrekUrl);
 }
Пример #40
0
 public FileWatcher(FileWatcherOptions options, IDataProcessor<string> dataProcessor)
 {
     _options = options;            
     _dataProcessor = dataProcessor;
     _watchers = new List<FileSystemWatcher>();
 }
Пример #41
0
 public void RemoveDataProcessor(IDataProcessor processor)
 {
     processors.Remove(processor);
 }
Пример #42
0
 /// <summary>
 /// Adds the specified processor to the output pipe
 /// </summary>
 /// <param name="processor">Processor to receive data from this pipe</param>
 public void PipeTo(IDataProcessor processor)
 {
     _processors.Add(processor);
 }
Пример #43
0
 private static bool x716bafe7619d8264(IDataProcessor x08db3aeabb253cb1)
 {
     return (x08db3aeabb253cb1.GetType().Name == typeof(LinearScale).Name);
 }
Пример #44
0
 private static bool xad1d75c4f41a1f7d(IDataProcessor x08db3aeabb253cb1)
 {
     return (x08db3aeabb253cb1.GetType().Name == typeof(SimpleFunctionalPreprocessorLogic).Name);
 }
Пример #45
0
 private static bool xdeb098800b3ee141(IDataProcessor x08db3aeabb253cb1)
 {
     return (x08db3aeabb253cb1.GetType().Name == typeof(LinearScale).Name);
 }
Пример #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilteredDataProcessor"/> class
 /// </summary>
 /// <param name="processor">The processor to filter data for</param>
 /// <param name="predicate">The filtering predicate to be applied</param>
 public FilteredDataProcessor(IDataProcessor processor, Func<BaseData, bool> predicate)
 {
     _predicate = predicate;
     _processor = processor;
 }
Пример #47
0
 public ValuationProcessor(IDataProcessor processor)
     : base(processor)
 {
     adapters = new ConcurrentDictionary<string, HistoricalDataAdapter>();
 }
 public StockChartProcessor(IDataProcessor processor)
     : base(processor)
 {
 }
 public FundamentalFilterProcessor(IDataProcessor processor)
     : base(processor)
 {
 }
Пример #50
0
 Program()
 {
     this.loader = DependencyInjection.Container.Resolve<IDataLoader>();
     this.processor = DependencyInjection.Container.Resolve<IDataProcessor>();
 }
Пример #51
0
 private static bool x1e076d75160be815(IDataProcessor x08db3aeabb253cb1)
 {
     return (x08db3aeabb253cb1.GetType().Name == typeof(SimpleFunctionalPreprocessorLogic).Name);
 }