Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            MatrixAccessor inputContainer;

            try
            {
                inputContainer = new MatrixAccessor();
            }catch (Exception ex)
            {
                System.Console.WriteLine("Producer cannot open input file");
                return;
            }
            Dispatcher dispatcher = new Dispatcher(inputContainer);

            dispatcher.Run();
            //int[] m1 = new int[] { 81, 20, 17, 39 };
            //var message = new StringBuilder("");
            //JsonSerializer serializer = new JsonSerializer();
            //using (StringWriter sw = new StringWriter(message))
            //{
            //    serializer.Serialize(sw, m1);
            //}

            //using (Client client = new Client())
            //{
            //    client.Call(message.ToString());
            //}
        }
Ejemplo n.º 2
0
        public MQClient(MatrixAccessor container, WorkerTimeLogger logger)
        {
            this.logger = logger;
            assembler   = new MatrixAssembler(container);

            var factory = new ConnectionFactory()
            {
                HostName    = MQServerConfig.IP,
                Port        = MQServerConfig.PORT,
                UserName    = MQServerConfig.USER,
                Password    = MQServerConfig.USER,
                VirtualHost = MQServerConfig.VHOST
            };

            connection = factory.CreateConnection();
            channel    = connection.CreateModel();
            channel.QueueDeclare(queue: Queues.ReponseQueue, exclusive: false);
            channel.QueueDeclare(queue: Queues.NotificationQueue,
                                 durable: true,
                                 exclusive: false,
                                 autoDelete: true,
                                 arguments: null);
            consumer = new EventingBasicConsumer(channel);
            channel.BasicConsume(queue: Queues.ReponseQueue, noAck: false, consumer: consumer);
        }
Ejemplo n.º 3
0
        public Matrix(int rowCount, int colCount)
        {
            var rnd    = new Random();
            var matrix = new double[rowCount, colCount];

            for (int row = 0; row < rowCount; row++)
            {
                for (int col = 0; col < colCount; col++)
                {
                    var value = Min + (rnd.NextDouble() * (Max - Min));
                    matrix[row, col] = Math.Round(value, 2);
                }
            }
            _accessor = new MatrixAccessor(matrix);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            MatrixAccessor inputContainer;

            try
            {
                inputContainer = new MatrixAccessor();
                using (MQClient worker = new MQClient(inputContainer))
                {
                    worker.Run();
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Worker could not load input matrixes");
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            //DependencyFactory factory = new DependencyFactory();

            //var serilaize = factory.Container
            WorkerTimeLogger logger = new WorkerTimeLogger();
            MatrixAccessor   inputContainer;

            inputContainer = new MatrixAccessor();
            using (MQClient client = new MQClient(inputContainer, logger))
            {
                client.Run();
            }
            string path = Environment.CurrentDirectory + @"\log.txt";

            using (StreamWriter sw = new StreamWriter(path))
            {
                logger.SaveLog(sw);
            }
        }
Ejemplo n.º 6
0
        public MQClient(MatrixAccessor inputContainer)
        {
            worker = new Worker(inputContainer);

            var factory = new ConnectionFactory()
            {
                HostName    = MQServerConfig.IP,
                Port        = MQServerConfig.PORT,
                UserName    = MQServerConfig.USER,
                Password    = MQServerConfig.USER,
                VirtualHost = MQServerConfig.VHOST
            };

            connection = factory.CreateConnection();
            channel    = connection.CreateModel();
            channel.QueueDeclare(queue: Queues.MessageQueue,
                                 durable: false,
                                 exclusive: false,
                                 autoDelete: true,
                                 arguments: null);
            channel.BasicQos(0, 1, false);
            consumer = new EventingBasicConsumer(channel);
            channel.BasicConsume(queue: Queues.MessageQueue, noAck: false, consumer: consumer);
        }
Ejemplo n.º 7
0
 public Matrix(MatrixAccessor accessor) => _accessor = accessor;
Ejemplo n.º 8
0
 public Matrix(double[,] matrix)
 {
     _accessor = new MatrixAccessor(matrix);
 }
Ejemplo n.º 9
0
    // Whether the elements should be accessed in row-major order.
    // Toggling this is equivalent to transposing the array.
    //bool rowMajor;

    public List2(List <T> rowMajorCollection, MatrixAccessor accessor)
    {
        collection    = rowMajorCollection;
        this.accessor = accessor;
    }
Ejemplo n.º 10
0
 public MatrixAssembler(MatrixAccessor container)
 {
     this.container = container;
 }
Ejemplo n.º 11
0
 public Worker(MatrixAccessor inputContainer)
 {
     this.inputContainer = inputContainer;
     id = Guid.NewGuid().ToString();
     Console.WriteLine(string.Format("Worker with id {0}, created...", id));
 }
Ejemplo n.º 12
0
 public Dispatcher(MatrixAccessor container)
 {
     this.container = container;
     uowGen         = new UOWGenerator(container);
     stopwatch      = new Stopwatch();
 }
Ejemplo n.º 13
0
 public UOWGenerator(MatrixAccessor container)
 {
     this.container = container;
 }