X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.utils.datastructures%2Fsrc%2Forg%2Fsimantics%2Futils%2Fdatastructures%2Fcontext%2FIContext.java;fp=bundles%2Forg.simantics.utils.datastructures%2Fsrc%2Forg%2Fsimantics%2Futils%2Fdatastructures%2Fcontext%2FIContext.java;h=792fa63854dba9a52106c2718a5232e8ef580595;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=5c5ff8b1b44b548c5652bbe21b92112d8fda10cc;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/context/IContext.java b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/context/IContext.java index 5c5ff8b1b..792fa6385 100644 --- a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/context/IContext.java +++ b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/context/IContext.java @@ -1,126 +1,126 @@ -/******************************************************************************* - * 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.datastructures.context; - -import java.util.Collection; - -import org.simantics.utils.threads.IThreadWorkQueue; - -/** - * Observable container. - * - * TODO: add addAll() method - * - * @see Context for implementation - * - * @author Toni Kalajainen - * @param - */ -public interface IContext { - - /** - * Put an item to the context. - * @param item - */ - void add(E item); - - /** - * Remove an item from the context. - * @param item - * @return true if was found and removed - */ - boolean remove(E item); - - /** - * Checks whether an item is in the context - * @param item an item - * @return true if context contains an item - */ - boolean contains(E item); - - /** - * Clears all items from the context. - */ - void clear(); - - /** - * Get all items by class - * @param - * @param clazz - * @return collection - */ - Collection getItemsByClass(Class clazz); - - /** - * Get a single item by class. - * (Convenience method) - * - * @param - * @param clazz - * @return the item - * @throws RuntimeException if single interactor was not found - */ - R getSingleItem(Class clazz); - - /** - * Checks that the context has the item by the class - * @param - * @param clazz - * @return true if contained - */ - boolean containsItemByClass(Class clazz); - - /** - * Get a single item by class. - * (Convenience method) - * - * @param - * @param clazz - * @return the item or null - * @throws RuntimeException if more than one items were found - */ - R getAtMostOneItemOfClass(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 listener - */ - void addContextListener(IContextListener listener); - - /** - * remove listener - * @param listener - */ - void removeContextListener(IContextListener listener); - - /** - * add listener - * @param thread thread - * @param listener - */ - void addContextListener(IThreadWorkQueue thread, IContextListener listener); - - /** - * remove listener - * @param thread thread - * @param listener - */ - void removeContextListener(IThreadWorkQueue thread, IContextListener 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 + *******************************************************************************/ + +package org.simantics.utils.datastructures.context; + +import java.util.Collection; + +import org.simantics.utils.threads.IThreadWorkQueue; + +/** + * Observable container. + * + * TODO: add addAll() method + * + * @see Context for implementation + * + * @author Toni Kalajainen + * @param + */ +public interface IContext { + + /** + * Put an item to the context. + * @param item + */ + void add(E item); + + /** + * Remove an item from the context. + * @param item + * @return true if was found and removed + */ + boolean remove(E item); + + /** + * Checks whether an item is in the context + * @param item an item + * @return true if context contains an item + */ + boolean contains(E item); + + /** + * Clears all items from the context. + */ + void clear(); + + /** + * Get all items by class + * @param + * @param clazz + * @return collection + */ + Collection getItemsByClass(Class clazz); + + /** + * Get a single item by class. + * (Convenience method) + * + * @param + * @param clazz + * @return the item + * @throws RuntimeException if single interactor was not found + */ + R getSingleItem(Class clazz); + + /** + * Checks that the context has the item by the class + * @param + * @param clazz + * @return true if contained + */ + boolean containsItemByClass(Class clazz); + + /** + * Get a single item by class. + * (Convenience method) + * + * @param + * @param clazz + * @return the item or null + * @throws RuntimeException if more than one items were found + */ + R getAtMostOneItemOfClass(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 listener + */ + void addContextListener(IContextListener listener); + + /** + * remove listener + * @param listener + */ + void removeContextListener(IContextListener listener); + + /** + * add listener + * @param thread thread + * @param listener + */ + void addContextListener(IThreadWorkQueue thread, IContextListener listener); + + /** + * remove listener + * @param thread thread + * @param listener + */ + void removeContextListener(IThreadWorkQueue thread, IContextListener listener); + +}