Forráskód Böngészése

Removed Virtual Time

Andreas Mülder 13 éve
szülő
commit
a2fd2486d8
14 módosított fájl, 16 hozzáadás és 603 törlés
  1. 0 1
      plugins/org.yakindu.sct.simulation.core/META-INF/MANIFEST.MF
  2. 1 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/debugmodel/SCTDebugTarget.java
  3. 0 7
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContext.java
  4. 0 4
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContextListener.java
  5. 2 0
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionFacadeController.java
  6. 0 7
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionContext.java
  7. 4 1
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionFacadeController.java
  8. 8 7
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/CycleBasedExecutionFacadeController.java
  9. 0 18
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionContextImpl.java
  10. 0 147
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualClock.java
  11. 0 123
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualTimer.java
  12. 1 184
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/SimulationView.java
  13. 0 101
      test-plugins/org.yakindu.sct.simulation.core.test/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualClockTest.java
  14. 0 3
      test-plugins/org.yakindu.sct.simulation.core.test/src/org/yakindu/sct/simulation/core/test/AllTests.java

+ 0 - 1
plugins/org.yakindu.sct.simulation.core/META-INF/MANIFEST.MF

@@ -23,5 +23,4 @@ Export-Package: org.yakindu.sct.simulation.core,
  org.yakindu.sct.simulation.core.launch,
  org.yakindu.sct.simulation.core.runtime,
  org.yakindu.sct.simulation.core.runtime.impl,
- org.yakindu.sct.simulation.core.runtime.timer,
  org.yakindu.sct.simulation.core.util

+ 1 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/debugmodel/SCTDebugTarget.java

@@ -143,6 +143,7 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget,
 
 	public void stepOver() {
 		fireEvent(new DebugEvent(getDebugTarget(), DebugEvent.STEP_OVER));
+		facade.runCycle();
 	}
 
 	public IThread[] getThreads() throws DebugException {

+ 0 - 7
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContext.java

@@ -18,7 +18,6 @@ import org.yakindu.sct.model.sexec.ExecutionState;
 import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionVariable;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualClock;
 
 /**
  * 
@@ -123,12 +122,6 @@ public interface IExecutionContext {
 	public void removeExecutionContextListener(
 			IExecutionContextListener listener);
 
-	public double getTimeScaleFactor();
-
-	public void setTimeScaleFactor(double factor);
-
-	public VirtualClock getVirtualClock();
-
 	/**
 	 * 
 	 * @param region

+ 0 - 4
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionContextListener.java

@@ -29,8 +29,4 @@ public interface IExecutionContextListener {
 	 * called when a variable value changed
 	 */
 	public void variableValueChanged(ExecutionVariable variable);
-	/**
-	 * Called when the timeScaleFactor changed
-	 */
-	public void timeScaleFactorChanged(double oldFactor, double newFactor);
 }

+ 2 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/IExecutionFacadeController.java

@@ -25,6 +25,8 @@ public interface IExecutionFacadeController {
 	public void start();
 
 	public void suspend();
+	
+	public void step();
 
 	public void resume();
 

+ 0 - 7
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionContext.java

@@ -60,13 +60,6 @@ public abstract class AbstractExecutionContext implements IExecutionContext {
 		}
 	}
 	
-	public void notifyTimeScaleFactorChanged(double oldFactor, double newFactor) {
-		synchronized (_listeners) {
-			for (IExecutionContextListener listener : _listeners) {
-				listener.timeScaleFactorChanged(oldFactor, newFactor);
-			}
-		}
-	}
 
 	public ExecutionEvent getDeclaredEvent(String eventName) {
 		return null;

+ 4 - 1
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/AbstractExecutionFacadeController.java

@@ -47,7 +47,10 @@ public abstract class AbstractExecutionFacadeController implements
 	public void terminate() {
 		terminated = true;
 		facade.tearDown();
-		facade.getExecutionContext().getVirtualClock().stop();
+	}
+	
+	public void step() {
+		facade.runCycle();		
 	}
 
 }

+ 8 - 7
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/CycleBasedExecutionFacadeController.java

@@ -10,10 +10,11 @@
  */
 package org.yakindu.sct.simulation.core.runtime.impl;
 
