]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/hints/IHintStack.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.utils.datastructures / src / org / simantics / utils / datastructures / hints / IHintStack.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 /*\r
13  *\r
14  * @author Toni Kalajainen\r
15  */\r
16 package org.simantics.utils.datastructures.hints;\r
17 \r
18 \r
19 /**\r
20  * IHintStack is a layered stack of hint contexts.  \r
21  * Each hint context has a priority. \r
22  * Hint set in higher priority context overrides all lower priority hints of \r
23  * the same key.\r
24  * \r
25  * Hint set in a hint context does not become effective if there \r
26  * exists another hint of the same key in a higher priority context. \r
27  * \r
28  * If the higher priority context or its hint is removed, the next lower level hint\r
29  * becomes effective.\r
30  * \r
31  * getHint() method is global. It returns the highest priority value for the key.\r
32  * It does not return the hint set for a specific context, instead it returns the hint\r
33  * set in the highest priority context.  \r
34  */\r
35 public interface IHintStack extends IHintObservable {\r
36 \r
37         void addHintContext(IHintContext hints, int priority);\r
38         \r
39         boolean removeHintContext(IHintContext hints);\r
40         \r
41         /**\r
42          * Returns a wrapper hint context whose read operations originate from the stack, and\r
43          * write operations to the a local stack (argument ctx)\r
44          * \r
45      * @param ctx the hint context to write into\r
46      * @return write-localized hint context based on this hint stack\r
47          */\r
48         IHintContext createStackRead(final IHintContext ctx);   \r
49         \r
50 }\r