public static MachineForm create(int rowIndex)
        {
            MachineForm form = new MachineForm();
            form.init(0, rowIndex);

            return form;
        }
        public static MachineForm createFrom(int depth, int rowIndex, List <Machine> machines)
        {
            MachineForm form = new MachineForm();

            foreach (var machine in machines)
            {
                if (machine.position == Machine.sell)
                {
                    form.incrementSellAmount();
                }

                if (machine.position == Machine.buy)
                {
                    form.incrementBuyAmount();
                }

                if (machine.position == Machine.neutral)
                {
                    form.incrementNeutralAmount();
                }

                if (machine.blocked)
                {
                    form.addBlockedAmount();
                }
            }

            form.init(depth, rowIndex);

            return(form);
        }
        public static MachineForm create(int rowIndex)
        {
            MachineForm form = new MachineForm();

            form.init(0, rowIndex);

            return(form);
        }
Exemplo n.º 4
0
        private void addButtonClicked(object sender, EventArgs e)
        {
            MachineForm machineForm = MachineForm.create(machineForms.Count);

            addMachineForms(new List <MachineForm>()
            {
                machineForm
            });
        }
        public static List <MachineForm> build(Portfolio portfolio)
        {
            List <MachineForm> machinesForms = new List <MachineForm>();

            int index = 0;
            Dictionary <Int32, List <Machine> > map = collect(portfolio);

            foreach (var depth in map.Keys)
            {
                List <Machine> machines;
                map.TryGetValue(depth, out machines);

                machinesForms.Add(MachineForm.createFrom(depth, index++, machines));
            }

            return(machinesForms);
        }
        public static MachineForm createFrom(int depth, int rowIndex, List<Machine> machines)
        {
            MachineForm form = new MachineForm();

            foreach (var machine in machines)
            {
                if (machine.position == Machine.sell)
                    form.incrementSellAmount();

                if (machine.position == Machine.buy)
                    form.incrementBuyAmount();

                if (machine.position == Machine.neutral)
                    form.incrementNeutralAmount();

                if (machine.blocked)
                    form.addBlockedAmount();
            }

            form.init(depth, rowIndex);

            return form;
        }