Просмотр исходного кода

removed renamed trafficlight stuff

Axel Terfloth 9 лет назад
Родитель
Сommit
9aefb7dc21
17 измененных файлов с 0 добавлено и 2603 удалено
  1. 0 7
      examples/org.yakindu.sct.examples.trafficlight/.classpath
  2. 0 2
      examples/org.yakindu.sct.examples.trafficlight/.gitignore
  3. 0 3
      examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.core.resources.prefs
  4. 0 2
      examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.core.runtime.prefs
  5. 0 12
      examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.jdt.core.prefs
  6. 0 22
      examples/org.yakindu.sct.examples.trafficlight/assembly.xml
  7. 0 2
      examples/org.yakindu.sct.examples.trafficlight/build.properties
  8. 0 32
      examples/org.yakindu.sct.examples.trafficlight/model/GenModelJava.sgen
  9. 0 549
      examples/org.yakindu.sct.examples.trafficlight/model/TrafficLightWaiting.sct
  10. 0 43
      examples/org.yakindu.sct.examples.trafficlight/pom.xml
  11. 0 37
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/IStatemachine.java
  12. 0 48
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/ITimer.java
  13. 0 25
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/ITimerCallback.java
  14. 0 217
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService.java
  15. 0 101
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService.java
  16. 0 52
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine.java
  17. 0 1449
      examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine.java

+ 0 - 7
examples/org.yakindu.sct.examples.trafficlight/.classpath

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src-gen"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>

+ 0 - 2
examples/org.yakindu.sct.examples.trafficlight/.gitignore

@@ -1,2 +0,0 @@
-/bin/
-/target/

+ 0 - 3
examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.core.resources.prefs

@@ -1,3 +0,0 @@
-eclipse.preferences.version=1
-encoding//model/TrafficLightWaiting.sct=UTF-8
-encoding/<project>=UTF-8

+ 0 - 2
examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.core.runtime.prefs

@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n

+ 0 - 12
examples/org.yakindu.sct.examples.trafficlight/.settings/org.eclipse.jdt.core.prefs

@@ -1,12 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7

+ 0 - 22
examples/org.yakindu.sct.examples.trafficlight/assembly.xml

@@ -1,22 +0,0 @@
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-  <id>content</id>
-  <formats>
-    <format>zip</format>
-  </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
-  <fileSets>
-    <fileSet>
-      <directory>${basedir}</directory>
-      <excludes>
-        <exclude>pom.xml</exclude>
-        <exclude>assembly.xml</exclude>
-        <exclude>target/**</exclude>
-        <exclude>bin/**</exclude>
-        <exclude>**/.svn/**</exclude>
-        <exclude>target</exclude>
-      </excludes>
-    </fileSet>
-  </fileSets>
-</assembly>

+ 0 - 2
examples/org.yakindu.sct.examples.trafficlight/build.properties

@@ -1,2 +0,0 @@
-source.. = src-gen/
-bin.includes = .

+ 0 - 32
examples/org.yakindu.sct.examples.trafficlight/model/GenModelJava.sgen

@@ -1,32 +0,0 @@
-GeneratorModel for yakindu::java {
-
-	statechart TrafficLightWaiting {
-	 	
-		feature Outlet {
-			targetProject = "org.yakindu.sct.examples.trafficlight"
-			targetFolder = "src-gen"
-		}
-
-		feature Naming {
-			basePackage = "org.yakindu.sct.examples.trafficlight.cyclebased"
-		}
-
-		feature GeneralFeatures {
-			RuntimeService = true
-			TimerService = true
-		}
-		
-		feature LicenseHeader {
-			licenseText = "
-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
-�"
-		}
-	}
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 549
examples/org.yakindu.sct.examples.trafficlight/model/TrafficLightWaiting.sct


+ 0 - 43
examples/org.yakindu.sct.examples.trafficlight/pom.xml

@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.yakindu.sct</groupId>
-		<artifactId>org.yakindu.sct.releng</artifactId>
-		<version>2.5.0-SNAPSHOT</version>
-		<relativePath>../../releng/org.yakindu.sct.releng/pom.xml</relativePath>
-	</parent>
-	<groupId>org.yakindu.sct.examples</groupId>
-	<artifactId>org.yakindu.sct.examples.trafficlight</artifactId>
-	<packaging>pom</packaging>
-
-	<properties>
-		<build-helper-version>1.3</build-helper-version>
-	</properties>
-
-	<build>
-		<plugins>
-			<plugin>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<version>2.3</version>
-				<configuration>
-					<descriptors>
-						<descriptor>assembly.xml</descriptor>
-					</descriptors>
-				</configuration>
-				<executions>
-					<execution>
-						<id>make-assembly</id> <!-- this is used for inheritance merges -->
-						<phase>package</phase> <!-- bind to the packaging phase -->
-						<goals>
-							<goal>single</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-
-		</plugins>
-	</build>
-</project>

+ 0 - 37
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/IStatemachine.java

@@ -1,37 +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.examples.trafficlight.cyclebased;
-
-/**
- * Basic interface for statemachines.
- */
-public interface IStatemachine {
-
-	/**
-	* Initializes the statemachine. Use to init internal variables etc.
-	*/
-	public void init();
-
-	/**
-	* Enters the statemachine. Sets the statemachine in a defined state.
-	*/
-	public void enter();
-
-	/**
-	* Exits the statemachine. Leaves the statemachine with a defined state.
-	*/
-	public void exit();
-
-	/**
-	* Start a run-to-completion cycle.
-	*/
-	public void runCycle();
-}

