Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     OperandA.Init();
     OperandB.Init();
     Result.Init();
 }
Exemplo n.º 2
0
        private void Cp_MouseDown(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
                OperandA.Rows.Clear();
                OperandA.Columns.Clear();
                OperandA.Init(Result.RowCount, Result.ColumnCount);
                for (int x = 0; x < Result.ColumnCount; x++)
                {
                    for (int y = 0; y < Result.RowCount; y++)
                    {
                        OperandA[x, y].Value = Result[x, y].Value;
                    }
                }
                break;

            case MouseButtons.Right:
                OperandB.Rows.Clear();
                OperandB.Columns.Clear();
                OperandB.Init(Result.RowCount, Result.ColumnCount);
                for (int x = 0; x < Result.ColumnCount; x++)
                {
                    for (int y = 0; y < Result.RowCount; y++)
                    {
                        OperandB[x, y].Value = Result[x, y].Value;
                    }
                }
                break;
            }
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override object Evaluate(IDnlibDef definition)
        {
            var a = (bool)OperandA.Evaluate(definition);

            if (!a)
            {
                return(false);
            }
            return((bool)OperandB.Evaluate(definition));
        }
Exemplo n.º 4
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            int a = OperandA.Get <int>(executionContext);
            int b = OperandB.Get <int>(executionContext);

            tracingService.Trace($"Adding '{a}' to '{b}'.");

            Result.Set(executionContext, a + b);

            tracingService.Trace($"Result set to '{a + b}'.");
        }
Exemplo n.º 5
0
        private void Cls_MouseDown(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
                OperandA.Rows.Clear();
                OperandA.Columns.Clear();
                OperandA.Init();
                break;

            case MouseButtons.Right:
                OperandB.Rows.Clear();
                OperandB.Columns.Clear();
                OperandB.Init();
                break;
            }
        }
Exemplo n.º 6
0
        private void ToolStripButton1_Click(object sender, EventArgs e)
        {
            Form2 dialog = new Form2();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.LR.Checked)
                {
                    OperandB.Rows.Clear();
                    OperandB.Columns.Clear();
                    OperandB.Init((int)dialog.row.Value, (int)dialog.colm.Value);
                }
                else
                {
                    OperandA.Rows.Clear();
                    OperandA.Columns.Clear();
                    OperandA.Init((int)dialog.row.Value, (int)dialog.colm.Value);
                }
            }
        }
Exemplo n.º 7
0
        private void Transpose_MouseDown(object sender, MouseEventArgs e)
        {
            try {
                Matrix temp = new Matrix(1, 1);
                switch (e.Button)
                {
                case MouseButtons.Left:
                    temp = new Matrix(OperandA.ToDoubleArray());
                    temp = temp.Transpose();
                    break;

                case MouseButtons.Right:
                    temp = new Matrix(OperandB.ToDoubleArray());
                    temp = temp.Transpose();
                    break;
                }
                Result.ToDisplay(temp);
            }
            catch (Exception A) {
                MessageBox.Show(A.Message);
            }
        }
Exemplo n.º 8
0
        private void Mult_MouseDown(object sender, MouseEventArgs e)
        {
            try {
                Matrix L   = new Matrix(OperandA.ToDoubleArray());
                Matrix R   = new Matrix(OperandB.ToDoubleArray());
                Matrix res = new Matrix(1, 1);
                switch (e.Button)
                {
                case MouseButtons.Left:
                    res = L * R;
                    break;

                case MouseButtons.Right:
                    res = R * L;
                    break;
                }
                Result.ToDisplay(res);
            }
            catch (Exception A) {
                MessageBox.Show(A.Message);
            }
        }
Exemplo n.º 9
0
        private void Det_MouseDown(object sender, MouseEventArgs e)
        {
            try {
                Matrix temp;
                double det = 0;
                switch (e.Button)
                {
                case MouseButtons.Left:
                    temp = new Matrix(OperandA.ToDoubleArray());
                    det  = temp.Determinant;
                    break;

                case MouseButtons.Right:
                    temp = new Matrix(OperandB.ToDoubleArray());
                    det  = temp.Determinant;
                    break;
                }
                Result.ToDisplay(det);
            }
            catch (Exception A) {
                MessageBox.Show(A.Message);
            }
        }
Exemplo n.º 10
0
 public override void VisitPreOrder(ExpressionVisitor visitor)
 {
     visitor.VisitPreOrder(this);
     OperandA.VisitPreOrder(visitor);
     OperandB.VisitPreOrder(visitor);
 }
Exemplo n.º 11
0
 public override string ToString()
 {
     return("|  " + Operator.ToString() + "  |  " + OperandA.ToString() + "  |  " + OperandB.ToString() + "  |  " + Result.ToString() + "  |");
 }
Exemplo n.º 12
0
 private void OperandA_Resize(object sender, EventArgs e)
 {
     OperandA.RowFill();
     OperandB.RowFill();
     Result.RowFill();
 }
Exemplo n.º 13
0
 private void OperandA_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
 {
     OperandA.RowFill();
     OperandB.RowFill();
     Result.RowFill();
 }