]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java
Merge "Utility function for claiming literals"
[simantics/platform.git] / bundles / org.simantics.structural.synchronization.client / src / org / simantics / structural / synchronization / base / SolverNameUtil.java
1 package org.simantics.structural.synchronization.base;
2
3 import java.util.function.BiConsumer;
4
5 public interface SolverNameUtil {
6
7         String getFreshName(String parentName, String name);
8         String ensureNameIsVariationOf(String parentName, int id, String name);
9
10         /**
11          * The name utility can internally keep track of
12          * <code>suggested name -> generated
13          * fresh name</code> associations that it has had to perform during its
14          * lifetime in {@link #getFreshName(String, String)}. If the implementation
15          * keeps track of these renames, the purpose of this method is to check
16          * whether at the time of invocation it is possible to rename the solver
17          * components to their suggested names or not. For every rename that is
18          * performed, the specified consumer shall be invoked with the arguments
19          * <code>(previous name, new name)</code> after the rename has been
20          * performed.
21          * 
22          * <p>
23          * This method is intended to be invoked right at the end of
24          * synchronization.
25          * 
26          * @param callback
27          *            a binary consumer that takes as first argument the previous
28          *            name of the renamed component and as second argument the new
29          *            (current) name of the component or <code>null</code> to skip
30          *            callback invocation
31          */
32         default void applySuggestedNames(BiConsumer<String, String> callback) {}
33
34 }