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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.scenegraph;
\r
15 * A bijective mapping service between unique String ID's and scene graph nodes
\r
18 * @author Tuukka Lehtonen
\r
20 public interface ILookupService {
\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
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
33 INode map(String id, INode node);
\r
36 * Removes possibly existing ID <=> node mapping from the lookup service.
\r
38 * @param id the id to unmap
\r
39 * @return the unmapped INode if successful, <code>null</code> otherwise
\r
41 INode unmap(String id);
\r
44 * Removes possibly existing node <=> ID mapping from the lookup service.
\r
46 * @param node the node to unmap
\r
47 * @return the unmapped ID if successful, <code>null</code> otherwise
\r
49 String unmap(INode node);
\r
52 * Get the node mapped to the specified ID.
\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
58 INode lookupNode(String id);
\r
61 * Get the mapping ID for the specified node.
\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
66 String lookupId(INode node);
\r