Line | |
---|
1 | package omq.test.calculator; |
---|
2 | |
---|
3 | import omq.server.RemoteObject; |
---|
4 | |
---|
5 | /** |
---|
6 | * |
---|
7 | * @author Sergi Toda <sergi.toda@estudiants.urv.cat> |
---|
8 | * |
---|
9 | */ |
---|
10 | public class CalculatorImpl extends RemoteObject implements Calculator { |
---|
11 | private int mult = 0; |
---|
12 | |
---|
13 | public CalculatorImpl() throws Exception { |
---|
14 | super(); |
---|
15 | } |
---|
16 | |
---|
17 | private static final long serialVersionUID = 1L; |
---|
18 | |
---|
19 | @Override |
---|
20 | public int add(int x, int y) { |
---|
21 | return x + y; |
---|
22 | } |
---|
23 | |
---|
24 | @Override |
---|
25 | public void mult(int x, int y) { |
---|
26 | mult = x * y; |
---|
27 | } |
---|
28 | |
---|
29 | public int getMult() { |
---|
30 | return mult; |
---|
31 | } |
---|
32 | |
---|
33 | public void setMult(int mult) { |
---|
34 | this.mult = mult; |
---|
35 | } |
---|
36 | |
---|
37 | @Override |
---|
38 | public void sendMessage(Message m) { |
---|
39 | System.out.println("Code = " + m.getCode()); |
---|
40 | System.out.println("Message = " + m.getMessage()); |
---|
41 | } |
---|
42 | |
---|
43 | @Override |
---|
44 | public int divideByZero() { |
---|
45 | int x = 2 / 0; |
---|
46 | return x; |
---|
47 | } |
---|
48 | |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.