public PrimitiveCalculator(AdditionStrategy additionStrategy, SubtractionStrategy subtractionStrategy, MultiplyStrategy multiplyStrategy, DivideStrategy divideStrategy) { this.additionStrategy = additionStrategy; this.subtractionStrategy = subtractionStrategy; this.multiplyStrategy = multiplyStrategy; this.divideStrategy = divideStrategy; this.additionValue = additionStrategy; }
public void ChangeStrategy(char @operator) { switch (@operator) { case '+': this.additionValue = this.additionStrategy; break; case '-': this.additionValue = this.subtractionStrategy; break; case '*': this.additionValue = this.multiplyStrategy; break; case '/': this.additionValue = this.divideStrategy; break; } }