+import java.util.Timer;
+import java.util.TimerTask;
+
 import org.yakindu.sct.simulation.core.runtime.IExecutionFacade;
 import org.yakindu.sct.simulation.core.runtime.IExecutionFacadeController;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualTimer;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualTimer.VirtualTimerTask;
 
 /**
  * Cycle based implementation of {@link IExecutionFacadeController}.
@@ -27,7 +28,7 @@ import org.yakindu.sct.simulation.core.runtime.timer.VirtualTimer.VirtualTimerTa
 public class CycleBasedExecutionFacadeController extends
 		AbstractExecutionFacadeController {
 
-	private VirtualTimer timer;
+	private Timer timer;
 
 	private long cyclePeriod;
 
@@ -35,18 +36,18 @@ public class CycleBasedExecutionFacadeController extends
 			long cyclePeriod) {
 		super(facade);
 		this.cyclePeriod = cyclePeriod;
-		timer = new VirtualTimer(facade.getExecutionContext().getVirtualClock());
+		timer = new Timer();
 	}
 
 	protected void scheduleCycle() {
 		if (!terminated && !suspended) {
-			VirtualTimerTask virtualTimerTask = new VirtualTimerTask() {
+			TimerTask virtualTimerTask = new TimerTask() {
 				public void run() {
 					facade.runCycle();
 					scheduleCycle();
 				}
 			};
-			timer.scheduleTask(virtualTimerTask, cyclePeriod);
+			timer.schedule(virtualTimerTask, cyclePeriod);
 		}
 	}
 
@@ -54,7 +55,7 @@ public class CycleBasedExecutionFacadeController extends
 		super.start();
 		scheduleCycle();
 	}
-
+	
 	public void resume() {
 		super.resume();
 		scheduleCycle();

+ 0 - 18
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/impl/ExecutionContextImpl.java

@@ -26,7 +26,6 @@ import org.yakindu.sct.model.sgraph.RegularState;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.simulation.core.runtime.ExecutionException;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualClock;
 
 import com.google.common.collect.Maps;
 
@@ -44,16 +43,12 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 	protected List<ExecutionEvent> raisedEvents;
 	private ExecutionState[] activeStateConfig;
 	private Map<Integer, ExecutionState> historyStateConfig;
-	private double timeScaleFactor;
-	private VirtualClock virtualClock;
 
 	public ExecutionContextImpl() {
 		variables = new ArrayList<ExecutionVariable>();
 		declaredEvents = new ArrayList<ExecutionEvent>();
 		raisedEvents = new ArrayList<ExecutionEvent>();
 		scheduledToRaiseEvents = new ArrayList<ExecutionEvent>();
-		timeScaleFactor = 1.0d;
-		virtualClock = new VirtualClock();
 		activeStateConfig = null;
 		historyStateConfig = null;
 	}
@@ -240,19 +235,6 @@ public class ExecutionContextImpl extends AbstractExecutionContext implements
 		return result;
 	}
 
-	public double getTimeScaleFactor() {
-		return timeScaleFactor;
-	}
-
-	public void setTimeScaleFactor(double factor) {
-		double oldFactor = timeScaleFactor;
-		timeScaleFactor = factor;
-		notifyTimeScaleFactorChanged(oldFactor, factor);
-	}
-
-	public VirtualClock getVirtualClock() {
-		return virtualClock;
-	}
 
 	public void unraiseEvent(String eventName) {
 		synchronized (raisedEvents) {

+ 0 - 147
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualClock.java

@@ -1,147 +0,0 @@
-/**
- * Copyright (c) 2012 committers of YAKINDU 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 accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.simulation.core.runtime.timer;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * VirtualClock to be used instead of {@link System}currentTimeMillis. Allows to
- * scale the time with a given factor.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class VirtualClock {
-
-	// real time in ms since start of the clock
-	private long startTime;
-	// real time in ms since last factor change
-	private long realTime;
-	// virtual time in ms since last factor change
-	private long virtualTime;
-	// accumulated suspend time in ms
-	private long accumulatedSuspendTime;
-	// last time stamp in which the clock was suspended
-	private long startSuspendTime;
-	// flag to decide if the clock is currently suspended
-	private boolean isSuspended;
-	// factor to set after the clock is resumed (only if it is greater than
-	// zero))
-	private double factorToSet;
-
-	private List<PropertyChangeListener> _listeners;
-
-	public VirtualClock() {
-		_listeners = new ArrayList<PropertyChangeListener>();
-	}
-
-	private double factor = 1.0d;
-
-	public synchronized void start() {
-		reset();
-		startTime = System.currentTimeMillis();
-		virtualTime = System.currentTimeMillis();
-		realTime = System.currentTimeMillis();
-	}
-
-	public synchronized void suspend() {
-		startSuspendTime = System.currentTimeMillis();
-		isSuspended = true;
-	}
-
-	public synchronized void resume() {
-		accumulatedSuspendTime += System.currentTimeMillis() - startSuspendTime;
-		isSuspended = false;
-		if (factorToSet > 0) {
-			setFactor(factorToSet);
-			factorToSet = 0;
-		}
-	}
-
-	public synchronized void stop() {
-		reset();
-	}
-
-	private void reset() {
-		virtualTime = 0;
-		realTime = 0;
-		startTime = 0;
-		accumulatedSuspendTime = 0;
-		startSuspendTime = 0;
-		factorToSet = 0;
-	}
-
-	public synchronized void setFactor(double factor) {
-		if (!isSuspended) {
-			virtualTime = getTime();
-			realTime = System.currentTimeMillis() - getPauseTime();
-			double oldFactor = this.factor;
-			this.factor = factor;
-			notifyListeners(new PropertyChangeEvent(this, "factor", oldFactor,
-					factor));
-		} else {
-			factorToSet = factor;
-		}
-	}
-
-	public void addPropertyChangeListener(PropertyChangeListener listener) {
-		synchronized (_listeners) {
-			_listeners.add(listener);
-		}
-	}
-
-	protected void notifyListeners(PropertyChangeEvent event) {
-		synchronized (_listeners) {
-			for (PropertyChangeListener listener : _listeners) {
-				listener.propertyChange(event);
-			}
-		}
-	}
-
-	public synchronized long getTime() {
-		long difference = System.currentTimeMillis() - getPauseTime()
-				- this.realTime;
-		difference = (long) (difference * factor);
-		return virtualTime + difference;
-	}
-
-	public long getPauseTime() {
-		if (isSuspended) {
-			return (System.currentTimeMillis() - startSuspendTime)
-					+ accumulatedSuspendTime;
-		}
-		return this.accumulatedSuspendTime;
-	}
-
-	public long getAccumulatedSuspendTime() {
-		return accumulatedSuspendTime;
-	}
-
-	public synchronized double getFactor() {
-		return factor;
-	}
-
-	public synchronized long getStartTime() {
-		return startTime;
-	}
-
-	public long getRealTime() {
-		return realTime;
-	}
-
-	public long getVirtualTime() {
-		return virtualTime;
-	}
-
-}

+ 0 - 123
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualTimer.java

@@ -1,123 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU 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 accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.simulation.core.runtime.timer;
-
-import java.util.PriorityQueue;
-import java.util.Queue;
-
-/**
- * Implementation of a {@link VirtualTimer} that operates on a virtual time.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class VirtualTimer {
-
-	public static abstract class VirtualTimerTask implements Runnable,
-			Comparable<VirtualTimerTask> {
-		long nextExecutionTime = 0;
-		long interval = 0;
-		long period = -1;
-		boolean isCanceled = false;
-
-		public int compareTo(VirtualTimerTask o) {
-			return (int) (nextExecutionTime - o.nextExecutionTime);
-		}
-
-		public boolean isCanceled() {
-			return isCanceled;
-		}
-
-		public void cancel() {
-			isCanceled = true;
-		}
-	}
-
-	private Queue<VirtualTimerTask> queue = new PriorityQueue<VirtualTimerTask>();
-
-	private VirtualClock clock;
-
-	private boolean canceled;
-	private Thread executer;
-
-	public VirtualClock getClock() {
-		return clock;
-	}
-
-	public VirtualTimer(VirtualClock clock) {
-		this.clock = clock;
-		executer = new Thread(new TaskExecuter());
-		executer.start();
-	}
-
-	public void scheduleTask(VirtualTimerTask task, long interval) {
-		task.interval = interval;
-		scheduleInternal(task, clock.getTime() + interval, -1);
-	}
-
-	public void schedulePeriodicalTask(VirtualTimerTask task, long interval,
-			long period) {
-		task.interval = interval;
-		scheduleInternal(task, clock.getTime() + interval, period);
-	}
-
-	private void scheduleInternal(VirtualTimerTask task, long time, long period) {
-		task.nextExecutionTime = time;
-		task.period = period;
-		synchronized (queue) {
-			queue.add(task);
-			if (queue.peek() == task)
-				queue.notifyAll();
-		}
-	}
-
-	public void cancel() {
-		canceled = true;
-		synchronized (queue) {
-			queue.clear();
-		}
-	}
-
-	public class TaskExecuter implements Runnable {
-		public void run() {
-			try {
-				while (!canceled) {
-					synchronized (queue) {
-						while (queue.isEmpty()) {
-							queue.wait();
-						}
-						VirtualTimerTask task = queue.peek();
-						if (task.isCanceled) {
-							queue.remove();
-							continue;
-						}
-						long virtualTime = clock.getTime();
-						long executionTime = task.nextExecutionTime;
-						if (executionTime <= virtualTime) {
-							task = queue.poll();
-							task.run();
-							if (task.period > -1) {
-								schedulePeriodicalTask(task, task.interval,
-										task.period);
-							}
-						}
-						// long timeout = executionTime - virtualTime;
-						// timeout = (long) (timeout / clock.getFactor());
-						// queue.wait(timeout);
-						queue.wait(10);
-					}
-				}
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-	}
-}

+ 1 - 184
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/SimulationView.java

@@ -10,8 +10,6 @@
  */
 package org.yakindu.sct.simulation.ui.view;
 
