-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.java
71 lines (69 loc) · 3.71 KB
/
View.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/** ***********************************************************************************************************************
* View class - The View represents a user entered command or request.
* The View is used by the Controller to build a Session to store on the sessionStack.
*
* Collection of method to manage the view attributes.
* Extends Request class.
*
*
* ***********************************************************************************************************************
*/
public class View extends Request {
private String type;
private String operator;
private String operand1;
private String operand2;
/** ************************************************************************************************************************
* View() - default constructor. *
* **************************************************************************************************************************
*/
// default constructor
public View () {
}
/** ***********************************************************************************************************************
* View(String type, String operator, String operand1, String operand2) - Binary View constructor.
* @param type indicates the type of session being created.
* @param operator represents a calculator command.
* @param operand1 value to be used in computation.
* @param operand2 value to be used in computation.
* *************************************************************************************************************************
*/
// object constructor
public View (String type, String operator, String operand1, String operand2) {
super(type, operator);
setOperand1(operand1);
setOperand2(operand2);
}
/** ***********************************************************************************************************************
* setOperand1(String operand1) - Sets this.operand1 to the value of operand1 passed in as a parameter. *
* @param operand1 to be used in computation. *
* *************************************************************************************************************************
*/
public void setOperand1(String operand1) {
this.operand1 = operand1;
}
/** ***********************************************************************************************************************
* getOperand1() - Returns the current value of 'operand1'. *
* @return operand1 *
* *************************************************************************************************************************
*/
public String getOperand1() {
return this.operand1;
}
/** ***********************************************************************************************************************
* setOperand2(String operand2) - Sets this.operand2 to the value of operand2 passed in as a parameter. *
* @param operand2 to be used in computation. *
* *************************************************************************************************************************
*/
public void setOperand2(String operand2) {
this.operand2 = operand2;
}
/** ***********************************************************************************************************************
* getOperand2() - Returns the current value of 'operand2'. *
* @return operand2 *
* *************************************************************************************************************************
*/
public String getOperand2() {
return this.operand2;
}
}