pt.unl.fct.di.novasys.babel.crdts.utils

Class ValueTsPair<V>



  • public class ValueTsPair<V>
    extends Object
    An helper class that stores a value and a timestamp. The value is represented as a generic type (e.g., a SerializabeType or a GenericCRDT) and the timestamp as Timestamp object. The class can be of great help in CRDTs that need to associate a value to a timestamp to perform conflict resolution.
    • Constructor Detail

      • ValueTsPair

        public ValueTsPair(V value,
                           Timestamp ts)
        Creates a pair value and timestamp.
        Parameters:
        value - value to be stored.
        ts - timestamp associated with the value.
    • Method Detail

      • getValue

        public V getValue()
        Gets the value of the pair.
        Returns:
        the value
      • getTs

        public Timestamp getTs()
        Gets the timestamp associated with the value.
        Returns:
        the timestamp
      • setValue

        public void setValue(V value)
        Sets the value of the pair
        Parameters:
        value - value of the pair
      • setTs

        public void setTs(Timestamp ts)
        Sets the timestamp of the pair
        Parameters:
        ts - the timestamp of the pair
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object

Copyright © 2024. All rights reserved.