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 *******************************************************************************/
12 package org.simantics.scenegraph;
15 * A bijective mapping service between unique String ID's and scene graph nodes
18 * @author Tuukka Lehtonen
20 public interface ILookupService {
23 * Associates the specified node with the specified ID. If the specified ID
24 * is already associated the previous association will be overwritten with
25 * the new one and the previously associated node is returned.
27 * @param id the id to map to the specified node
28 * @param node node to map to specified id
29 * @return the node previously associated with the specified ID or
30 * <code>null</code> if the specified ID no previous association
31 * @throws NullPointerException if either argument is <code>null</code>
33 INode map(String id, INode node);
36 * Removes possibly existing ID <=> node mapping from the lookup service.
38 * @param id the id to unmap
39 * @return the unmapped INode if successful, <code>null</code> otherwise
41 INode unmap(String id);
44 * Removes possibly existing node <=> ID mapping from the lookup service.
46 * @param node the node to unmap
47 * @return the unmapped ID if successful, <code>null</code> otherwise
49 String unmap(INode node);
52 * Get the node mapped to the specified ID.
54 * @param id identifier of the node to look for
55 * @return node mapped with specified id or <code>null</code> if no mapping
58 INode lookupNode(String id);
61 * Get the mapping ID for the specified node.
63 * @param node node to get mapping ID for
64 * @return mapping ID of the node or <code>null</code> if node is not mapped
66 String lookupId(INode node);