public static IRubyObject emptyJavaArrayDirect(ThreadContext context, Class componentType) { return newProxiedArray(context.runtime, componentType, 0); }
public static IRubyObject emptyJavaArrayDirect(ThreadContext context, Class componentType) { Ruby runtime = context.runtime; return newProxiedArray(runtime, componentType, 0); }
public static IRubyObject emptyJavaArrayDirect(ThreadContext context, Class componentType) { Ruby runtime = context.runtime; return newProxiedArray(runtime, componentType, 0); }
public static IRubyObject emptyJavaArrayDirect(ThreadContext context, Class componentType) { return newProxiedArray(context.runtime, componentType, 0); }
public static IRubyObject javaArraySubarrayDirect(ThreadContext context, Object fromArray, int index, int size) { int actualLength = Array.getLength(fromArray); if (index >= actualLength) return context.nil; if (index + size > actualLength) { size = actualLength - index; } ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(context.runtime, fromArray.getClass().getComponentType(), size); Object newArray = proxy.getObject(); System.arraycopy(fromArray, index, newArray, 0, size); return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) { int oldLength = Array.getLength(original); int addLength = Array.getLength(additional); ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); System.arraycopy(additional, 0, newArray, oldLength, addLength); return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) { int oldLength = Array.getLength(original); int addLength = Array.getLength(additional); ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); System.arraycopy(additional, 0, newArray, oldLength, addLength); return proxy; }
public static IRubyObject javaArraySubarrayDirect(ThreadContext context, Object fromArray, int index, int size) { int actualLength = Array.getLength(fromArray); if (index >= actualLength) return context.nil; if (index + size > actualLength) { size = actualLength - index; } ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(context.runtime, fromArray.getClass().getComponentType(), size); Object newArray = proxy.getObject(); System.arraycopy(fromArray, index, newArray, 0, size); return proxy; }
public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class<?> componentType, int size) { return newProxiedArray(runtime, componentType, JavaUtil.getJavaConverter(componentType), size); }
public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class componentType, int size) { return newProxiedArray(runtime, componentType, JavaUtil.getJavaConverter(componentType), size); }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) { int oldLength = Array.getLength(original); int addLength = Array.getLength(additional); ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); System.arraycopy(additional, 0, newArray, oldLength, addLength); return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) { int oldLength = Array.getLength(original); int addLength = Array.getLength(additional); ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); System.arraycopy(additional, 0, newArray, oldLength, addLength); return proxy; }
public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class componentType, int size) { return newProxiedArray(runtime, componentType, JavaUtil.getJavaConverter(componentType), size); }
public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class<?> componentType, int size) { return newProxiedArray(runtime, componentType, JavaUtil.getJavaConverter(componentType), size); }
public static IRubyObject javaArraySubarrayDirect(ThreadContext context, Object fromArray, int index, int size) { int actualLength = Array.getLength(fromArray); if (index >= actualLength) { return context.runtime.getNil(); } else { if (index + size > actualLength) { size = actualLength - index; } ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(context.runtime, fromArray.getClass().getComponentType(), size); Object newArray = proxy.getObject(); System.arraycopy(fromArray, index, newArray, 0, size); return proxy; } }
public static IRubyObject javaArraySubarrayDirect(ThreadContext context, Object fromArray, int index, int size) { int actualLength = Array.getLength(fromArray); if (index >= actualLength) { return context.runtime.getNil(); } else { if (index + size > actualLength) { size = actualLength - index; } ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(context.runtime, fromArray.getClass().getComponentType(), size); Object newArray = proxy.getObject(); System.arraycopy(fromArray, index, newArray, 0, size); return proxy; } }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, IRubyObject additional) { final Ruby runtime = context.runtime; final int oldLength = Array.getLength(original); final int addLength = RubyFixnum.fix2int(Helpers.invoke(context, additional, "length")); ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(runtime, original.getClass().getComponentType(), oldLength + addLength); System.arraycopy(original, 0, proxy.getObject(), 0, oldLength); for (int i = 0; i < addLength; i++) { IRubyObject val = Helpers.invoke(context, additional, "[]", runtime.newFixnum(i)); proxy.setValue(runtime, oldLength + i, val); // [ oldLen + i ] = val } return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, IRubyObject additional) { final Ruby runtime = context.runtime; final int oldLength = Array.getLength(original); final int addLength = RubyFixnum.fix2int(Helpers.invoke(context, additional, "length")); ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(runtime, original.getClass().getComponentType(), oldLength + addLength); System.arraycopy(original, 0, proxy.getObject(), 0, oldLength); for (int i = 0; i < addLength; i++) { IRubyObject val = Helpers.invoke(context, additional, "[]", runtime.newFixnum(i)); proxy.setValue(runtime, oldLength + i, val); // [ oldLen + i ] = val } return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, IRubyObject additional) { Ruby runtime = context.runtime; int oldLength = Array.getLength(original); int addLength = (int)((RubyFixnum) Helpers.invoke(context, additional, "length")).getLongValue(); ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); for (int i = 0; i < addLength; i++) { Helpers.invoke(context, proxy, "[]=", runtime.newFixnum(oldLength + i), Helpers.invoke(context, additional, "[]", runtime.newFixnum(i))); } return proxy; }
public static IRubyObject concatArraysDirect(ThreadContext context, Object original, IRubyObject additional) { Ruby runtime = context.runtime; int oldLength = Array.getLength(original); int addLength = (int)((RubyFixnum) Helpers.invoke(context, additional, "length")).getLongValue(); ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(runtime, original.getClass().getComponentType(), oldLength + addLength); Object newArray = proxy.getObject(); System.arraycopy(original, 0, newArray, 0, oldLength); for (int i = 0; i < addLength; i++) { Helpers.invoke(context, proxy, "[]=", runtime.newFixnum(oldLength + i), Helpers.invoke(context, additional, "[]", runtime.newFixnum(i))); } return proxy; }