File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
src/ChainOfResponsibility Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ package ChainOfResponsibility ;
2
+
3
+ public class Functions {
4
+
5
+ public static final String ADDITION ="add" ;
6
+ public static final String SUBTRACTION ="sub" ;
7
+ public static final String MULTIPLICATION ="mul" ;
8
+ public static final String DIVISION ="div" ;
9
+
10
+ }
Original file line number Diff line number Diff line change
1
+ package ChainOfResponsibility ;
2
+
3
+ public abstract class Handler {
4
+
5
+ protected Handler handler ;
6
+
7
+ public void next (Handler handler )
8
+ {
9
+ this .handler =handler ;
10
+ }
11
+
12
+ public abstract void handle (Numbers request );
13
+
14
+ }
Original file line number Diff line number Diff line change
1
+ package ChainOfResponsibility ;
2
+
3
+ public class Numbers {
4
+
5
+ private int num1 ;
6
+ private int num2 ;
7
+ private String func ;
8
+
9
+ public Numbers (int num1 ,int num2 ,String func )
10
+ {
11
+ this .num1 =num1 ;
12
+ this .num2 =num2 ;
13
+ this .func =func ;
14
+ }
15
+
16
+ public int getNum1 ()
17
+ {
18
+ return num1 ;
19
+ }
20
+
21
+ public int getNum2 ()
22
+ {
23
+ return num2 ;
24
+ }
25
+
26
+ public String getFunc ()
27
+ {
28
+ return func ;
29
+ }
30
+
31
+ }
You can’t perform that action at this time.
0 commit comments