/** * Create a String out of this rank two ArrayChar object. * This treats the ArrayChar as a 1D array of Strings. * If there is a null (0) value in the ArrayChar array, the String will end there. * The null is not returned as part of the String. * * @param index index into 1D String array, must be < getShape(0). * @return String value * @throws IllegalArgumentException if rank != 2 */ public String getString(int index) { Index ima = getIndex(); return getString(ima.set(index)); }
/** * Create a String out of this rank two ArrayChar object. * This treats the ArrayChar as a 1D array of Strings. * If there is a null (0) value in the ArrayChar array, the String will end there. * The null is not returned as part of the String. * * @param index index into 1D String array, must be < getShape(0). * @return String value * @throws IllegalArgumentException if rank != 2 */ public String getString(int index) { Index ima = getIndex(); return getString(ima.set(index)); }
/** * Create a String out of this rank two ArrayChar object. * This treats the ArrayChar as a 1D array of Strings. * If there is a null (0) value in the ArrayChar array, the String will end there. * The null is not returned as part of the String. * * @param index index into 1D String array, must be < getShape(0). * @return String value * @throws IllegalArgumentException if rank != 2 */ public String getString(int index) { Index ima = getIndex(); return getString(ima.set(index)); }
/** * Set the ArrayChar values from the characters in the String. Rank must be 2. * This treats the ArrayChar as a 1D array of Strings. * If String val longer than ArrayChar, ignore extra chars; if shorter, fill with 0. * <p/> * <p><code> * String[] val = new String[n]; * ArrayChar ca; * Index ima = ca.getIndex(); * for (int i=0; i<n; i++) * ca.setString(i, val[i]); * </code> * * @param index index into 1D String array, must be < getShape(0). * @param val set chars from this sString */ public void setString(int index, String val) { int rank = getRank(); if (rank != 2) throw new IllegalArgumentException("ArrayChar.setString rank must be 2"); Index ima = getIndex(); setString(ima.set(index), val); }
/** * Set the ArrayChar values from the characters in the String. Rank must be 2. * This treats the ArrayChar as a 1D array of Strings. * If String val longer than ArrayChar, ignore extra chars; if shorter, fill with 0. * <p/> * <p><code> * String[] val = new String[n]; * ArrayChar ca; * Index ima = ca.getIndex(); * for (int i=0; i<n; i++) * ca.setString(i, val[i]); * </code> * * @param index index into 1D String array, must be < getShape(0). * @param val set chars from this sString */ public void setString(int index, String val) { int rank = getRank(); if (rank != 2) throw new IllegalArgumentException("ArrayChar.setString rank must be 2"); Index ima = getIndex(); setString(ima.set(index), val); }
/** * Set the ArrayChar values from the characters in the String. Rank must be 2. * This treats the ArrayChar as a 1D array of Strings. * If String val longer than ArrayChar, ignore extra chars; if shorter, fill with 0. * <p/> * <p><code> * String[] val = new String[n]; * ArrayChar ca; * Index ima = ca.getIndex(); * for (int i=0; i<n; i++) * ca.setString(i, val[i]); * </code> * * @param index index into 1D String array, must be < getShape(0). * @param val set chars from this sString */ public void setString(int index, String val) { int rank = getRank(); if (rank != 2) throw new IllegalArgumentException("ArrayChar.setString rank must be 2"); Index ima = getIndex(); setString(ima.set(index), val); }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private static Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private static Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private static Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
private Array convertToChar(Variable newVar, Array oldData) { ArrayChar newData = (ArrayChar) Array.factory(DataType.CHAR, newVar.getShape()); Index ima = newData.getIndex(); IndexIterator ii = oldData.getIndexIterator(); while (ii.hasNext()) { String s = (String) ii.getObjectNext(); int[] c = ii.getCurrentCounter(); for (int i = 0; i < c.length; i++) ima.setDim(i, c[i]); newData.setString(ima, s); } return newData; }
int[] origin1 = new int[1]; ArrayChar ac = new ArrayChar.D1(shape[0]); ima = ac.getIndex(); String val = "Testing 1-2-3"; for (j = 0; j < val.length(); j++) try { ArrayChar ac2 = new ArrayChar.D2(shape[0], shape[1]); ima = ac2.getIndex(); ac2.setString(ima.set(0), "No pairs of ladies stockings!"); ac2.setString(ima.set(1), "One pair of ladies stockings!");