public IRubyObject aset(IRubyObject index, IRubyObject value) { if (! (index instanceof RubyInteger)) { throw getRuntime().newTypeError(index, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) index).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), javaObject, intIndex, javaObject); return value; }
public IRubyObject aset(IRubyObject index, IRubyObject value) { if (! (index instanceof RubyInteger)) { throw getRuntime().newTypeError(index, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) index).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), javaObject, intIndex, javaObject); return value; }
public IRubyObject aset(IRubyObject index, IRubyObject value) { if (! (index instanceof RubyInteger)) { throw getRuntime().newTypeError(index, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) index).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), javaObject, intIndex, javaObject); return value; }
public IRubyObject aset(IRubyObject index, IRubyObject value) { if (! (index instanceof RubyInteger)) { throw getRuntime().newTypeError(index, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) index).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), javaObject, intIndex, javaObject); return value; }
public final void fillWithExceptionHandling(int start, int end, Object javaValue) { final Ruby runtime = getRuntime(); final Object array = getValue(); for (int i = start; i < end; i++) { ArrayUtils.setWithExceptionHandlingDirect(runtime, array, i, javaValue); } } }
public final void fillWithExceptionHandling(int start, int end, Object javaValue) { final Ruby runtime = getRuntime(); final Object array = getValue(); for (int i = start; i < end; i++) { ArrayUtils.setWithExceptionHandlingDirect(runtime, array, i, javaValue); } } }
public IRubyObject afill(IRubyObject beginIndex, IRubyObject endIndex, IRubyObject value) { if (! (beginIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(beginIndex, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) beginIndex).getLongValue(); if (! (endIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(endIndex, getRuntime().getInteger()); } int intEndIndex = (int) ((RubyInteger) endIndex).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaValue = ((JavaObject) value).getValue(); fillWithExceptionHandling(intIndex, intEndIndex, javaValue); return value; }
public void setWithExceptionHandling(int intIndex, Object javaObject) { ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), getValue(), intIndex, javaObject); }
public void setWithExceptionHandling(int intIndex, Object javaObject) { ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), getValue(), intIndex, javaObject); }
public IRubyObject afill(IRubyObject beginIndex, IRubyObject endIndex, IRubyObject value) { if (! (beginIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(beginIndex, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) beginIndex).getLongValue(); if (! (endIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(endIndex, getRuntime().getInteger()); } int intEndIndex = (int) ((RubyInteger) endIndex).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); fillWithExceptionHandling(intIndex, intEndIndex, javaObject); return value; }
public RubyFixnum length() { return getRuntime().newFixnum(getLength()); }
public RubyFixnum length() { return getRuntime().newFixnum(getLength()); }
public void setWithExceptionHandling(int intIndex, Object javaObject) { ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), getValue(), intIndex, javaObject); }
public RubyFixnum length() { return getRuntime().newFixnum(getLength()); }
public IRubyObject afill(IRubyObject beginIndex, IRubyObject endIndex, IRubyObject value) { if (! (beginIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(beginIndex, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) beginIndex).getLongValue(); if (! (endIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(endIndex, getRuntime().getInteger()); } int intEndIndex = (int) ((RubyInteger) endIndex).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaValue = ((JavaObject) value).getValue(); fillWithExceptionHandling(intIndex, intEndIndex, javaValue); return value; }
public IRubyObject afill(IRubyObject beginIndex, IRubyObject endIndex, IRubyObject value) { if (! (beginIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(beginIndex, getRuntime().getInteger()); } int intIndex = (int) ((RubyInteger) beginIndex).getLongValue(); if (! (endIndex instanceof RubyInteger)) { throw getRuntime().newTypeError(endIndex, getRuntime().getInteger()); } int intEndIndex = (int) ((RubyInteger) endIndex).getLongValue(); if (! (value instanceof JavaObject)) { throw getRuntime().newTypeError("not a java object:" + value); } Object javaObject = ((JavaObject) value).getValue(); fillWithExceptionHandling(intIndex, intEndIndex, javaObject); return value; }
public void setWithExceptionHandling(int intIndex, Object javaObject) { ArrayUtils.setWithExceptionHandlingDirect(getRuntime(), getValue(), intIndex, javaObject); }
public void fillWithExceptionHandling(int intIndex, int intEndIndex, Object javaObject) { try { for ( ; intIndex < intEndIndex; intIndex++) { Array.set(getValue(), intIndex, javaObject); } } catch (IndexOutOfBoundsException e) { throw getRuntime().newArgumentError( "index out of bounds for java array (" + intIndex + " for length " + getLength() + ")"); } catch (ArrayStoreException e) { throw getRuntime().newArgumentError( "wrong element type " + javaObject.getClass() + "(array is " + getValue().getClass() + ")"); } } }
public RubyFixnum length() { return getRuntime().newFixnum(getLength()); }
public void fillWithExceptionHandling(int intIndex, int intEndIndex, Object javaObject) { try { for ( ; intIndex < intEndIndex; intIndex++) { Array.set(getValue(), intIndex, javaObject); } } catch (IndexOutOfBoundsException e) { throw getRuntime().newArgumentError( "index out of bounds for java array (" + intIndex + " for length " + getLength() + ")"); } catch (ArrayStoreException e) { throw getRuntime().newArgumentError( "wrong element type " + javaObject.getClass() + "(array is " + getValue().getClass() + ")"); } } }