* Interpolate source values in order to fit with collection time reference.
* _values _min, _max are updated.
*/
public void updateDirectBuffer() throws DataException, OutOfMemoryError {
if (mergedTimeBuffer==null) {
throw new DataException("Collection time buffer is null, canot create direct buffer for data source " + DataInfo.getId(this));
}
final ByteBuffer bb=ByteBuffer.allocateDirect(8*mergedTimeBuffer.capacity());
_values = bb.asDoubleBuffer();
long trIndex = timeRef.getStartIndex();
for(long ctIndex=mergedTimeDs.getStartIndex();ctIndex<=mergedTimeDs.getLastIndex();ctIndex++){
double ctValue = mergedTimeDs.getDoubleValue(ctIndex);
// Find trIndex
while (!( (trIndex==timeRef.getLastIndex()) // last bound
|| ( (getTimeDoubleValue(trIndex) <= ctValue) && (ctValue < getTimeDoubleValue(trIndex+1))) // between two values
|| (getTimeDoubleValue(trIndex) >= ctValue) // fisrt
))
trIndex++;
if (getTimeDoubleValue(trIndex) > ctValue) {
throw new DataException("Cannot interpolate data source " + DataInfo.getId(this) + " . Its time interval does not match with time reference");
}
// Find value
double interpolatedValue = source.getDoubleValue(trIndex);
if ((interpolationOrder==1) && trIndex<timeRef.getLastIndex()){