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%2Fhints%2FIHintObservable.java;h=9eb4e827c97ff074c6bd9b640629d748aa9eb8f9;hp=9d31c1c6365b5b114d7ed5b51ac24ac86f42e9ee;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/hints/IHintObservable.java b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/hints/IHintObservable.java index 9d31c1c63..9eb4e827c 100644 --- a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/hints/IHintObservable.java +++ b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/hints/IHintObservable.java @@ -1,127 +1,127 @@ -/******************************************************************************* - * Copyright (c) 2007, 2015 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 - added getHintsUnsafe - *******************************************************************************/ -/* - * - * @author Toni Kalajainen - */ -package org.simantics.utils.datastructures.hints; - -import java.util.Map; - -import org.simantics.utils.datastructures.hints.IHintContext.Key; -import org.simantics.utils.threads.IThreadWorkQueue; - - -public interface IHintObservable { - - /** - * Check if this observable contains a value for the specified hint key. - * - * @param key the key to check for a value - * @return true if there is a value, false otherwise - */ - boolean containsHint(Key key); - - /** - * Get hint - * @param type of the object bound to the specified key - * @param key key - * @return the hint or null if does not exist - */ - E getHint(Key key); - - /** - * Get all hints in this context - * @return a snapshot of all the hints in this context - */ - Map getHints(); - - /** - * Get all hints in this context without creating defensive copies in the - * implementation if possible. - *

- * Use this only when reading and you know what you're doing. - * - * @return the backing map of hints in this context without extra copying if possible - */ - Map getHintsUnsafe(); - - /** - * Get all hints whose key is a subclass of clazz - * @param - * @param clazz the class - * @return key object map - */ - Map getHintsOfClass(Class clazz); - - /** - * Adds hint listener, which gets events for all hint changes - * - * @param listener - */ - void addHintListener(IHintListener listener); - - /** - * Removes hint listener - * - * @param listener - */ - void removeHintListener(IHintListener listener); - - /** - * Adds hint listener for a specific key - * @param key - * @param listener - */ - void addKeyHintListener(Key key, IHintListener listener); - - /** - * Removes hint listener - * @param key - * @param listener - */ - void removeKeyHintListener(Key key, IHintListener listener); - - /** - * Adds hint listener, which gets events for all hint changes - * - * @param threadAccess - * @param listener - */ - void addHintListener(IThreadWorkQueue threadAccess, IHintListener listener); - - /** - * Removes hint listener - * - * @param threadAccess - * @param listener - */ - void removeHintListener(IThreadWorkQueue threadAccess, IHintListener listener); - - /** - * Adds hint listener for a specific key - * @param threadAccess - * @param key - * @param listener - */ - void addKeyHintListener(IThreadWorkQueue threadAccess, Key key, IHintListener listener); - - /** - * Removes hint listener - * @param threadAccess - * @param key - * @param listener - */ - void removeKeyHintListener(IThreadWorkQueue threadAccess, Key key, IHintListener listener); - -} +/******************************************************************************* + * Copyright (c) 2007, 2015 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 - added getHintsUnsafe + *******************************************************************************/ +/* + * + * @author Toni Kalajainen + */ +package org.simantics.utils.datastructures.hints; + +import java.util.Map; + +import org.simantics.utils.datastructures.hints.IHintContext.Key; +import org.simantics.utils.threads.IThreadWorkQueue; + + +public interface IHintObservable { + + /** + * Check if this observable contains a value for the specified hint key. + * + * @param key the key to check for a value + * @return true if there is a value, false otherwise + */ + boolean containsHint(Key key); + + /** + * Get hint + * @param type of the object bound to the specified key + * @param key key + * @return the hint or null if does not exist + */ + E getHint(Key key); + + /** + * Get all hints in this context + * @return a snapshot of all the hints in this context + */ + Map getHints(); + + /** + * Get all hints in this context without creating defensive copies in the + * implementation if possible. + *

+ * Use this only when reading and you know what you're doing. + * + * @return the backing map of hints in this context without extra copying if possible + */ + Map getHintsUnsafe(); + + /** + * Get all hints whose key is a subclass of clazz + * @param + * @param clazz the class + * @return key object map + */ + Map getHintsOfClass(Class clazz); + + /** + * Adds hint listener, which gets events for all hint changes + * + * @param listener + */ + void addHintListener(IHintListener listener); + + /** + * Removes hint listener + * + * @param listener + */ + void removeHintListener(IHintListener listener); + + /** + * Adds hint listener for a specific key + * @param key + * @param listener + */ + void addKeyHintListener(Key key, IHintListener listener); + + /** + * Removes hint listener + * @param key + * @param listener + */ + void removeKeyHintListener(Key key, IHintListener listener); + + /** + * Adds hint listener, which gets events for all hint changes + * + * @param threadAccess + * @param listener + */ + void addHintListener(IThreadWorkQueue threadAccess, IHintListener listener); + + /** + * Removes hint listener + * + * @param threadAccess + * @param listener + */ + void removeHintListener(IThreadWorkQueue threadAccess, IHintListener listener); + + /** + * Adds hint listener for a specific key + * @param threadAccess + * @param key + * @param listener + */ + void addKeyHintListener(IThreadWorkQueue threadAccess, Key key, IHintListener listener); + + /** + * Removes hint listener + * @param threadAccess + * @param key + * @param listener + */ + void removeKeyHintListener(IThreadWorkQueue threadAccess, Key key, IHintListener listener); + +}