Example #1
0
        /// <inheritdoc/>
        public void PerformAction(ALUCalculation calculation, int value)
        {
            switch (calculation)
            {
            case ALUCalculation.Add:
                this.Add();
                break;

            case ALUCalculation.And:
                this.And();
                break;

            case ALUCalculation.Divide:
                this.Divide();
                break;

            case ALUCalculation.Multiply:
                this.Multiply();
                break;

            case ALUCalculation.Not:
                this.Not();
                break;

            case ALUCalculation.ShiftLeft:
                this.ShiftLeft(value);
                break;

            case ALUCalculation.ShiftRight:
                this.ShiftRight(value);
                break;

            case ALUCalculation.ShiftRightZeroFill:
                this.ShiftRightZeroFill(value);
                break;

            case ALUCalculation.Subtract:
                this.Subtract();
                break;

            case ALUCalculation.Xor:
                this.Xor();
                break;
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Calculator"/> class.
 /// </summary>
 /// <param name="calculation">Calculation choice.</param>
 public Calculator(ALUCalculation calculation)
 {
     this.calculation = calculation;
 }
Example #3
0
 /// <inheritdoc/>
 public void PerformAction(ALUCalculation calculation)
 {
     this.PerformAction(calculation, 0);
 }