-/*******************************************************************************\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
- *\r
- * @author Toni Kalajainen\r
- */\r
-package org.simantics.utils.datastructures.prioritystack;\r
-\r
-import org.simantics.utils.threads.IThreadWorkQueue;\r
-\r
-\r
-/**\r
- * Stack of interactor layers\r
- * @param <E> type of stack items\r
- */\r
-public interface IPriorityStack<E> {\r
- \r
- /**\r
- * Put an item to the stack \r
- * to the top of the stack.\r
- * @param item\r
- * @param priority \r
- */\r
- void add(E item, int priority);\r
-\r
- /**\r
- * Get priority of an item.\r
- * Priority affects the event handing, hint overriding and to the paint order of \r
- * the interactor.\r
- * \r
- * @param item the item\r
- * @return priority of the interactor or <code>null</code> if item does not exist \r
- */\r
- Integer getPriority(E item);\r
- \r
- /**\r
- * Remove item\r
- * @param item\r
- * @return true if was found and removed\r
- */\r
- boolean remove(E item); \r
-\r
- /**\r
- * Checks whether an item is in the stack\r
- * @param item\r
- * @return true if stack contains the specified item\r
- */\r
- boolean contains(E item);\r
-\r
- /**\r
- * Get all items by class. All items assignable to the specified class are\r
- * returned.\r
- * \r
- * @param <R>\r
- * @param clazz\r
- * @return all items assignable to the specified class\r
- */\r
- <R extends E> R[] getItemsByClass(Class<R> clazz);\r
-\r
- /**\r
- * Get a single item by class. (Convenience method)\r
- * \r
- * @param <R>\r
- * @param clazz\r
- * @return a single item of the specified class\r
- * @throws RuntimeException if single item was not found or if multiple\r
- * matching items were found\r
- */\r
- <R extends E> R getSingleItem(Class<R> clazz);\r
- \r
- /**\r
- * Get a snapshot of all the items\r
- * @return ordered list of items. The highest priority item is the last element.\r
- */\r
- E[] toArray();\r
- \r
- /**\r
- * add listener\r
- * @param thread\r
- * @param listener\r
- */\r
- void addStackListener(IThreadWorkQueue thread, IPriorityStackListener<E> listener);\r
- \r
- /**\r
- * remove listener\r
- * @param thread\r
- * @param listener\r
- */\r
- void removeStackListener(IThreadWorkQueue thread, IPriorityStackListener<E> listener);\r
-\r
- /**\r
- * add listener\r
- * @param listener\r
- */\r
- void addStackListener(IPriorityStackListener<E> listener);\r
- \r
- /**\r
- * remove listener\r
- * @param listener\r
- */\r
- void removeStackListener(IPriorityStackListener<E> listener);\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
+ *******************************************************************************/
+/*
+ *
+ * @author Toni Kalajainen
+ */
+package org.simantics.utils.datastructures.prioritystack;
+
+import org.simantics.utils.threads.IThreadWorkQueue;
+
+
+/**
+ * Stack of interactor layers
+ * @param <E> type of stack items
+ */
+public interface IPriorityStack<E> {
+
+ /**
+ * Put an item to the stack
+ * to the top of the stack.
+ * @param item
+ * @param priority
+ */
+ void add(E item, int priority);
+
+ /**
+ * Get priority of an item.
+ * Priority affects the event handing, hint overriding and to the paint order of
+ * the interactor.
+ *
+ * @param item the item
+ * @return priority of the interactor or <code>null</code> if item does not exist
+ */
+ Integer getPriority(E item);
+
+ /**
+ * Remove item
+ * @param item
+ * @return true if was found and removed
+ */
+ boolean remove(E item);
+
+ /**
+ * Checks whether an item is in the stack
+ * @param item
+ * @return true if stack contains the specified item
+ */
+ boolean contains(E item);
+
+ /**
+ * Get all items by class. All items assignable to the specified class are
+ * returned.
+ *
+ * @param <R>
+ * @param clazz
+ * @return all items assignable to the specified class
+ */
+ <R extends E> R[] getItemsByClass(Class<R> clazz);
+
+ /**
+ * Get a single item by class. (Convenience method)
+ *
+ * @param <R>
+ * @param clazz
+ * @return a single item of the specified class
+ * @throws RuntimeException if single item was not found or if multiple
+ * matching items were found
+ */
+ <R extends E> R getSingleItem(Class<R> clazz);
+
+ /**
+ * Get a snapshot of all the items
+ * @return ordered list of items. The highest priority item is the last element.
+ */
+ E[] toArray();
+
+ /**
+ * add listener
+ * @param thread
+ * @param listener
+ */
+ void addStackListener(IThreadWorkQueue thread, IPriorityStackListener<E> listener);
+
+ /**
+ * remove listener
+ * @param thread
+ * @param listener
+ */
+ void removeStackListener(IThreadWorkQueue thread, IPriorityStackListener<E> listener);
+
+ /**
+ * add listener
+ * @param listener
+ */
+ void addStackListener(IPriorityStackListener<E> listener);
+
+ /**
+ * remove listener
+ * @param listener
+ */
+ void removeStackListener(IPriorityStackListener<E> listener);
+
+}