Package com.qfs.dic

Interface IWritableIntegerArrayDictionary

    • Field Detail

      • REUSABLE_INPUT

        static final long REUSABLE_INPUT
        A flag indicating that the mapping has not directly stored its input array without any copying. The input array can therefore only be modified afterward if this flag is set. Otherwise, the caller cannot modify it. (see mapWithFlags(int[]))
        See Also:
        Constant Field Values
    • Method Detail

      • mapAndHash

        long mapAndHash​(int[] point)
        Indexes a point in this dictionary and returns its associated address and hash value.

        If the point already exists in the dictionary (with respect to the equals / hashCode contract), the dictionary is left unchanged and the position of the already existing version of this Object is returned. Otherwise, this point is inserted in this dictionary and the new position is returned.

        The returned long packs 2 integers: the point's hash code and its address in the dictionary. The upper, most significant bits of the long (that can be read using Bits.unpack1(long)) contain the hash value, while the lower, least significant bits (that can be read using Bits.unpack2(long)) contain the point's address.

        Parameters:
        point - The point to map
        Returns:
        A long packing the hash value and the position of this point in the dictionary
        See Also:
        IWritableDictionary.map(Object)
      • mapWithFlags

        long mapWithFlags​(int[] array)
        Maps the given array into this dictionary.

        The lower bits of the returned long (as returned by Bits.unpack2(long)) contain the position of this array in this dictionary, while the upper bits contain various flags.

        Parameters:
        array - The array to map.
        Returns:
        A long packing the mapped position of the input array in the dictionary and various flags.
      • mapFromCell

        default int mapFromCell​(IReadableCell cell)
        Description copied from interface: IWritableDictionary
        Maps the value stored by a cell into this dictionary.
        Specified by:
        mapFromCell in interface IWritableDictionary<int[]>
        Parameters:
        cell - cell containing the value to map
        Returns:
        the dictionary position for the mapped value