protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray) { long[] ja = (long []) javaArray; for (int i=0; i<ja.length; i++) iter.setLongNext( ja[i]); }
protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray) { long[] ja = (long []) javaArray; for (long aJa : ja) iter.setLongNext(aJa); }
protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray) { long[] ja = (long []) javaArray; for (long aJa : ja) iter.setLongNext(aJa); }
@Override protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { int offset = calcOffsetSetOrder(recnum, m); int count = m.getSize(); for (int i = 0; i < count; i++) result.setLongNext( bbuffer.getLong(offset + i * 8)); }
@Override protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { int offset = calcOffsetSetOrder(recnum, m); int count = m.getSize(); for (int i = 0; i < count; i++) result.setLongNext( bbuffer.getLong(offset + i * 8)); }
@Override protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { int offset = calcOffsetSetOrder(recnum, m); int count = m.getSize(); for (int i = 0; i < count; i++) result.setLongNext( bbuffer.getLong(offset + i * 8)); }
/** * Make an 1D array from a list of strings. * * @param dtype data type of the array. * @param stringValues list of strings. * @return resulting 1D array. * @throws NumberFormatException if string values not parseable to specified data type */ static public Array makeArray(DataType dtype, List<String> stringValues) throws NumberFormatException { Array result = Array.factory(dtype, new int[]{stringValues.size()}); IndexIterator dataI = result.getIndexIterator(); for (String s : stringValues) { if (dtype == DataType.STRING) { dataI.setObjectNext(s); } else if (dtype == DataType.LONG) { if (dtype.isUnsigned()) { BigInteger biggy = new BigInteger(s); dataI.setLongNext(biggy.longValue()); // > 63 bits will become "negetive". } else { long val = Long.parseLong(s); dataI.setLongNext(val); } } else { // this works for other numerics (LOOK not unsigned) double val = Double.parseDouble(s); dataI.setDoubleNext(val); } } return result; }
long convert = biggy.longValue(); // > 63 bits will become "negetive". System.out.printf("%s == %d%n", biggy, convert); dataI.setLongNext(biggy.longValue()); dataI.setLongNext(val);
protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setLongNext(dataIter.getLongNext()); }
/** * Make an 1D array from a list of strings. * * @param dtype data type of the array. * @param stringValues list of strings. * @return resulting 1D array. * @throws NumberFormatException if string values not parssable to specified data type */ static public Array makeArray(DataType dtype, List<String> stringValues) throws NumberFormatException { Array result = Array.factory(dtype.getPrimitiveClassType(), new int[]{stringValues.size()}); IndexIterator dataI = result.getIndexIterator(); for (String s : stringValues) { if (dtype == DataType.STRING) { dataI.setObjectNext(s); } else if (dtype == DataType.LONG) { long val = Long.parseLong(s); dataI.setLongNext(val); } else { double val = Double.parseDouble(s); dataI.setDoubleNext(val); } } return result; }
protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setLongNext(dataIter.getLongNext()); }
protected void copyLongs(int recnum, StructureMembers.Member m, IndexIterator result) { IndexIterator dataIter = getArray(recnum, m).getIndexIterator(); while (dataIter.hasNext()) result.setLongNext(dataIter.getLongNext()); }
/** * Make an 1D array from an array of strings. * * @param dtype data type of the array. * @param stringValues list of strings. * @return resulting 1D array. * @throws NumberFormatException if string values not parssable to specified data type */ static public Array makeArray(DataType dtype, String[] stringValues) throws NumberFormatException { Array result = Array.factory(dtype.getPrimitiveClassType(), new int[]{stringValues.length}); IndexIterator dataI = result.getIndexIterator(); for (String s : stringValues) { if (dtype == DataType.STRING) { dataI.setObjectNext(s); } else if (dtype == DataType.LONG) { long val = Long.parseLong(s); dataI.setLongNext(val); } else { double val = Double.parseDouble(s); dataI.setDoubleNext(val); } } return result; }
/** * copy array a to array result as longs * The values from the array a are converted to long (if needed), * and then converted to the type of result (if needed). * @param result copy to here * @param a copy from here * * * @throws IllegalArgumentException a and result are not conformable */ public static void copyLong(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setLongNext(iterA.getLongNext()); }
/** * copy array a to array result as longs * The values from the array a are converted to long (if needed), * and then converted to the type of result (if needed). * @param result copy to here * @param a copy from here * * * @throws IllegalArgumentException a and result are not conformable */ public static void copyLong(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setLongNext(iterA.getLongNext()); }
/** * copy array a to array result as longs * The values from the array a are converted to long (if needed), * and then converted to the type of result (if needed). * @param result copy to here * @param a copy from here * * * @throws IllegalArgumentException a and result are not conformable */ public static void copyLong(Array result, Array a) throws IllegalArgumentException { if (!conformable(a, result)) throw new IllegalArgumentException("copy arrays are not conformable"); IndexIterator iterA = a.getIndexIterator(); IndexIterator iterR = result.getIndexIterator(); while (iterA.hasNext()) iterR.setLongNext(iterA.getLongNext()); }
private void iconvertDataPrimitiveScalar(BaseType dodsScalar, IndexIterator ii) { if (dodsScalar instanceof DString) { String sval = ((DString) dodsScalar).getValue(); ii.setObjectNext(sval); } else if (dodsScalar instanceof DUInt32) { int ival = ((DUInt32) dodsScalar).getValue(); long lval = DataType.unsignedIntToLong(ival); // LOOK unsigned ii.setLongNext( lval); } else if (dodsScalar instanceof DUInt16) { short sval = ((DUInt16) dodsScalar).getValue(); // LOOK unsigned int ival = DataType.unsignedShortToInt(sval); ii.setIntNext (ival); } else if (dodsScalar instanceof DFloat32) ii.setFloatNext( ((DFloat32) dodsScalar).getValue()); else if (dodsScalar instanceof DFloat64) ii.setDoubleNext( ((DFloat64) dodsScalar).getValue()); else if (dodsScalar instanceof DInt32) ii.setIntNext( ((DInt32) dodsScalar).getValue()); else if (dodsScalar instanceof DInt16) ii.setShortNext( ((DInt16) dodsScalar).getValue()); else if (dodsScalar instanceof DByte) ii.setByteNext( ((DByte) dodsScalar).getValue()); else throw new IllegalArgumentException("DODSVariable extractScalar invalid dataType= " + dodsScalar.getClass().getName()); }
unsigned.resetLocalIterator(); while (unsigned.hasNext()) ii.setLongNext( DataType.unsignedIntToLong(unsigned.nextInt())); return result;
unsigned.resetLocalIterator(); while (unsigned.hasNext()) ii.setLongNext( DataType.unsignedIntToLong(unsigned.nextInt())); return result;
} else if (dataType.getPrimitiveClassType() == long.class) { while (from.hasNext()) to.setLongNext(from.getLongNext()); } else if (dataType.getPrimitiveClassType() == int.class) { while (from.hasNext())