diff --git a/plugin-function/build.xml b/plugin-function/build.xml index e807443..7fe1db7 100644 --- a/plugin-function/build.xml +++ b/plugin-function/build.xml @@ -5,7 +5,7 @@ - + diff --git a/plugin-function/lib/report/.gitkeep b/plugin-function/lib/report/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin-function/plugin.xml b/plugin-function/plugin.xml index 9c96a7f..a45d02f 100644 --- a/plugin-function/plugin.xml +++ b/plugin-function/plugin.xml @@ -15,4 +15,5 @@ + \ No newline at end of file diff --git a/plugin-function/src/main/java/com/fr/plugin/MyAbs.java b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java index c5ed012..ffddecc 100644 --- a/plugin-function/src/main/java/com/fr/plugin/MyAbs.java +++ b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java @@ -24,13 +24,24 @@ public class MyAbs extends AbstractFunction { if (len == 0) { return Primitive.ERROR_VALUE; } else if (len == 1) { - return Math.abs(GeneralUtils.objectToNumber(args[0]).doubleValue()); + Object one = args[0]; + if (one instanceof FArray) { + FArray data = (FArray)one; + FArray result = new FArray(); + for (Object el : data) { + result.add(Math.abs(GeneralUtils.objectToNumber(el).doubleValue())); + } + return result; + } else { + return Math.abs(GeneralUtils.objectToNumber(one).doubleValue()); + } } else { FArray result = new FArray(); for (Object arg : args) { - result.add(GeneralUtils.objectToNumber(arg).doubleValue()); + result.add(Math.abs(GeneralUtils.objectToNumber(arg).doubleValue())); } + return result; } - return Primitive.ERROR_VALUE; + } }