-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 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
- *******************************************************************************/\r
-\r
-package org.simantics.utils.threads.ua;\r
-\r
-import java.util.Set;\r
-import java.util.concurrent.TimeUnit;\r
-import java.util.concurrent.TimeoutException;\r
-\r
-/**\r
- * \r
- * \r
- * @author Toni Kalajainen (toni.kalajainen@vtt.fi)\r
- */\r
-public interface IStatefulObject<StateType, ErrorType extends Throwable> {\r
-\r
- void addStateListener(StateListener<StateType> listener);\r
- void removeStateListener(StateListener<StateType> listener);\r
- StateType getState();\r
- \r
- /**\r
- * Wait until state changes to one of the given states.\r
- * \r
- * @param set states that ends waiting \r
- * @throws InterruptedException\r
- * @return the state in the given set that broke the wait \r
- */\r
- StateType waitForState(Set<StateType> set) \r
- throws InterruptedException, ErrorType;\r
- \r
- /**\r
- * Wait until state changes to one of the given states.\r
- * \r
- * @param set states that ends waiting \r
- * @return the state in the given set that broke the wait \r
- */\r
- StateType waitForStateUninterruptibly(Set<StateType> set) \r
- throws ErrorType; \r
- \r
- \r
- /**\r
- * Wait until state changes to one of the given states or until\r
- * time out occurs. \r
- * \r
- * @param set\r
- * @param timeout\r
- * @param unit\r
- * @return state one in set\r
- * @throws InterruptedException thread was interrupted\r
- * @throws TimeoutException timeout occured\r
- */\r
- StateType waitForState(Set<StateType> set, long timeout, TimeUnit unit) \r
- throws InterruptedException, TimeoutException, ErrorType;\r
-\r
- /**\r
- * Get error state or null\r
- * @return error\r
- */\r
- ErrorType getError();\r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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
+ *******************************************************************************/
+
+package org.simantics.utils.threads.ua;
+
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ *
+ *
+ * @author Toni Kalajainen (toni.kalajainen@vtt.fi)
+ */
+public interface IStatefulObject<StateType, ErrorType extends Throwable> {
+
+ void addStateListener(StateListener<StateType> listener);
+ void removeStateListener(StateListener<StateType> listener);
+ StateType getState();
+
+ /**
+ * Wait until state changes to one of the given states.
+ *
+ * @param set states that ends waiting
+ * @throws InterruptedException
+ * @return the state in the given set that broke the wait
+ */
+ StateType waitForState(Set<StateType> set)
+ throws InterruptedException, ErrorType;
+
+ /**
+ * Wait until state changes to one of the given states.
+ *
+ * @param set states that ends waiting
+ * @return the state in the given set that broke the wait
+ */
+ StateType waitForStateUninterruptibly(Set<StateType> set)
+ throws ErrorType;
+
+
+ /**
+ * Wait until state changes to one of the given states or until
+ * time out occurs.
+ *
+ * @param set
+ * @param timeout
+ * @param unit
+ * @return state one in set
+ * @throws InterruptedException thread was interrupted
+ * @throws TimeoutException timeout occured
+ */
+ StateType waitForState(Set<StateType> set, long timeout, TimeUnit unit)
+ throws InterruptedException, TimeoutException, ErrorType;
+
+ /**
+ * Get error state or null
+ * @return error
+ */
+ ErrorType getError();
+
+}