/**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
public int getWidth() {
if (fHorizontalIndex == 0) {
return 3 * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 - Metrics.FRAME_H_MARGIN - Metrics.LIFELINE_SPACING / 2;
- } else {
- return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
}
+ return fHorizontalIndex * Metrics.swimmingLaneWidth() + Metrics.LIFELINE_H_MAGIN * 2 + 1 - Metrics.LIFELINE_SPACING;
}
/*
return null;
}
for (int i = fromIndex; i < list.size(); i++) {
- GraphNode node = (GraphNode) list.get(i);
+ GraphNode node = list.get(i);
// only lifeline list is x ordered
// Stop browsing the list if the node is outside the visible area
// all others nodes will be not visible
* Return the minimum time stored in the frame taking all GraphNodes into account
*
* @return the minimum GraphNode time
+ * @since 2.0
*/
public ITmfTimestamp getMinTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
*
* @param min
* The minimum timestamp
+ * @since 2.0
*/
public void setMin(ITmfTimestamp min) {
fMinTime = min;
*
* @param max
* The maximum timestamp
+ * @since 2.0
*/
public void setMax(ITmfTimestamp max) {
fMaxTime = max;
* Return the maximum time stored in the frame taking all GraphNodes into account
*
* @return the maximum GraphNode time
+ * @since 2.0
*/
public ITmfTimestamp getMaxTime() {
if (fLastExternalTimePref != SDViewPref.getInstance().excludeExternalTime()) {
return;
}
for (int i = 0; i < timeArray.size(); i++) {
- SDTimeEvent m = (SDTimeEvent) timeArray.get(i);
+ SDTimeEvent m = timeArray.get(i);
if (m.getTime().compareTo(fMaxSDTime, true) > 0) {
fMaxSDTime = m.getTime();
* Returns the minimum time between consecutive messages.
*
* @return the minimum time between consecutive messages
+ * @since 2.0
*/
public ITmfTimestamp getSDMinTime() {
computeMaxMinTime();
* Returns the maximum time between consecutive messages.
*
* @return the maximum time between consecutive messages
+ * @since 2.0
*/
public ITmfTimestamp getSDMaxTime() {
computeMaxMinTime();
return;
}
for (int i = 0; i < timeArray.size() - 1; i++) {
- SDTimeEvent m1 = (SDTimeEvent) timeArray.get(i);
- SDTimeEvent m2 = (SDTimeEvent) timeArray.get(i + 1);
+ SDTimeEvent m1 = timeArray.get(i);
+ SDTimeEvent m2 = timeArray.get(i + 1);
updateMinMax(m1, m2);
}
protected void updateMinMax(SDTimeEvent m1, SDTimeEvent m2) {
ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime());
if (fComputeMinMax) {
- fMinTime = delta.clone();
+ fMinTime = delta;
if (fMinTime.compareTo(TmfTimestamp.ZERO, false) < 0) {
fMinTime = new TmfTimestamp(0, m1.getTime().getScale(), m1.getTime().getPrecision());
}
- fMaxTime = fMinTime.clone();
+ fMaxTime = fMinTime;
fComputeMinMax = false;
}
if ((delta.compareTo(fMinTime, true) < 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
- fMinTime = delta.clone();
+ fMinTime = delta;
}
if ((delta.compareTo(fMaxTime, true) > 0) && (delta.compareTo(TmfTimestamp.ZERO, false) > 0)) {
- fMaxTime = delta.clone();
+ fMaxTime = delta;
}
}
List<SDTimeEvent> timeArray = new ArrayList<SDTimeEvent>();
while (it.hasNext()) {
String nodeType = it.next();
- List<GraphNode> list = (List<GraphNode>) fNodes.get(nodeType);
+ List<GraphNode> list = fNodes.get(nodeType);
for (int i = 0; i < list.size(); i++) {
Object timedNode = list.get(i);
if ((timedNode instanceof ITimeRange) && ((ITimeRange) timedNode).hasTimeInfo()) {
- int event = ((GraphNode) list.get(i)).getStartOccurrence();
+ int event = list.get(i).getStartOccurrence();
ITmfTimestamp time = ((ITimeRange) list.get(i)).getStartTime();
SDTimeEvent f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));
timeArray.add(f);
- if (event != ((GraphNode) list.get(i)).getEndOccurrence()) {
+ if (event != list.get(i).getEndOccurrence()) {
event = ((AsyncMessage) list.get(i)).getEndOccurrence();
time = ((ITimeRange) list.get(i)).getEndTime();
f = new SDTimeEvent(time, event, (ITimeRange) list.get(i));