source: trunk/src/test/java/omq/test/python/CalculatorImpl.java @ 83

Last change on this file since 83 was 83, checked in by stoda, 11 years ago

J

File size: 647 bytes
Line 
1package omq.test.python;
2
3import omq.server.RemoteObject;
4
5/**
6 *
7 * @author Sergi Toda <sergi.toda@estudiants.urv.cat>
8 *
9 */
10public class CalculatorImpl extends RemoteObject implements Calculator {
11
12        /**
13         *
14         */
15        private static final long serialVersionUID = 1L;
16
17        @Override
18        public void fibonacci(int x) {
19                System.out.println(fib(x));
20        }
21
22        public int fib(int x) {
23                if (x == 0) {
24                        return 0;
25                }
26                if (x == 1) {
27                        return 1;
28                }
29                return fib(x - 1) + fib(x - 2);
30        }
31
32        public int add(int x, int y) {
33                System.out.println("add: " + x + "+" + y + "=" + (x + y));
34                return x + y;
35        }
36
37        @Override
38        public double getPi() {
39                return 3.1415;
40        }
41
42}
Note: See TracBrowser for help on using the repository browser.