/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
private long fWindowStartTime;
/** End time of current time range */
private long fWindowEndTime;
- /** Duration of current time range */
- private long fWindowDuration;
/** Current begin time of selection range */
private long fSelectionBeginTime;
/** Current end of selection range */
fWindowEndTime = windowEndTime;
}
- /**
- * Sets the duration of the current time range window (visible range)
- *
- * @param windowDuration
- * The window duration
- */
- protected void setWindowDuration(long windowDuration) {
- fWindowDuration = windowDuration;
- }
-
/**
* Sets the begin time of the selected range.
*
@Override
public long getWindowDuration() {
- return fWindowDuration;
+ return getWindowEndTime() - getWindowStartTime();
}
@Override
setWindowStartTime(windowStartTime);
setWindowEndTime(windowEndTime);
- setWindowDuration(windowEndTime - windowStartTime);
// Build the new time range; keep the current time
TmfTimeRange timeRange = new TmfTimeRange(
long windowStartTime = windowRange.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
long windowEndTime = windowRange.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- long windowDuration = windowEndTime - windowStartTime;
long startTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
long endTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
setStartTime(startTime);
setWindowStartTime(windowStartTime);
setWindowEndTime(windowEndTime);
- setWindowDuration(windowDuration);
setEndTime(endTime);
}
setSelectionEndTime(0);
setStartTime(0);
setWindowStartTime(0);
- setWindowDuration(0);
setEndTime(0);
setWindowEndTime(0);
setTrace(null);
// Update the time range
long windowStartTime = range.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
long windowEndTime = range.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- long windowDuration = windowEndTime - windowStartTime;
setWindowStartTime(windowStartTime);
setWindowEndTime(windowEndTime);
- setWindowDuration(windowDuration);
}
}
}
/**********************************************************************
- * Copyright (c) 2013, 2014 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2013, 2015 Ericsson, École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- /**
- * The offset to apply to any x position. This offset ensures better
- * precision when converting long to double and back.
- */
- private long fTimeOffset;
/** The SWT Chart reference */
private Chart fSwtChart;
/** The mouse selection provider */
// ------------------------------------------------------------------------
// Getter/Setters
// ------------------------------------------------------------------------
- /**
- * Sets the time offset to apply.
- * @see ITmfChartTimeProvider#getTimeOffset()
- *
- * @param timeOffset
- * The time offset to apply
- */
- protected void setTimeOffset(long timeOffset) {
- fTimeOffset = timeOffset;
- }
/**
* Sets the SWT Chart reference
@Override
public long getTimeOffset() {
- return fTimeOffset;
+ return getWindowStartTime() - 1;
}
// ------------------------------------------------------------------------
/**********************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * Copyright (c) 2013, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* Number of steps. This will be the size of the returned array.
* @return The time values (converted to double) that match every step
*/
- protected final double[] getXAxis(long start, long end, int nb) {
- setTimeOffset(start - 1);
+ protected final static double[] getXAxis(long start, long end, int nb) {
double timestamps[] = new double[nb];
long steps = (end - start);
double step = steps / (double) nb;
/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* The number of steps in the x axis.
* @return The time values (converted to double) to match every step.
*/
- protected final double[] getXAxis(long start, long end, int nb) {
- setTimeOffset(start - 1);
+ protected final static double[] getXAxis(long start, long end, int nb) {
double timestamps[] = new double[nb];
long steps = (end - start);