/*******************************************************************************
- * Copyright (c) 2011, 2012 Ericsson
+ * Copyright (c) 2011, 2013 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* @param duration the duration
*/
public synchronized void setNewRange(long startTime, long duration) {
- if (startTime < fAbsoluteStartTime) {
- startTime = fAbsoluteStartTime;
+ long realStart = startTime;
+
+ if (realStart < fAbsoluteStartTime) {
+ realStart = fAbsoluteStartTime;
}
- long endTime = startTime + duration;
+ long endTime = realStart + duration;
if (endTime > fAbsoluteEndTime) {
endTime = fAbsoluteEndTime;
if (endTime - duration > fAbsoluteStartTime) {
- startTime = endTime - duration;
+ realStart = endTime - duration;
} else {
- startTime = fAbsoluteStartTime;
+ realStart = fAbsoluteStartTime;
}
}
- fRangeStartTime = startTime;
- fRangeDuration = endTime - startTime;
+ fRangeStartTime = realStart;
+ fRangeDuration = endTime - realStart;
}
// ------------------------------------------------------------------------
}
private long validateStart(long start) {
- if (start < fAbsoluteStartTime) {
- start = fAbsoluteStartTime;
+ long realStart = start;
+
+ if (realStart < fAbsoluteStartTime) {
+ realStart = fAbsoluteStartTime;
}
- if (start > fAbsoluteEndTime) {
- start = fAbsoluteEndTime - fMinWindowSize;
+ if (realStart > fAbsoluteEndTime) {
+ realStart = fAbsoluteEndTime - fMinWindowSize;
}
- return start;
+ return realStart;
}
private long validateEnd(long start, long end) {
- if (end > fAbsoluteEndTime) {
- end = fAbsoluteEndTime;
+ long realEnd = end;
+
+ if (realEnd > fAbsoluteEndTime) {
+ realEnd = fAbsoluteEndTime;
}
- if (end < start + fMinWindowSize) {
- end = start + fMinWindowSize;
+ if (realEnd < start + fMinWindowSize) {
+ realEnd = start + fMinWindowSize;
}
- return end;
+ return realEnd;
}
// ------------------------------------------------------------------------