-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arithmetics.java
43 lines (38 loc) · 1.31 KB
/
Arithmetics.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
/**
*
* @author jomarin
*/
public class Arithmetics {
static {
System.load("/Users/jomarin/tesr/libarithmetics.so");
}
// Native methods
public native double addValues(double addendOne, double addendTwo);
public native double substractValues(double minuend, double subtrahend);
public native double multiplyValues(double multiplier, double multiplicand);
public native double divideValues(double dividend, double divisor);
public native double complimentValue(double value);
// Methods
public double doOperation(double pX, double pY, String pOperation){
double result;
switch (pOperation) {
case "+":
result = addValues(pX, pY);
break;
case "-":
result = substractValues(pX, pY);
break;
case "/":
result = divideValues(pX, pY);
break;
case "*":
result = multiplyValues(pX, pY);
break;
default:
result = 0;
break;
}
return result;
}
public Arithmetics(){};
}