1 /*******************************************************************************
2 * Copyright (c) 2007, 2013 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.objmap.forward;
14 import org.simantics.db.ReadGraph;
15 import org.simantics.objmap.exceptions.MappingException;
17 public interface IForwardMappingRule<Domain, Range> {
19 * Check whether a range element needs to be updated due to a change in the range element, without modifying the range element.
21 boolean checkChanges(ReadGraph graph, IForwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;
24 * Modifies the range element so that it corresponds to the domain element.
25 * @param g read transaction
26 * @param map unidirectional view of the current mapping
27 * @param domainElement the domain element that corresponds to the range element
28 * @param rangeElement the range element that is updated
29 * @return true if the rule made some modifications
30 * @throws MappingException
32 boolean updateRange(ReadGraph graph, IForwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;
33 void createRange(ReadGraph graph, IForwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;