private static int translateBatch(HyperGraph graph,Set<HGHandle> batch,RAMStorageGraph subgraph,Map<HGHandle,Object> objects,Mapping<Pair<HGHandle,Object>,HGHandle> atomFinder,Map<HGHandle,HGHandle> substitutes){
  int replacements=0;
  for (  HGHandle atom : batch) {
    Object object=readAtom(atom,graph,new HGAtomResolver<HGAtomType>(graph),subgraph);
    HGHandle existing=atomFinder == null ? null : atomFinder.eval(new Pair<HGHandle,Object>(atom,object));
    if (existing != null) {
      substitutes.put(atom,existing);
      if (!existing.equals(atom))       replacements++;
    }
 else     objects.put(atom,object);
  }
  return replacements;
}

private static int translateBatch ( HyperGraph graph , Set < HGHandle > batch , RAMStorageGraph subgraph , Map < HGHandle , Object > objects , Mapping < Pair < HGHandle , Object > , HGHandle > atomFinder , Map < HGHandle , HGHandle > substitutes ) { int replacements = 0 ; for ( HGHandle atom : batch ) { Object object = readAtom ( atom , graph , new HGAtomResolver < HGAtomType > ( graph ) , subgraph ) ; HGHandle existing = atomFinder == null ? null : atomFinder . eval ( new Pair < HGHandle , Object > ( atom , object ) ) ; if ( existing != null ) { substitutes . put ( atom , existing ) ; if ( ! existing . equals ( atom ) ) replacements ++ ; } else objects . put ( atom , object ) ; } return replacements ; }
returns the number of new replacements to be made , i . e . the number of new atom equivalents found . on the other hand , the substitutes parameter may contain identity mapping for atoms that are both in the ramstoragegraph and in the hypergraph - we only want to track those in order to ignore them when the ramstoragegraph is finally written locally .
