Browse Source

增加说明文档

master
richie 6 years ago
parent
commit
c382f09445
  1. 0
      lib/report/.gitkeep
  2. 16
      readme.md
  3. BIN
      screenshots/1.png
  4. BIN
      screenshots/2.png
  5. 4
      src/main/java/com/fr/plugin/function/fib/Fibonacci.java

0
lib/report/.gitkeep

16
readme.md

@ -0,0 +1,16 @@
# 斐波那契数列计算函数
用于斐波那契数列中第N个元素的值,在报表模板中设置格子的值为公式:
```
=Fibonacci(50)
```
模板设置如图所示:
![tpl](screenshots/1.png)
报表展示结果如下图所示:
![show](screenshots/2.png)

BIN
screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

4
src/main/java/com/fr/plugin/function/fib/Fibonacci.java

@ -24,7 +24,7 @@ public class Fibonacci extends AbstractFunction {
return getFib(n); return getFib(n);
} }
private int getFib(int n) { private long getFib(int n) {
if (n < 0) { if (n < 0) {
return -1; return -1;
} else if (n == 0) { } else if (n == 0) {
@ -32,7 +32,7 @@ public class Fibonacci extends AbstractFunction {
} else if (n == 1 || n == 2) { } else if (n == 1 || n == 2) {
return 1; return 1;
} else { } else {
int[] fibAry = new int[n + 1]; long[] fibAry = new long[n + 1];
fibAry[0] = 0; fibAry[0] = 0;
fibAry[1] = fibAry[2] = 1; fibAry[1] = fibAry[2] = 1;
for (int i = 3; i <= n; i++) { for (int i = 3; i <= n; i++) {

Loading…
Cancel
Save