Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Add support for double[] arrays in DataClass

    Basically, I think just the following would need to be added to add support for double[] arrays:
    In DataClass.java:
    Code:
        public double[] getAttributeAsDoubleArray(String property) {
            return JSOHelper.getAttributeAsDoubleArray(jsObj, property);
        }
    
        public static void setAttribute(JavaScriptObject elem, String attr, double[] values) {
            setAttribute(elem, attr, JSOHelper.convertToJavaScriptArray(values));
        }
    and in JSOHelper.java

    Code:
        public static JavaScriptObject convertToJavaScriptArray(double[] array) {
            if(array == null) return null;
            JavaScriptObject jsArray = createJavaScriptArray();
            for (int i = 0; i < array.length; i++) {
                JSOHelper.setArrayValue(jsArray, i, array[i]);
            }
            return jsArray;
        }

    #2
    OK, I created a patch to a recent SVN version (see attachement). Seems to work in all my cases. I'd be glad if you could include it into the official build.
    Attached Files

    Comment


      #3
      Added to SVN, thanks.

      Comment

      Working...
      X