public Form1() { InitializeComponent(); OperandA.Init(); OperandB.Init(); Result.Init(); }
public override bool Evaluate() { switch (Operator) { case ConditionOperator.EQUAL: return(OperandA.Equals(OperandB)); case ConditionOperator.NOT_EQUAL: return(!(OperandA.Equals(OperandB))); case ConditionOperator.MORE_THAN: return(OperandA > OperandB); case ConditionOperator.AT_LEAST: return(OperandA >= OperandB); case ConditionOperator.LESS_THAN: return(OperandA < OperandB); case ConditionOperator.AT_MOST: return(OperandA <= OperandB); default: return(false); } }
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; } }
/// <inheritdoc /> public override object Evaluate(IDnlibDef definition) { var a = (bool)OperandA.Evaluate(definition); if (!a) { return(false); } return((bool)OperandB.Evaluate(definition)); }
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}'."); }
/// <inheritdoc /> public override void Serialize(IList <PatternToken> tokens) { if (IsUnary) { tokens.Add(new PatternToken(TokenType.Identifier, Name)); OperandA.Serialize(tokens); } else { OperandA.Serialize(tokens); tokens.Add(new PatternToken(TokenType.Identifier, Name)); OperandB.Serialize(tokens); } }
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; } }
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); } } }
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); } }
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); } }
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); } }
/// <inheritdoc /> public override object Evaluate(IDnlibDef definition) { return(!(bool)OperandA.Evaluate(definition)); }
public override void VisitPreOrder(ExpressionVisitor visitor) { visitor.VisitPreOrder(this); OperandA.VisitPreOrder(visitor); OperandB.VisitPreOrder(visitor); }
public override string ToString() { return("| " + Operator.ToString() + " | " + OperandA.ToString() + " | " + OperandB.ToString() + " | " + Result.ToString() + " |"); }
private void OperandA_Resize(object sender, EventArgs e) { OperandA.RowFill(); OperandB.RowFill(); Result.RowFill(); }
private void OperandA_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { OperandA.RowFill(); OperandB.RowFill(); Result.RowFill(); }