blob: 2152eb53490e991374aab179665c30a15adb70aa [file] [log] [blame]
Madan Jampani61056bc2014-09-27 09:07:26 -07001package org.onlab.onos.store.device.impl;
2
3import org.onlab.onos.store.Timestamp;
4
5/**
6 * Wrapper class for a entity that is versioned
7 * and can either be up or down.
8 *
9 * @param <T> type of the value.
10 */
11public class VersionedValue<T> {
12 private final T entity;
13 private final Timestamp timestamp;
14 private final boolean isUp;
15
16 public VersionedValue(T entity, boolean isUp, Timestamp timestamp) {
17 this.entity = entity;
18 this.isUp = isUp;
19 this.timestamp = timestamp;
20 }
21
22 /**
23 * Returns the value.
24 * @return value.
25 */
26 public T entity() {
27 return entity;
28 }
29
30 /**
31 * Tells whether the entity is up or down.
32 * @return true if up, false otherwise.
33 */
34 public boolean isUp() {
35 return isUp;
36 }
37
38 /**
39 * Returns the timestamp (version) associated with this entity.
40 * @return timestamp.
41 */
42 public Timestamp timestamp() {
43 return timestamp;
44 }
45}