Class FileDataInterface<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    DataInterface<T>, be.bagofwords.iterator.DataIterable<be.bagofwords.util.KeyValue<T>>, be.bagofwords.memory.MemoryGobbler, Iterable<be.bagofwords.util.KeyValue<T>>

    public class FileDataInterface<T>
    extends CoreDataInterface<T>
    implements be.bagofwords.memory.MemoryGobbler
    Improvements: 1) Make sure keys can have any distribution (e.g. sequential starting from 0), without affecting performance - either infrequently restructure buckets - or rewrite hashes 2) Support ObjectSerializer
    • Constructor Detail

      • FileDataInterface

        public FileDataInterface​(be.bagofwords.memory.MemoryManager memoryManager,
                                 Combinator<T> combinator,
                                 Class<T> objectClass,
                                 String directory,
                                 String name,
                                 boolean isTemporaryDataInterface,
                                 be.bagofwords.jobs.AsyncJobService asyncJobService,
                                 ObjectSerializer<T> objectSerializer)
    • Method Detail

      • write

        public void write​(long key,
                          T value)
        Specified by:
        write in interface DataInterface<T>
      • write

        public void write​(be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> entries)
        Specified by:
        write in interface DataInterface<T>
      • iterator

        public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator​(be.bagofwords.iterator.CloseableIterator<Long> keyIterator)
        Specified by:
        iterator in interface DataInterface<T>
      • iterator

        public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator()
        Specified by:
        iterator in interface DataInterface<T>
        Specified by:
        iterator in interface be.bagofwords.iterator.DataIterable<T>
        Specified by:
        iterator in interface Iterable<T>
      • iterator

        public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator​(KeyFilter keyFilter)
        Specified by:
        iterator in interface DataInterface<T>
      • freeMemory

        public long freeMemory()
        Specified by:
        freeMemory in interface be.bagofwords.memory.MemoryGobbler
      • getMemoryUsage

        public long getMemoryUsage()
        Specified by:
        getMemoryUsage in interface be.bagofwords.memory.MemoryGobbler
      • apprSize

        public long apprSize()
        Specified by:
        apprSize in interface DataInterface<T>
        Specified by:
        apprSize in interface be.bagofwords.iterator.DataIterable<T>