public abstract class Operation extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
leftOperand |
protected int |
rightOperand |
| Constructor and Description |
|---|
Operation(int leftOperand,
int rightOperand)
Constructor for a simple operation without composition
|
Operation(int leftOperand,
Operation rightOperation)
Constructor for a complex operation where left is an integer and right another operation
|
Operation(Operation leftOperation,
int rightOperand)
Constructor for a complex operation where left is an operation and right is an integer
|
Operation(Operation leftOperation,
Operation rightOperation)
Constructor for a complex operation where left and right are also operations
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
calculate()
Delegates the operation between two integers to the subclasses
|
int |
getLeftOperand() |
Operation |
getLeftOperation() |
int |
getRightOperand() |
Operation |
getRightOperation() |
int |
process()
Process the operation and take care about the composition of the operations
|
public Operation(int leftOperand,
int rightOperand)
leftOperand - Left operand is an integerrightOperand - Right operand is an integerpublic Operation(Operation leftOperation, Operation rightOperation)
leftOperation - Left is an operationrightOperation - Right is an operationpublic Operation(int leftOperand,
Operation rightOperation)
leftOperand - Left is an integerrightOperation - Right is an operationpublic Operation(Operation leftOperation, int rightOperand)
leftOperation - Left is an operationrightOperand - Right is an integerpublic int process()
public Operation getLeftOperation()
public Operation getRightOperation()
public int getLeftOperand()
public int getRightOperand()
protected abstract int calculate()
Copyright © 2015. All rights reserved.