+ 0 - 48
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/ITimer.java

@@ -1,48 +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.examples.trafficlight.cyclebased;
-
-/**
- * Interface a timer has to implement. Use to implement your own timer
- * service.
- * 
- */
-public interface ITimer {
-
-	/**
-	 * Starts the timing for a given time event id.
-	 * 
-	 * @param callback
-	 * 			  : The target callback where the time event has to be raised.
-	 * 
-	 * @param eventID
-	 *            : The eventID the timer should use if timed out.
-	 *            
-	 * @param time
-	 *            : Time in milliseconds after the given time event should be
-	 *            triggered
-	 *            
-	 * @param isPeriodic
-	 * 			  : Set to true if the time event should be triggered periodically
-	 */
-	public void setTimer(ITimerCallback callback, int eventID, long time, boolean isPeriodic);
-
-	/**
-	 * Unset a time event.
-	 * 
-	 * @param callback
-	 * 			: The target callback for which the time event has to be unset.
-	 * 
-	 * @param eventID
-	 * 			: The time event id.
-	 */
-	public void unsetTimer(ITimerCallback callback, int eventID);
-}

+ 0 - 25
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/ITimerCallback.java

@@ -1,25 +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.examples.trafficlight.cyclebased;
-
-/**
-* Interface for state machines which use timed event triggers.
-*/
-public interface ITimerCallback {
-	
-	/**
-	* Callback method if a time event occurred.
-	* 
-	* @param eventID
-	* 			:The id of the occurred event.
-	*/
-	public void timeElapsed(int eventID);
-}

+ 0 - 217
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/RuntimeService.java