-import static org.apache.commons.lang.time.DurationFormatUtils.formatDuration;
-
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.PlatformObject;
 import org.eclipse.debug.core.DebugEvent;
@@ -21,10 +19,8 @@ import org.eclipse.debug.core.model.IDebugTarget;
 import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.debug.ui.contexts.DebugContextEvent;
 import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.draw2d.ColorConstants;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -32,27 +28,17 @@ import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.TreeViewerColumn;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Scale;
-import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.part.ViewPart;
 import org.yakindu.sct.simulation.core.debugmodel.SCTDebugTarget;
 import org.yakindu.sct.simulation.core.runtime.IExecutionContext;
 import org.yakindu.sct.simulation.core.runtime.IExecutionFacade;
 import org.yakindu.sct.simulation.core.runtime.impl.ExecutionEvent;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualClock;
 import org.yakindu.sct.simulation.ui.view.actions.CollapseAllAction;
 import org.yakindu.sct.simulation.ui.view.actions.ExpandAllAction;
 import org.yakindu.sct.simulation.ui.view.actions.HideTimeEventsAction;
@@ -70,16 +56,10 @@ import org.yakindu.sct.simulation.ui.view.editing.StringEditingSupport;
 public class SimulationView extends ViewPart implements IDebugContextListener,
 		IDebugEventSetListener {
 
-	private static final String INITIAL_TIME = "00:00:00:00";
-
 	private TreeViewer viewer;
 	private SCTDebugTarget debugTarget;
-	private Text scaleFactor;
 	private FormToolkit kit;
 	private Font font;
-	private Label lblVirtualTime;
-	private Label lblRealTime;
-	private ClockUpdater clockUpdater;
 
 	public SimulationView() {
 		DebugUITools.getDebugContextManager().addDebugContextListener(this);
@@ -88,12 +68,10 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 		kit.setBorderStyle(SWT.BORDER);
 		font = new Font(Display.getDefault(), new FontData("Courier", 10,
 				SWT.BOLD));
-		clockUpdater = new ClockUpdater();
 	}
 
 	@Override
 	public void dispose() {
-		clockUpdater.setTerminated(true);
 		super.dispose();
 		DebugUITools.getDebugContextManager().removeDebugContextListener(this);
 		DebugPlugin.getDefault().removeDebugEventListener(this);
@@ -103,17 +81,9 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 	@Override
 	public void createPartControl(Composite parent) {
 		parent.setLayout(new FillLayout(SWT.VERTICAL));
-		SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
-		sashForm.setSashWidth(5);
-		sashForm.setBackground(ColorConstants.white);
-		sashForm.setLayout(new FillLayout());
-		Composite top = kit.createComposite(sashForm);
+		Composite top = kit.createComposite(parent);
 		top.setLayout(new FillLayout(SWT.VERTICAL));
-		Composite bottom = kit.createComposite(sashForm);
-		bottom.setLayout(new FillLayout(SWT.VERTICAL));
-		sashForm.setWeights(new int[] { 3, 2 });
 		createViewer(top);
-		createTimeScalingSection(bottom);
 		hookActions();
 		setActiveSession();
 	}
@@ -138,82 +108,6 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 		viewer.getTree().setFocus();
 	}
 
-	private void createTimeScalingSection(Composite parent) {
-		Section section = kit.createSection(parent, Section.TITLE_BAR);
-		section.setText("time scaling");
-		Composite client = kit.createComposite(section);
-		client.setLayout(new GridLayout(3, false));
-		section.setClient(client);
-		createClocks(client);
-		createScalingControls(client);
-	}
-
-	private void createScalingControls(Composite client) {
-		final Scale scale = new Scale(client, SWT.NONE);
-		scale.setMinimum(1);
-		scale.setMaximum(100);
-		scale.setSelection(50);
-		scale.setPageIncrement(5);
-		scale.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				int selection = scale.getSelection();
-				if (selection > 50) {
-					selection = selection - 50;
-					scaleFactor.setText(String.valueOf(1.0d * selection));
-				} else if (selection == 50) {
-					scaleFactor.setText(String.valueOf(1.0d));
-				} else {
-					selection = 50 - selection;
-					scaleFactor.setText(String.valueOf(1.0d / selection));
-				}
-				applyScaleFactor();
-			}
-		});
-		GridDataFactory.fillDefaults().span(3, 0).applyTo(scale);
-		Label label = kit.createLabel(client, "scale factor: ");
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
-		scaleFactor = kit.createText(client, "1.0");
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(scaleFactor);
-		final Button setScale = kit.createButton(client, "apply", SWT.PUSH);
-		setScale.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				applyScaleFactor();
-			}
-		});
-		GridDataFactory.fillDefaults().applyTo(setScale);
-	}
-
-	private void createClocks(Composite parent) {
-		// Virtual Clock
-		Label label = kit.createLabel(parent, "scaled time:");
-		GridDataFactory.fillDefaults().applyTo(label);
-		lblVirtualTime = new Label(parent, SWT.NONE);
-		lblVirtualTime.setFont(font);
-		lblVirtualTime.setText(INITIAL_TIME);
-
-		GridDataFactory.fillDefaults().grab(true, false).span(2, 0)
-				.applyTo(lblVirtualTime);
-		// Real time clock
-		Label label2 = kit.createLabel(parent, "time:");
-		GridDataFactory.fillDefaults().applyTo(label2);
-		lblRealTime = new Label(parent, SWT.NONE);
-		lblRealTime.setFont(font);
-		lblRealTime.setText(INITIAL_TIME);
-		GridDataFactory.fillDefaults().grab(true, false).span(2, 0)
-				.applyTo(lblRealTime);
-
-	}
-
-	private void applyScaleFactor() {
-		try {
-			double factor = Double.parseDouble(scaleFactor.getText());
-			IExecutionFacade facade = (IExecutionFacade) debugTarget
-					.getAdapter(IExecutionFacade.class);
-			facade.getExecutionContext().setTimeScaleFactor(factor);
-		} catch (NumberFormatException ex) {
-		}
-	}
-
 	protected Viewer createViewer(Composite parent) {
 		viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
 				| SWT.FULL_SELECTION);
