@Test public void builder () throws Exception { try (FlatFileValueStoreBuilder builder = new FlatFileValueStoreBuilder ()) { builder.add (.1, "r1", "c1"); builder.add (.2, "r1", "c2"); builder.add (.3, "r2", "c1"); builder.add (.4, "r2", "c2"); builder.add (.5, "r3", "c1"); builder.add (.6, "r3", "c2"); Map<String, Integer> rowKeys = new LinkedHashMap<String, Integer> (2); rowKeys.put ("r1", 0); rowKeys.put ("r2", 1); rowKeys.put ("r3", 2); Map<String, Integer> columnKeys = new LinkedHashMap<String, Integer> (2); columnKeys.put ("c1", 0); columnKeys.put ("c2", 1); Values values = builder.build (rowKeys, columnKeys); assertThat (values.get ("r1", "c1"), is (.1)); assertThat (values.get ("r2", "c1"), is (.3)); assertThat (values.get ("r3", "c1"), is (.5)); assertThat (values.get ("r1", "c2"), is (.2)); assertThat (values.get ("r2", "c2"), is (.4)); assertThat (values.get ("r3", "c2"), is (.6)); } }
@Override public double get (String row, String column) throws InvalidCoordinateException { int x = columns.get (column); int y = rows.get (row); long position = (((long) y) * width + x) * 8; return mappings.get ((int) (position / MAPPING_SIZE)).getDouble ((int) (position % MAPPING_SIZE)); }
FlatFileValues extends AbstractValues implements Closeable, IFlatFileValues, Iterable<Value> { @Override public double get (String row, String column) throws InvalidCoordinateException { int x = columns.get (column); int y = rows.get (row); long position = (((long) y) * width + x) * 8; return mappings.get ((int) (position / MAPPING_SIZE)).getDouble ((int) (position % MAPPING_SIZE)); } }
FlatFileValues extends AbstractValues implements Closeable, IFlatFileValues, Iterable<Value> { @Override public double get (String row, String column) throws InvalidCoordinateException { int x = columns.get (column); int y = rows.get (row); long position = (((long) y) * width + x) * 8; return mappings.get ((int) (position / MAPPING_SIZE)).getDouble ((int) (position % MAPPING_SIZE)); } FlatFileValues(File file, Map<String, Integer> rows, Map<String, Integer> columns, int height, int width); }
FlatFileValues extends AbstractValues implements Closeable, IFlatFileValues, Iterable<Value> { @Override public double get (String row, String column) throws InvalidCoordinateException { int x = columns.get (column); int y = rows.get (row); long position = (((long) y) * width + x) * 8; return mappings.get ((int) (position / MAPPING_SIZE)).getDouble ((int) (position % MAPPING_SIZE)); } FlatFileValues(File file, Map<String, Integer> rows, Map<String, Integer> columns, int height, int width); @Override boolean skipJson(); @Override InputStream asInputStream(); @Override double get(String row, String column); @Override void close(); @Override Iterator<Value> iterator(); }
FlatFileValues extends AbstractValues implements Closeable, IFlatFileValues, Iterable<Value> { @Override public double get (String row, String column) throws InvalidCoordinateException { int x = columns.get (column); int y = rows.get (row); long position = (((long) y) * width + x) * 8; return mappings.get ((int) (position / MAPPING_SIZE)).getDouble ((int) (position % MAPPING_SIZE)); } FlatFileValues(File file, Map<String, Integer> rows, Map<String, Integer> columns, int height, int width); @Override boolean skipJson(); @Override InputStream asInputStream(); @Override double get(String row, String column); @Override void close(); @Override Iterator<Value> iterator();  }