1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
14 * @author Toni Kalajainen
16 package org.simantics.utils.datastructures.hints;
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
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.
28 * If the higher priority context or its hint is removed, the next lower level hint
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.
35 public interface IHintStack extends IHintObservable {
37 void addHintContext(IHintContext hints, int priority);
39 boolean removeHintContext(IHintContext hints);
42 * Returns a wrapper hint context whose read operations originate from the stack, and
43 * write operations to the a local stack (argument ctx)
45 * @param ctx the hint context to write into
46 * @return write-localized hint context based on this hint stack
48 IHintContext createStackRead(final IHintContext ctx);