@@ -277,8 +171,6 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 
 	private void setInput(SCTDebugTarget newTarget) {
 		refreshInput(newTarget);
-		clockUpdater.setTerminated(false);
-		new Thread(clockUpdater).start();
 	}
 
 	public void handleDebugEvents(DebugEvent[] events) {
@@ -293,15 +185,12 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 			Display.getDefault().asyncExec(new Runnable() {
 				public void run() {
 					viewer.setInput(null);
-					clockUpdater.setTerminated(true);
 				}
 			});
 			break;
 		case DebugEvent.SUSPEND:
-			getClock().suspend();
 			break;
 		case DebugEvent.RESUME:
-			getClock().resume();
 			break;
 		}
 	}
@@ -323,76 +212,4 @@ public class SimulationView extends ViewPart implements IDebugContextListener,
 		IAction hideTimeEvent = new HideTimeEventsAction(true);
 		mgr.add(hideTimeEvent);
 	}
-
-	protected VirtualClock getClock() {
-		IExecutionFacade facade = (IExecutionFacade) debugTarget
-				.getAdapter(IExecutionFacade.class);
-		VirtualClock virtualClock = facade.getExecutionContext()
-				.getVirtualClock();
-		return virtualClock;
-	}
-
-	public class ClockUpdater implements Runnable {
-
-		private boolean terminated = false;
-		private UpdateUIThread updateUI = new UpdateUIThread();
-		private StopClock resetLabel = new StopClock();
-
-		public void run() {
-			while (!terminated) {
-				Display.getDefault().asyncExec(updateUI);
-				try {
-					Thread.sleep(100);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-			}
-			Display.getDefault().asyncExec(resetLabel);
-		}
-
-		public boolean isTerminated() {
-			return terminated;
-		}
-
-		public void setTerminated(boolean terminated) {
-			this.terminated = terminated;
-		}
-	}
-
-	private final class StopClock implements Runnable {
-		public void run() {
-			if (lblRealTime != null && !lblRealTime.isDisposed()) {
-				lblRealTime.setText(INITIAL_TIME);
-			}
-			if (lblVirtualTime != null && !lblVirtualTime.isDisposed()) {
-				lblVirtualTime.setText(INITIAL_TIME);
-			}
-		}
-	}
-
-	private final class UpdateUIThread implements Runnable {
-
-		private static final String PATTERN = "HH:mm:ss:SS";
-
-		public void run() {
-			// if (!debugTarget.isSuspended()) {
-			VirtualClock virtualClock = getClock();
-			if (virtualClock.getStartTime() > 0) {
-				if (lblVirtualTime != null && !lblVirtualTime.isDisposed()) {
-					String text = formatDuration(virtualClock.getTime()
-							- virtualClock.getStartTime(), PATTERN);
-					lblVirtualTime.setText(text);
-				}
-				if (lblRealTime != null && !lblRealTime.isDisposed()) {
-					String text = formatDuration(
-							System.currentTimeMillis()
-									- virtualClock.getPauseTime()
-									- virtualClock.getStartTime(), PATTERN);
-					lblRealTime.setText(text);
-				}
-			}
-			// }
-		}
-	}
-
 }

