java.lang.Object
org.jtrim2.concurrent.query.OrderedData<DataType>
- Type Parameters:
DataType- the type of the actualdata
Defines a data with an index which indicates how accurate the data is. The
higher the value of the
index, the more accurate the data
is.
This class is intended to be used with AsyncDataLink instances when
it is hard forward data in the order of their accuracy but the accuracy can
be quantified with an index. This way wrapping listeners using the
AsyncHelper.makeSafeOrderedListener(AsyncDataListener) method can
guarantee that a less accurate data will not be forwarded to the actual,
generic listener after a more accurate data.
Thread safety
The methods of this class are safe to be accessed by multiple threads concurrently. Instances of this class cannot be directly modified, only itsdata if it is mutable. In case this data
object is immutable (and it is recommended to be so), then the
OrderedData instance is completely immutable.
Synchronization transparency
The methods of this class are synchronization transparent.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
OrderedData
- Parameters:
index- the index determining how accurate the data is. This argument can be any possiblelongvalue.rawData- the actualdatawhose accuracy is described by the specified index. This argument is allowed to benull.
-
-
Method Details
-
getIndex
public long getIndex()Returns the index defining how accurate the associateddatais. Higher index means more accurate data.- Returns:
- the index defining how accurate the associated
datais. This method returns the value specified at construction time and can be any possiblelongvalue.
-
getRawData
Returns the actual data whose accuracy is described by theindex. Higher index means more accurate data.- Returns:
- the actual data whose accuracy is described by the
index. This method returns the value specified at construction time and may returnnull.
-
toString
-