Class MapValue<V>
- java.lang.Object
-
- org.onosproject.store.atomix.primitives.impl.MapValue<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapValue.DigestDigest 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 intcompareTo(MapValue<V> o)MapValue<V>copy()Creates a copy of MapValue.longcreationTime()Returns the creation time of this value.MapValue.Digestdigest()Returns summary of a MapValue for use during Anti-Entropy exchanges.booleanequals(java.lang.Object other)Vget()Returns this value.inthashCode()booleanisAlive()Tests if this value is alive.booleanisNewerThan(MapValue<V> other)Tests if this value is newer than the specified MapValue.booleanisNewerThan(org.onosproject.store.Timestamp timestamp)Tests if this timestamp is newer than the specified timestamp.booleanisTombstone()Tests if this value is tombstone value with the specified timestamp.org.onosproject.store.Timestamptimestamp()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.StringtoString()
-
-
-
Constructor Detail
-
MapValue
public MapValue(V value, org.onosproject.store.Timestamp timestamp)
Constructor automatically to create the system time of construction.- Parameters:
value- valuetimestamp- 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- valuetimestamp- 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:
compareToin interfacejava.lang.Comparable<V>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-