+ 0 - 101
test-plugins/org.yakindu.sct.simulation.core.test/src/org/yakindu/sct/simulation/core/runtime/timer/VirtualClockTest.java

@@ -1,101 +0,0 @@
-/**
- * Copyright (c) 2012 committers of YAKINDU 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 accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.simulation.core.runtime.timer;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class VirtualClockTest {
-
-	private VirtualClock clock;
-
-	@Before
-	public void setup() {
-		clock = new VirtualClock();
-	}
-
-	@Test
-	public void testSimpleTimeScaling() throws InterruptedException {
-		long start = System.currentTimeMillis();
-		clock.start();
-		Thread.sleep(200);
-		clock.setFactor(2);
-		Thread.sleep(200);
-		assertFuzzy(clock.getTime() - start, 600);
-	}
-
-	@Test
-	public void testDoubleTimeScaling() throws InterruptedException {
-		long start = System.currentTimeMillis();
-		clock.start();
-		Thread.sleep(200);
-		clock.setFactor(2);
-		Thread.sleep(200);
-		clock.setFactor(0.5);
-		Thread.sleep(200);
-		assertFuzzy(clock.getTime() - start, 700);
-	}
-
-	@Test
-	public void testsuspendResume() throws InterruptedException {
-		long start = System.currentTimeMillis();
-		clock.start();
-		Thread.sleep(200);
-		clock.suspend();
-		Thread.sleep(200);
-		clock.resume();
-		assertFuzzy(clock.getTime() - start, 200);
-	}
-	
-	@Test
-	public void testsuspendResumeTimeScaling() throws InterruptedException {
-		long start = System.currentTimeMillis();
-		clock.start();
-		Thread.sleep(200);
-		clock.setFactor(2);
-		Thread.sleep(200);
-		clock.suspend();
-		Thread.sleep(200);
-		clock.resume();
-		clock.setFactor(0.5);
-		Thread.sleep(200);
-		assertFuzzy(clock.getTime() - start, 700);
-	}
-	
-	@Test
-	public void testScaleDuringsuspend() throws InterruptedException {
-		long start = System.currentTimeMillis();
-		clock.start();
-		Thread.sleep(200);
-		clock.setFactor(4);
-		Thread.sleep(200);
-		clock.suspend();
-		clock.setFactor(0.25);
-		Thread.sleep(200);
-		clock.resume();
-		Thread.sleep(200);
-		assertFuzzy(clock.getTime() - start, 1050);
-	}
-
-	private static final long GAP = 20; // ms
-
-	protected void assertFuzzy(long expected, long actual) {
-		assertTrue("Expected " + expected + " but was " + actual,
-				expected > actual - GAP && expected < actual + GAP);
-	}
-
-}

+ 0 - 3
test-plugins/org.yakindu.sct.simulation.core.test/src/org/yakindu/sct/simulation/core/test/AllTests.java

@@ -12,15 +12,12 @@ package org.yakindu.sct.simulation.core.test;
 
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.yakindu.sct.simulation.core.runtime.timer.VirtualClockTest;
 
 /**
  * @author andreas muelder - Initial contribution and API
  * 
  */
 @RunWith(value = Suite.class)
-@SuiteClasses(value = { VirtualClockTest.class })
 public class AllTests {
 
 }