Interface ValueContainer<V>

Type Parameters:
V -
All Superinterfaces:
Serializable
All Known Subinterfaces:
CompressibleValueContainer<V>, ProbBackoffValueContainer
All Known Implementing Classes:
CompressibleProbBackoffValueContainer, CountValueContainer, KneserNeyCountValueContainer, PhraseTableValueContainer, UncompressedProbBackoffValueContainer, UnrankedUncompressedProbBackoffValueContainer

public interface ValueContainer<V> extends Serializable
Manages storage of arbitrary values in an NgramMap
Author:
adampauls
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, V val, long suffixOffset, boolean ngramIsNew)
    Adds a new value at the specified offset.
    void
    clearStorageForOrder(int ngramOrder)
     
    createFreshValues(long[] numNgramsForEachOrder)
    Creates a fresh value container for copying purposes.
    void
    getFromOffset(long offset, int ngramOrder, V outputVal)
    Gets the value living at a particular offset.
    Creates a fresh value of object (useful for passing as an output parameter)
    int
    numValueBits(int ngramOrder)
     
    void
    Destructively sets internal storage from another object.
    void
    Initializes a value container with the map that contains it
    void
    setSizeAtLeast(long size, int ngramOrder)
    Sets internal storage for size for a particular n-gram order
    boolean
     
    void
    Final clean up of storage.
    void
    trimAfterNgram(int ngramOrder, long size)
    Clear storage after an n-gram order is complete
  • Method Details

    • add

      boolean add(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, V val, long suffixOffset, boolean ngramIsNew)
      Adds a new value at the specified offset.
      Parameters:
      ngramOrder - As always, ngramOrder is 0-based (0=unigram)
      offset -
      contextOffset -
      word -
      val -
      suffixOffset -
      Returns:
      Whether or not the add was successful
    • setSizeAtLeast

      void setSizeAtLeast(long size, int ngramOrder)
      Sets internal storage for size for a particular n-gram order
      Parameters:
      size -
      ngramOrder -
    • createFreshValues

      ValueContainer<V> createFreshValues(long[] numNgramsForEachOrder)
      Creates a fresh value container for copying purposes.
      Returns:
    • getFromOffset

      void getFromOffset(long offset, int ngramOrder, V outputVal)
      Gets the value living at a particular offset.
      Parameters:
      offset -
      ngramOrder -
    • setFromOtherValues

      void setFromOtherValues(ValueContainer<V> other)
      Destructively sets internal storage from another object.
      Parameters:
      other -
    • trimAfterNgram

      void trimAfterNgram(int ngramOrder, long size)
      Clear storage after an n-gram order is complete
      Parameters:
      ngramOrder -
      size -
    • trim

      void trim()
      Final clean up of storage.
    • getScratchValue

      V getScratchValue()
      Creates a fresh value of object (useful for passing as an output parameter)
      Returns:
    • setMap

      void setMap(NgramMap<V> map)
      Initializes a value container with the map that contains it
    • clearStorageForOrder

      void clearStorageForOrder(int ngramOrder)
    • storeSuffixoffsets

      boolean storeSuffixoffsets()
    • numValueBits

      int numValueBits(int ngramOrder)