]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.simulator.variable/src/org/simantics/simulator/variable/impl/SimpleRealm.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.simulator.variable / src / org / simantics / simulator / variable / impl / SimpleRealm.java
index 2f29037dd3df1bfe888996de2316ce5b4b49e03b..0aa1ff3b834e65221cd4eb3951f3bee628647980 100644 (file)
@@ -1,62 +1,62 @@
-/*******************************************************************************\r
- * Copyright (c) 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *     Semantum Oy - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.simulator.variable.impl;\r
-\r
-import java.util.ArrayDeque;\r
-import java.util.concurrent.CountDownLatch;\r
-import java.util.concurrent.Semaphore;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.simantics.simulator.variable.Realm;\r
-\r
-public class SimpleRealm implements Realm {\r
-\r
-       private ArrayDeque<Runnable> tasks = new ArrayDeque<Runnable>();\r
-       private Semaphore taskCount = new Semaphore(0);\r
-\r
-       public void executeTasks() {            \r
-               while(taskCount.tryAcquire()) {\r
-                       Runnable task;\r
-                       synchronized (tasks) {\r
-                               task = tasks.poll();\r
-                       }\r
-                       task.run();\r
-               }\r
-       }\r
-        \r
-       public void waitTasks(long waitDuration) throws InterruptedException {\r
-               taskCount.tryAcquire(waitDuration, TimeUnit.MILLISECONDS);\r
-       }\r
-       \r
-       @Override\r
-       public void syncExec(final Runnable runnable) throws InterruptedException {\r
-               final CountDownLatch latch = new CountDownLatch(1);\r
-               asyncExec(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               runnable.run();\r
-                               latch.countDown();\r
-                       }                       \r
-               });\r
-               latch.await();\r
-       }\r
-\r
-       @Override\r
-       public void asyncExec(Runnable runnable) {\r
-               synchronized (tasks) {\r
-                       tasks.add(runnable);                    \r
-               }\r
-               taskCount.release();\r
-       }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2013 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.simulator.variable.impl;
+
+import java.util.ArrayDeque;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import org.simantics.simulator.variable.Realm;
+
+public class SimpleRealm implements Realm {
+
+       private ArrayDeque<Runnable> tasks = new ArrayDeque<Runnable>();
+       private Semaphore taskCount = new Semaphore(0);
+
+       public void executeTasks() {            
+               while(taskCount.tryAcquire()) {
+                       Runnable task;
+                       synchronized (tasks) {
+                               task = tasks.poll();
+                       }
+                       task.run();
+               }
+       }
+        
+       public void waitTasks(long waitDuration) throws InterruptedException {
+               taskCount.tryAcquire(waitDuration, TimeUnit.MILLISECONDS);
+       }
+       
+       @Override
+       public void syncExec(final Runnable runnable) throws InterruptedException {
+               final CountDownLatch latch = new CountDownLatch(1);
+               asyncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               runnable.run();
+                               latch.countDown();
+                       }                       
+               });
+               latch.await();
+       }
+
+       @Override
+       public void asyncExec(Runnable runnable) {
+               synchronized (tasks) {
+                       tasks.add(runnable);                    
+               }
+               taskCount.release();
+       }
+
+}