private Map loadValuesFromSource( SelectableDataSource source, String keyFieldName, ArrayList fieldsPositions) throws ReadDriverException { HashMap values = new HashMap(); int row, i; Value[] rowValues; Value key; int keyPos = source.getFieldIndexByName(keyFieldName); long rowCount = source.getRowCount(); for (row = 0; row < rowCount; row++) { key = source.getFieldValue(row, keyPos); if (values.containsKey(key)) { continue; } rowValues = new Value[fieldsPositions.size()]; for (i = 0; i < fieldsPositions.size(); i++) { rowValues[i] = source.getFieldValue(row, ((Integer) fieldsPositions.get(i)).intValue()); } values.put(key, rowValues); } return values; }
/** * Rellena los registros del dbf. * * @param sds DOCUMENT ME! */ private void createdbf(SelectableDataSource sds, BitSet bitset) { int i = 0; // for (int i = 0; i < fgs.length; i++) { try { if (sds == null) { for (int j = 0; j < geometries.length; j++) { enteros[0] = ValueFactory.createValue((double) i); dbfWrite.write(enteros); i++; } } else { for (int j = bitset.nextSetBit(0); j >= 0; j = bitset.nextSetBit(j + 1)) { for (int r = 0; r < sds.getFieldCount(); r++) { record[r] = sds.getFieldValue(j, r); } dbfWrite.write(record); } } } catch (IOException e1) { e1.printStackTrace(); } catch (ReadDriverException e) { e.printStackTrace(); } }