Class MapValue<V>

  • Type Parameters:
    V - value type
    All Implemented Interfaces:
    java.lang.Comparable<MapValue<V>>

    public class MapValue<V>
    extends java.lang.Object
    implements java.lang.Comparable<MapValue<V>>
    Representation of a value in EventuallyConsistentMap.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MapValue.Digest
      Digest or summary of a MapValue for use during Anti-Entropy exchanges.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapValue​(V value, org.onosproject.store.Timestamp timestamp)
      Constructor automatically to create the system time of construction.
      MapValue​(V value, org.onosproject.store.Timestamp timestamp, long creationTime)
      Creates a map value using value, timestamp, and creation time.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(MapValue<V> o)  
      MapValue<V> copy()
      Creates a copy of MapValue.
      long creationTime()
      Returns the creation time of this value.
      MapValue.Digest digest()
      Returns summary of a MapValue for use during Anti-Entropy exchanges.
      boolean equals​(java.lang.Object other)  
      V get()
      Returns this value.
      int hashCode()  
      boolean isAlive()
      Tests if this value is alive.
      boolean isNewerThan​(MapValue<V> other)
      Tests if this value is newer than the specified MapValue.
      boolean isNewerThan​(org.onosproject.store.Timestamp timestamp)
      Tests if this timestamp is newer than the specified timestamp.
      boolean isTombstone()
      Tests if this value is tombstone value with the specified timestamp.
      org.onosproject.store.Timestamp timestamp()
      Returns the timestamp of this value.
      static <U> MapValue<U> tombstone​(org.onosproject.store.Timestamp timestamp)
      Creates a tombstone value with the specified timestamp.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MapValue

        public MapValue​(V value,
                        org.onosproject.store.Timestamp timestamp)
        Constructor automatically to create the system time of construction.
        Parameters:
        value - value
        timestamp - value timestamp
      • MapValue

        public MapValue​(V value,
                        org.onosproject.store.Timestamp timestamp,
                        long creationTime)
        Creates a map value using value, timestamp, and creation time.
        Parameters:
        value - value
        timestamp - value timestamp.
        creationTime - the system time (on local instance) of construction
    • Method Detail

      • tombstone

        public static <U> MapValue<U> tombstone​(org.onosproject.store.Timestamp timestamp)
        Creates a tombstone value with the specified timestamp.
        Type Parameters:
        U - value type
        Parameters:
        timestamp - timestamp for tombstone
        Returns:
        tombstone MapValue
      • copy

        public MapValue<V> copy()
        Creates a copy of MapValue.

        The copy will have an updated creation time corresponding to when the copy was constructed.

        Returns:
        MapValue copy
      • isTombstone

        public boolean isTombstone()
        Tests if this value is tombstone value with the specified timestamp.
        Returns:
        true if this value is null, otherwise false
      • isAlive

        public boolean isAlive()
        Tests if this value is alive.
        Returns:
        true if this value is not null, otherwise false
      • timestamp

        public org.onosproject.store.Timestamp timestamp()
        Returns the timestamp of this value.
        Returns:
        timestamp
      • get

        public V get()
        Returns this value.
        Returns:
        value
      • creationTime

        public long creationTime()
        Returns the creation time of this value.
        Returns:
        creationTime
      • isNewerThan

        public boolean isNewerThan​(MapValue<V> other)
        Tests if this value is newer than the specified MapValue.
        Parameters:
        other - the value to be compared
        Returns:
        true if this value is newer than other
      • isNewerThan

        public boolean isNewerThan​(org.onosproject.store.Timestamp timestamp)
        Tests if this timestamp is newer than the specified timestamp.
        Parameters:
        timestamp - timestamp to be compared
        Returns:
        true if this instance is newer
      • digest

        public MapValue.Digest digest()
        Returns summary of a MapValue for use during Anti-Entropy exchanges.
        Returns:
        Digest with timestamp and whether this value is null or not
      • compareTo

        public int compareTo​(MapValue<V> o)
        Specified by:
        compareTo in interface java.lang.Comparable<V>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object