@Override protected String toString(Object array, int index) { return ForNonArrayType.INTEGER.toString(Array.getInt(array, index)); } },
protected String arrayToString(Object o) { int len = Array.getLength(o); Class c = o.getClass().getComponentType(); String res = "[ "; for (int i = 0; i < len; i++) { if ( c == byte.class ) res+=Array.getByte(o,i); if ( c == boolean.class ) res+=Array.getBoolean(o, i); if ( c == char.class ) res+=Array.getChar(o, i); if ( c == short.class ) res+=Array.getShort(o, i); if ( c == int.class ) res+=Array.getInt(o, i); if ( c == long.class ) res+=Array.getLong(o, i); if ( c == float.class ) res+=Array.getFloat(o, i); if ( c == double.class ) res+=Array.getDouble(o, i); if ( i < len-1) res+=","; } res += " ]"; return res; }
if (i != 0) string.append(' '); string.append(Array.getInt(o, i));
protected String arrayToString(Object o) { int len = Array.getLength(o); Class c = o.getClass().getComponentType(); String res = "[ "; for (int i = 0; i < len; i++) { if ( c == byte.class ) res+=Array.getByte(o,i); if ( c == boolean.class ) res+=Array.getBoolean(o, i); if ( c == char.class ) res+=Array.getChar(o, i); if ( c == short.class ) res+=Array.getShort(o, i); if ( c == int.class ) res+=Array.getInt(o, i); if ( c == long.class ) res+=Array.getLong(o, i); if ( c == float.class ) res+=Array.getFloat(o, i); if ( c == double.class ) res+=Array.getDouble(o, i); if ( i < len-1) res+=","; } res += " ]"; return res; }
dest[i] = Array.getInt(array, i);
public Object get(Object array, int index) { return java.lang.reflect.Array.getInt(array, index); } };
public Object get(Object array, int index) { return java.lang.reflect.Array.getInt(array, index); } };
public int getInt(Object dataSet, int ordinal) { return Array.getInt(dataSet, ordinal); }
public int getInt(Object dataSet, int ordinal) { return Array.getInt(dataSet, ordinal); }
public int get(int r, int c) { Object row = Array.get(_matrix, r); if (row == null) { throw new ArrayIndexOutOfBoundsException("index out of bounds: " + r); } return Array.getInt(row, c); }
public static Integer getInt(Class clazz, Object[] objects, int index) throws ArrayIndexOutOfBoundsException{ Object array = Array.newInstance(clazz, objects.length); int length = Array.getLength(array); if (length <= index) { throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < objects.length; i++) { Array.set(array, i, objects[i]); } return Array.getInt(array, index); }
/** * Returns the value at the specified index. */ public Object getValueAt(final int row, final int column) { if (column == 0) { return new Integer(row + offset); } final Object array = table[column-1]; if (unsigned) { return new Integer(Array.getInt(array, row) & 0x7FFFFFFF); } return Array.get(array, row); }
static public void arrayTest() { System.out.println("arrayTest:"); int[] items = (int[]) Array.newInstance(Integer.TYPE, 10); for (int n = 0; n < 10; n++) items[n] = n * 10; System.out.println(items.length); System.out.println(items.getClass().getComponentType()); for (int n = 0; n < 10; n++) System.out.println(Array.getInt(items, n)); for (int n = 0; n < 10; n++) Array.setInt(items, n, n * 20); for (int n = 0; n < 10; n++) System.out.println(items[n]); for (int n = 0; n < 10; n++) Array.set(items, n, n * 40); for (int n = 0; n < 10; n++) System.out.println(items[n] + 10); System.out.println((new String[0]).getClass().getComponentType()); }
@Override protected String toString(Object array, int index) { return ForNonArrayType.INTEGER.toString(Array.getInt(array, index)); } },
public String tounicode() { if (!"u".equals(typecode)) { throw Py.ValueError("tounicode() may only be called on type 'u' arrays"); } int len = delegate.getSize(); int[] codepoints = new int[len]; for (int i = 0; i < len; i++) { codepoints[i] = Array.getInt(data, i); } return new String(codepoints, 0, codepoints.length); }
/** * Get the element at position <code>i</code> from the array * * @param i index of the item to be retrieved from the array */ @Override protected PyObject pyget(int i) { if ("u".equals(typecode)) { return new PyUnicode(Array.getInt(data, i)); } return Py.java2py(Array.get(data, i)); }
/** * @throws IOException * @see org.apache.wicket.util.io.ClassStreamHandler.PrimitiveArray#writeArray(Object, * WicketObjectOutputStream) */ public void writeArray(Object object, WicketObjectOutputStream dos) throws IOException { int length = Array.getLength(object); dos.writeInt(length); for (int i = 0; i < length; i++) { dos.writeInt(Array.getInt(object, i)); } }
@Override public Integer get(int index) { int[] coordinates = computeCoordinates(index); if (coordinates.length == 1) { return Array.getInt(this.backingArray, index); } else return (Integer) ArrayUtils.getValue(this.backingArray, coordinates); }
@Test public void testArrayInt () { if (verifyNoPropertyViolation()){ try { int i = Array.getInt(arrayInt, 0); assert i == 42; Array.setInt(arrayInt, 0, 43); assert arrayInt[0] == 43; } catch (Throwable t) { assert false : "unexpected exception: " + t; } } }
@JTranscSync public static Object get(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException { Type elementType = getArrayElementType(array.getClass()); if (elementType == Boolean.TYPE) return getBoolean(array, index); if (elementType == Byte.TYPE) return getByte(array, index); if (elementType == Character.TYPE) return getChar(array, index); if (elementType == Short.TYPE) return getShort(array, index); if (elementType == Integer.TYPE) return getInt(array, index); if (elementType == Long.TYPE) return getLong(array, index); if (elementType == Float.TYPE) return getFloat(array, index); if (elementType == Double.TYPE) return getDouble(array, index); return getInstance(array, index); }