Skip to content

Commit 27a7863

Browse files
committed
Chain Of Responsibility basic Structure Created
1 parent 38753f1 commit 27a7863

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

0 commit comments

Comments
 (0)