Package org.jruby.java.proxies

Examples of org.jruby.java.proxies.ArrayJavaProxy.dataWrapStruct()


    public IRubyObject emptyJavaArray(ThreadContext context) {
        JavaArray javaArray = new JavaArray(getRuntime(), Array.newInstance(javaClass(), 0));
        RubyClass proxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());
       
        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), proxyClass);
        proxy.dataWrapStruct(javaArray);
       
        return proxy;
    }
  
    public IRubyObject javaArraySubarray(ThreadContext context, JavaArray fromArray, int index, int size) {
View Full Code Here


            JavaArray javaArray = new JavaArray(getRuntime(), newArray);
            System.arraycopy(fromArray.getValue(), index, newArray, 0, size);
            RubyClass proxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

            ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), proxyClass);
            proxy.dataWrapStruct(javaArray);

            return proxy;
        }
    }
  
View Full Code Here

        System.arraycopy(original.getValue(), 0, newArray, 0, oldLength);
        System.arraycopy(additional.getValue(), 0, newArray, oldLength, addLength);
        RubyClass proxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), proxyClass);
        proxy.dataWrapStruct(javaArray);

        return proxy;
    }
  
    /**
 
View Full Code Here

        Object newArray = Array.newInstance(javaClass(), oldLength + addLength);
        JavaArray javaArray = new JavaArray(getRuntime(), newArray);
        System.arraycopy(original.getValue(), 0, newArray, 0, oldLength);
        RubyClass proxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());
        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), proxyClass);
        proxy.dataWrapStruct(javaArray);
       
        Ruby runtime = context.getRuntime();
        for (int i = 0; i < addLength; i++) {
            RuntimeHelpers.invoke(context, proxy, "[]=", runtime.newFixnum(oldLength + i),
                    RuntimeHelpers.invoke(context, additional, "[]", runtime.newFixnum(i)));
View Full Code Here

        }
       
        RubyClass proxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

        ArrayJavaProxy proxy = new ArrayJavaProxy(runtime, proxyClass);
        proxy.dataWrapStruct(javaArray);
       
        return proxy;
    }

    @JRubyMethod
View Full Code Here

    public IRubyObject emptyJavaArray(ThreadContext context) {
        JavaArray javaArray = new JavaArray(getRuntime(), Array.newInstance(javaClass(), 0));
        RubyClass newProxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());
       
        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), newProxyClass);
        proxy.dataWrapStruct(javaArray);
       
        return proxy;
    }
  
    public IRubyObject javaArraySubarray(ThreadContext context, JavaArray fromArray, int index, int size) {
View Full Code Here

            JavaArray javaArray = new JavaArray(getRuntime(), newArray);
            System.arraycopy(fromArray.getValue(), index, newArray, 0, size);
            RubyClass newProxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

            ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), newProxyClass);
            proxy.dataWrapStruct(javaArray);

            return proxy;
        }
    }
  
View Full Code Here

        System.arraycopy(original.getValue(), 0, newArray, 0, oldLength);
        System.arraycopy(additional.getValue(), 0, newArray, oldLength, addLength);
        RubyClass newProxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), newProxyClass);
        proxy.dataWrapStruct(javaArray);

        return proxy;
    }
  
    /**
 
View Full Code Here

        Object newArray = Array.newInstance(javaClass(), oldLength + addLength);
        JavaArray javaArray = new JavaArray(getRuntime(), newArray);
        System.arraycopy(original.getValue(), 0, newArray, 0, oldLength);
        RubyClass newProxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());
        ArrayJavaProxy proxy = new ArrayJavaProxy(context.getRuntime(), newProxyClass);
        proxy.dataWrapStruct(javaArray);
       
        Ruby runtime = context.getRuntime();
        for (int i = 0; i < addLength; i++) {
            RuntimeHelpers.invoke(context, proxy, "[]=", runtime.newFixnum(oldLength + i),
                    RuntimeHelpers.invoke(context, additional, "[]", runtime.newFixnum(i)));
View Full Code Here

        }
       
        RubyClass newProxyClass = (RubyClass)Java.get_proxy_class(javaArray, array_class());

        ArrayJavaProxy proxy = new ArrayJavaProxy(runtime, newProxyClass);
        proxy.dataWrapStruct(javaArray);
       
        return proxy;
    }

    @JRubyMethod
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.