X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.utils.datastructures%2Fsrc%2Forg%2Fsimantics%2Futils%2Fdatastructures%2Fprioritystack%2FIPriorityStack.java;h=fc8087d89ad3eccd13c4787153edceae3f5a1c47;hp=ec29ca328257a99a5585da0aec0601c803aaed56;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/prioritystack/IPriorityStack.java b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/prioritystack/IPriorityStack.java index ec29ca328..fc8087d89 100644 --- a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/prioritystack/IPriorityStack.java +++ b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/prioritystack/IPriorityStack.java @@ -1,112 +1,112 @@ -/******************************************************************************* - * 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 type of stack items - */ -public interface IPriorityStack { - - /** - * 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 null 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 - * @param clazz - * @return all items assignable to the specified class - */ - R[] getItemsByClass(Class clazz); - - /** - * Get a single item by class. (Convenience method) - * - * @param - * @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 getSingleItem(Class 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 listener); - - /** - * remove listener - * @param thread - * @param listener - */ - void removeStackListener(IThreadWorkQueue thread, IPriorityStackListener listener); - - /** - * add listener - * @param listener - */ - void addStackListener(IPriorityStackListener listener); - - /** - * remove listener - * @param listener - */ - void removeStackListener(IPriorityStackListener listener); - -} +/******************************************************************************* + * 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 type of stack items + */ +public interface IPriorityStack { + + /** + * 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 null 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 + * @param clazz + * @return all items assignable to the specified class + */ + R[] getItemsByClass(Class clazz); + + /** + * Get a single item by class. (Convenience method) + * + * @param + * @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 getSingleItem(Class 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 listener); + + /** + * remove listener + * @param thread + * @param listener + */ + void removeStackListener(IThreadWorkQueue thread, IPriorityStackListener listener); + + /** + * add listener + * @param listener + */ + void addStackListener(IPriorityStackListener listener); + + /** + * remove listener + * @param listener + */ + void removeStackListener(IPriorityStackListener listener); + +}