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