Example #1
0
        private IAggregator CreateAggregator(AggregatorType aggregatorType, int channelId, string instrumentName)
        {
            IDataWriter dataWriter;

            switch (_dataWriterType)
            {
            case DataWriterType.BinaryFile:
                dataWriter = new FileDataWriter(instrumentName, aggregatorType);
                break;

            case DataWriterType.Console:
                dataWriter = new ConsoleDataWriter(aggregatorType);
                break;

            default:
                throw new ArgumentException(nameof(_dataWriterType));
            }

            switch (aggregatorType)
            {
            case AggregatorType.Books:
                return(new BookAggregator(dataWriter, channelId, instrumentName));

            case AggregatorType.RawBooks:
                return(new RawBookAggregator(dataWriter, channelId, instrumentName));

            default:
                throw new ArgumentException(nameof(aggregatorType));
            }
        }
        public AggregatorInfo(string col, AggregatorType type, double value, string formatting = null)
        {
            Column     = col;
            Value      = value;
            Formatting = formatting;
            Type       = type;

            FormatValue();
        }
        public FileDataWriter(string instrumentName, AggregatorType aggregatorType)
        {
            var appDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            var filePath = Path.Combine(appDirectory, instrumentName, aggregatorType.ToString());

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            _fileName = Path.Combine(filePath, $"{DateTime.Now:yyyy-MM-dd-HH-mm-ss}.dat");
        }
        /// <exception cref="ArgumentOutOfRangeException">Condition.</exception>
        public static ExpressionType GetByAggregator(AggregatorType aggregator)
        {
            switch (aggregator)
            {
            case AggregatorType.And:
                return(ExpressionType.AndAlso);

            case AggregatorType.Or:
                return(ExpressionType.OrElse);

            case AggregatorType.Xor:
                return(ExpressionType.ExclusiveOr);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #5
0
        private IPlagiarismAggregator CreateAggregator(AggregatorType type)
        {
            Logger.Info("Aggregator type: {0}", type.ToString());
            switch (type)
            {
            case AggregatorType.Max:
                return(new MaxAggregator());

            case AggregatorType.Min:
                return(new MinAggregator());

            case AggregatorType.Median:
                return(new MedianAggregator());

            default:
                string error = string.Format("Unsupported aggregator type: {0}", type.ToString());
                Logger.Error(error);
                throw new Exception(error);
            }
        }
        public List <Performance> LoadPerformances(AggregatorType site, Uri Archive, DateTime date)
        {
            List <Performance> result = new List <Performance>();

            // replace switch later everywhere to dynamic connection
            switch (site)
            {
            case AggregatorType.RadioIUa:
                result.AddRange(GetPerformanceArchive(Archive, date));
                break;

            //case AggregatorType.RadioscopeInUa:
            // not supported yet
            //  break;
            default:
                // not added to this switch. maybe a throw?
                break;
            }

            return(result);
        }
 public AggregatorInfo(string col, AggregatorType type)
 {
     Column = col;
     Type   = type;
 }
 public ConsoleDataWriter(AggregatorType aggregatorType)
 {
     this.aggregatorType = aggregatorType;
 }