@@ -1,217 +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.examples.trafficlight.cyclebased;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-/**
- * Runtime service for state machines to execute a run to completion step
- * periodically.
- * 
- */
-public class RuntimeService {
-
-	private static RuntimeService runtimeService;
-
-	private Timer timer = null;
-
-	private Map<Long, StatemachineTimerTask> timerTasks = new HashMap<Long, StatemachineTimerTask>();
-
-	private class StatemachineTimerTask extends TimerTask {
-
-		private List<IStatemachine> statemachineList = new LinkedList<IStatemachine>();
-
-		private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
-
-		private boolean isPaused = false;
-
-		@Override
-		public void run() {
-			lock.readLock().lock();
-			if (!isPaused) {
-				for (IStatemachine statemachine : statemachineList) {
-					statemachine.runCycle();
-				}
-			}
-			lock.readLock().unlock();
-		}
-
-		/**
-		 * Adds the given state machine to the TimerTask.
-		 * 
-		 * @param statemachine
-		 * @return {@code true} if state machine is added properly.
-		 */
-		public boolean addStatemachine(IStatemachine statemachine) {
-			lock.writeLock().lock();
-			boolean ret = statemachineList.add(statemachine);
-			lock.writeLock().unlock();
-			return ret;
-		}
-
-		/**
-		 * Removes the given state machine from the TimerTask.
-		 * 
-		 * @param statemachine
-		 * @return {@code true} if state machine is removed properly.
-		 */
-		public boolean removeStatemachine(IStatemachine statemachine) {
-			lock.writeLock().lock();
-			boolean ret = statemachineList.remove(statemachine);
-			lock.writeLock().unlock();
-			return ret;
-		}
-
-		public void pause() {
-			isPaused = true;
-		}
-
-		public void resume() {
-			isPaused = false;
-		}
-	}
-
-	private RuntimeService() {
-		// Not intended to be instantiated.
-	}
-
-	/**
-	 * Returns the {@code RuntimeService} instance as singleton.
-	 * 
-	 * @return The singleton {@code RuntimeService} instance
-	 */
-	public static RuntimeService getInstance() {
-		if (runtimeService == null) {
-			runtimeService = new RuntimeService();
-		}
-		return runtimeService;
-	}
-
-	/**
-	 * Registers an {@link IStatemachine} for scheduled fixed rate execution
-	 * 
-	 * @param statemachine
-	 *            - The statemachine to execute
-	 * @param cyclePeriod
-	 *            - the fixed rate cycle period for scheduling
-	 * @return {@code true} if state machine is added properly.
-	 */
-	public boolean registerStatemachine(IStatemachine statemachine,
-			long cyclePeriod) {
-
-		if (timerTasks.containsKey(cyclePeriod)) {
-			// TimerTask for cycle time already existing -> add statemachine
-			return timerTasks.get(cyclePeriod).addStatemachine(statemachine);
-		} else {
-			// Create new TimerTask for cycle period and add statemachine
-			StatemachineTimerTask timerTask = new StatemachineTimerTask();
-			timerTasks.put(cyclePeriod, timerTask);
-			boolean ret = timerTask.addStatemachine(statemachine);
-			// Create a new Timer instance if runtime service was cancelled
-			// before
-			if (timer == null) {
-				timer = new Timer();
-			}
-			timer.scheduleAtFixedRate(timerTask, 0, cyclePeriod);
-			return ret;
-		}
-	}
-
-	/**
-	 * Removes the given state machine from runtime service.
-	 * 
-	 * @param statemachine
-	 *            - the statemachine which should be removed
-	 * @param cyclePeriod
-	 *            - the scheduling cycle period of the statemachine
-	 * @return {@code true} if state machine is removed properly.
-	 */
-	public boolean unregisterStatemachine(IStatemachine statemachine,
-			long cyclePeriod) {
-		if (timerTasks.containsKey(cyclePeriod)) {
-			boolean ret = timerTasks.get(cyclePeriod).removeStatemachine(
-					statemachine);
-
-			return ret;
-		}
-		return false;
-	}
-
-	/**
-	 * Cancels the execution of statemachines for the given cycle period. This
-	 * stops the execution of statemachines which are registered for the given
-	 * cycle period and cancels the executing {@link TimerTask}.
-	 * 
-	 * @return {@code true} if poperly cancelled
-	 */
-	public boolean cancelAll(long cyclePeriod) {
-		if (timer != null && timerTasks.containsKey(cyclePeriod)) {
-			TimerTask task = timerTasks.get(cyclePeriod);
-			task.cancel();
-			timer.purge();
-			timerTasks.remove(cyclePeriod);
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Pauses the execution of all statemachines which are registered for the
-	 * given cyclePeriod.
-	 * 
-	 * @param cyclePeriod
-	 * @return {@code true} if properly paused
-	 * 
-	 */
-	public boolean pauseAll(long cyclePeriod) {
-		if (timerTasks.containsKey(cyclePeriod)) {
-			timerTasks.get(cyclePeriod).pause();
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Resumes the execution of all statemachines which are registered for the
-	 * given cyclePeriod.
-	 * 
-	 * @param cyclePeriod
-	 * @return {@code true} if properly resumed
-	 * 
-	 */
-	public boolean resumeAll(long cyclePeriod) {
-		if (timerTasks.containsKey(cyclePeriod)) {
-			timerTasks.get(cyclePeriod).resume();
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Cancels the execution of all registered statemachines. This cancels the
-	 * executing {@link Timer} freeing all allocated resources and terminates
-	 * all existing execution threads.
-	 */
-	public void cancelTimer() {
-		if (timer != null) {
-			timer.cancel();
-			timer.purge();
-			timerTasks.clear();
-			timer = null;
-		}
-	}
-}

+ 0 - 101
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/TimerService.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.examples.trafficlight.cyclebased;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * Default timer service implementation.
- * 
- */
-public class TimerService implements ITimer {
-
-	private final Timer timer = new Timer();
-	
-	private final List<TimeEventTask> timerTaskList = new ArrayList<TimeEventTask>();
-	
-	/**
-	 * Timer task that reflects a time event. It's internally used by
-	 * {@link TimerService}.
-	 * 
-	 */
-	private class TimeEventTask extends TimerTask {
-	
-		private ITimerCallback callback;
-	
-		int eventID;
-	
-		/**
-		 * Constructor for a time event.
-		 * 
-		 * @param callback
-		 *            : Set to {@code true} if event should be repeated
-		 *            periodically.
-		 * 
-		 * @param eventID
-		 *            : Index position within the state machine's timeEvent
-		 *            array.
-		 */
-		public TimeEventTask(ITimerCallback callback, int eventID) {
-			this.callback = callback;
-			this.eventID = eventID;
-		}
-	
-		public void run() {
-			callback.timeElapsed(eventID);
-		}
-	
-		public boolean equals(Object obj) {
-			if (obj instanceof TimeEventTask) {
-				return ((TimeEventTask) obj).callback.equals(callback)
-						&& ((TimeEventTask) obj).eventID == eventID;
-			}
-			return super.equals(obj);
-		}
-	}
-	
-	public void setTimer(final ITimerCallback callback, final int eventID,
-			long time, boolean isPeriodic) {
-	
-		// Create a new TimerTask for given event and store it.
-		TimeEventTask timerTask = new TimeEventTask(callback, eventID);
-		timerTaskList.add(timerTask);
-	
-		// start scheduling the timer
-		if (isPeriodic) {
-			timer.scheduleAtFixedRate(timerTask, time, time);
-		} else {
-			timer.schedule(timerTask, time);
-		}
-	}
-	
-	public void unsetTimer(ITimerCallback callback, int eventID) {
-		int index = timerTaskList.indexOf(new TimeEventTask(callback, eventID));
-		if (index != -1) {
-			timerTaskList.get(index).cancel();
-			timer.purge();
-			timerTaskList.remove(index);
-		}
-	}
-	
-	/**
-	 * Cancel timer service. Use this to end possible timing threads and free
-	 * memory resources.
-	 */
-	public void cancel() {
-		timer.cancel();
-		timer.purge();
-	}
-}
-

+ 0 - 52
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/ITrafficLightWaitingStatemachine.java

@@ -1,52 +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.examples.trafficlight.cyclebased.trafficlightwaiting;
-import org.yakindu.sct.examples.trafficlight.cyclebased.IStatemachine;
-import org.yakindu.sct.examples.trafficlight.cyclebased.ITimerCallback;
-
-public interface ITrafficLightWaitingStatemachine
-		extends
-			ITimerCallback,
-			IStatemachine {
-
-	public interface SCITrafficLight {
-		public boolean getRed();
-		public void setRed(boolean value);
-		public boolean getYellow();
-		public void setYellow(boolean value);
-		public boolean getGreen();
-		public void setGreen(boolean value);
-
-	}
-
-	public SCITrafficLight getSCITrafficLight();
-
-	public interface SCIPedestrian {
-		public boolean getRequest();
-		public void setRequest(boolean value);
-		public boolean getRed();
-		public void setRed(boolean value);
-		public boolean getGreen();
-		public void setGreen(boolean value);
-
-	}
-
-	public SCIPedestrian getSCIPedestrian();
-
-	public interface SCInterface {
-		public void raisePedestrianRequest();
-		public void raiseOnOff();
-
-	}
-
-	public SCInterface getSCInterface();
-
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1449
examples/org.yakindu.sct.examples.trafficlight/src-gen/org/yakindu/sct/examples/trafficlight/cyclebased/trafficlightwaiting/TrafficLightWaitingStatemachine.java