Class LongValue

    • Constructor Summary

      Constructors 
      Constructor Description
      LongValue()
      Initializes the encapsulated long with 0.
      LongValue​(long value)
      Initializes the encapsulated long with the specified value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(LongValue o)  
      LongValue copy()
      Performs a deep copy of this object into a new instance.
      void copy​(DataInputView source, DataOutputView target)
      Copies the next serialized instance from source to target.
      void copyNormalizedKey​(MemorySegment target, int offset, int len)
      Writes a normalized key for the given record into the target byte array, starting at the specified position an writing exactly the given number of bytes.
      void copyTo​(LongValue target)
      Performs a deep copy of this object into the target instance.
      boolean equals​(Object obj)
      Compares the object on equality with another object.
      int getBinaryLength()
      Gets the length of the data type when it is serialized, in bytes.
      int getMaxNormalizedKeyLen()
      Gets the maximal length of normalized keys that the data type would produce to determine the order of instances solely by the normalized key.
      long getValue()
      Returns the value of the encapsulated long.
      int hashCode()
      All keys must override the hash-code function to generate proper deterministic hash codes, based on their contents.
      void read​(DataInputView in)
      Reads the object's internal data from the given data input view.
      void setValue​(long value)
      Sets the value of the encapsulated long to the specified value.
      void setValue​(LongValue value)
      Sets the encapsulated value to another value
      String toString()  
      void write​(DataOutputView out)
      Writes the object's internal data to the given data output view.
    • Constructor Detail

      • LongValue

        public LongValue()
        Initializes the encapsulated long with 0.
      • LongValue

        public LongValue​(long value)
        Initializes the encapsulated long with the specified value.
        Parameters:
        value - Initial value of the encapsulated long.
    • Method Detail

      • getValue

        public long getValue()
        Returns the value of the encapsulated long.
        Returns:
        The value of the encapsulated long.
      • setValue

        public void setValue​(long value)
        Sets the value of the encapsulated long to the specified value.
        Parameters:
        value - The new value of the encapsulated long.
      • read

        public void read​(DataInputView in)
                  throws IOException
        Description copied from interface: IOReadableWritable
        Reads the object's internal data from the given data input view.
        Specified by:
        read in interface IOReadableWritable
        Parameters:
        in - the input view to read the data from
        Throws:
        IOException - thrown if any error occurs while reading from the input stream
      • hashCode

        public int hashCode()
        Description copied from interface: Key
        All keys must override the hash-code function to generate proper deterministic hash codes, based on their contents.
        Specified by:
        hashCode in interface Key<LongValue>
        Overrides:
        hashCode in class Object
        Returns:
        The hash code of the key
      • equals

        public boolean equals​(Object obj)
        Description copied from interface: Key
        Compares the object on equality with another object.
        Specified by:
        equals in interface Key<LongValue>
        Overrides:
        equals in class Object
        Parameters:
        obj - The other object to compare against.
        Returns:
        True, iff this object is identical to the other object, false otherwise.
      • getMaxNormalizedKeyLen

        public int getMaxNormalizedKeyLen()
        Description copied from interface: NormalizableKey
        Gets the maximal length of normalized keys that the data type would produce to determine the order of instances solely by the normalized key. A value of Integer.MAX_VALUE is interpreted as infinite.

        For example, 32 bit integers return four, while Strings (potentially unlimited in length) return Integer.MAX_VALUE.

        Specified by:
        getMaxNormalizedKeyLen in interface NormalizableKey<LongValue>
        Returns:
        The maximal length of normalized keys.
      • copyNormalizedKey

        public void copyNormalizedKey​(MemorySegment target,
                                      int offset,
                                      int len)
        Description copied from interface: NormalizableKey
        Writes a normalized key for the given record into the target byte array, starting at the specified position an writing exactly the given number of bytes. Note that the comparison of the bytes is treating the bytes as unsigned bytes: int byteI = bytes[i] & 0xFF;

        If the meaningful part of the normalized key takes less than the given number of bytes, then it must be padded. Padding is typically required for variable length data types, such as strings. The padding uses a special character, either 0 or 0xff, depending on whether shorter values are sorted to the beginning or the end.

        Specified by:
        copyNormalizedKey in interface NormalizableKey<LongValue>
        Parameters:
        target - The memory segment to put the normalized key bytes into.
        offset - The offset in the byte array where the normalized key's bytes should start.
        len - The number of bytes to put.
      • getBinaryLength

        public int getBinaryLength()
        Description copied from interface: CopyableValue
        Gets the length of the data type when it is serialized, in bytes.
        Specified by:
        getBinaryLength in interface CopyableValue<LongValue>
        Returns:
        The length of the data type, or -1, if variable length.
      • copyTo

        public void copyTo​(LongValue target)
        Description copied from interface: CopyableValue
        Performs a deep copy of this object into the target instance.
        Specified by:
        copyTo in interface CopyableValue<LongValue>
        Parameters:
        target - Object to copy into.
      • copy

        public LongValue copy()
        Description copied from interface: CopyableValue
        Performs a deep copy of this object into a new instance.

        This method is useful for generic user-defined functions to clone a CopyableValue when storing multiple objects. With object reuse a deep copy must be created and type erasure prevents calling new.

        Specified by:
        copy in interface CopyableValue<LongValue>
        Returns:
        New object with copied fields.
      • copy

        public void copy​(DataInputView source,
                         DataOutputView target)
                  throws IOException
        Description copied from interface: CopyableValue
        Copies the next serialized instance from source to target.

        This method is equivalent to calling IOReadableWritable.read(DataInputView) followed by IOReadableWritable.write(DataOutputView) but does not require intermediate deserialization.

        Specified by:
        copy in interface CopyableValue<LongValue>
        Parameters:
        source - Data source for serialized instance.
        target - Data target for serialized instance.
        Throws:
        IOException
        See Also:
        IOReadableWritable