]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/ILookupService.java
Sync git svn branch with SVN repository r33269.
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / ILookupService.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 package org.simantics.scenegraph;\r
13 \r
14 /**\r
15  * A bijective mapping service between unique String ID's and scene graph nodes\r
16  * ({@link INode}).\r
17  * \r
18  * @author Tuukka Lehtonen\r
19  */\r
20 public interface ILookupService {\r
21 \r
22     /**\r
23      * Associates the specified node with the specified ID. If the specified ID\r
24      * is already associated the previous association will be overwritten with\r
25      * the new one and the previously associated node is returned.\r
26      * \r
27      * @param id the id to map to the specified node\r
28      * @param node node to map to specified id\r
29      * @return the node previously associated with the specified ID or\r
30      *         <code>null</code> if the specified ID no previous association\r
31      * @throws NullPointerException if either argument is <code>null</code>\r
32      */\r
33     INode map(String id, INode node);\r
34 \r
35     /**\r
36      * Removes possibly existing ID <=> node mapping from the lookup service.\r
37      * \r
38      * @param id the id to unmap\r
39      * @return the unmapped INode if successful, <code>null</code> otherwise\r
40      */\r
41     INode unmap(String id);\r
42 \r
43     /**\r
44      * Removes possibly existing node <=> ID mapping from the lookup service.\r
45      * \r
46      * @param node the node to unmap\r
47      * @return the unmapped ID if successful, <code>null</code> otherwise\r
48      */\r
49     String unmap(INode node);\r
50 \r
51     /**\r
52      * Get the node mapped to the specified ID.\r
53      * \r
54      * @param id identifier of the node to look for\r
55      * @return node mapped with specified id or <code>null</code> if no mapping\r
56      *         exists\r
57      */\r
58     INode lookupNode(String id);\r
59 \r
60     /**\r
61      * Get the mapping ID for the specified node.\r
62      * \r
63      * @param node node to get mapping ID for\r
64      * @return mapping ID of the node or <code>null</code> if node is not mapped\r
65      */\r
66     String lookupId(INode node);\r
67 \r
68 }\r