Interface AbstractIndexedEmbedding<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T decode​(byte[] byteArray)
      Decodes the given byte array into an object of input parameter type.
      long embed​(T item)
      Embeds an item.
      byte[] encode​(T input)
      Encodes an object of input type into a byte array.
      java.util.Optional<T> unembed​(long index)
      Returns the item corresponding to the given index.
    • Method Detail

      • encode

        byte[] encode​(T input)
               throws java.io.IOException
        Encodes an object of input type into a byte array. This is used in saving and loading the Embedding objects.
        Parameters:
        input - the input object to be encoded
        Returns:
        the encoded byte array.
        Throws:
        java.io.IOException - if there is an error while encoding
      • decode

        T decode​(byte[] byteArray)
          throws java.io.IOException
        Decodes the given byte array into an object of input parameter type.
        Parameters:
        byteArray - the byte array to be decoded
        Returns:
        the decode object of input parameter type
        Throws:
        java.io.IOException - if there was an error while decoding
      • embed

        long embed​(T item)
        Embeds an item.
        Parameters:
        item - the item to embed
        Returns:
        the index of the item in the embedding
      • unembed

        java.util.Optional<T> unembed​(long index)
        Returns the item corresponding to the given index.
        Parameters:
        index - the index
        Returns:
        the item corresponding to the given index