Package dovetaildb.bagindex

Source Code of dovetaildb.bagindex.BagIndexUtil

package dovetaildb.bagindex;

import gnu.trove.TLongLongHashMap;

import java.util.Collection;


public class BagIndexUtil {

  static long assignIds(Collection<EditRec> edits, long nextDocId) {
    TLongLongHashMap idMap = new TLongLongHashMap();
    for(EditRec edit : edits) {
      long docId = edit.docId;
      if (docId < 0) {
        if (idMap.contains(docId)) {
          edit.docId = idMap.get(docId);
        } else {
          long newDocId = nextDocId++;
          idMap.put(docId, newDocId);
          edit.docId = newDocId;
        }
      }
    }
    return nextDocId;
  }
 

}
TOP

Related Classes of dovetaildb.bagindex.BagIndexUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.