]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.structural.synchronization.client / src / org / simantics / structural / synchronization / base / SolverNameUtil.java
diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java
new file mode 100644 (file)
index 0000000..9a44c01
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.structural.synchronization.base;\r
+\r
+import java.util.function.BiConsumer;\r
+\r
+public interface SolverNameUtil {\r
+\r
+       String getFreshName(String parentName, String name);\r
+       String ensureNameIsVariationOf(String parentName, int id, String name);\r
+\r
+       /**\r
+        * The name utility can internally keep track of\r
+        * <code>suggested name -> generated\r
+        * fresh name</code> associations that it has had to perform during its\r
+        * lifetime in {@link #getFreshName(String, String)}. If the implementation\r
+        * keeps track of these renames, the purpose of this method is to check\r
+        * whether at the time of invocation it is possible to rename the solver\r
+        * components to their suggested names or not. For every rename that is\r
+        * performed, the specified consumer shall be invoked with the arguments\r
+        * <code>(previous name, new name)</code> after the rename has been\r
+        * performed.\r
+        * \r
+        * <p>\r
+        * This method is intended to be invoked right at the end of\r
+        * synchronization.\r
+        * \r
+        * @param callback\r
+        *            a binary consumer that takes as first argument the previous\r
+        *            name of the renamed component and as second argument the new\r
+        *            (current) name of the component or <code>null</code> to skip\r
+        *            callback invocation\r
+        */\r
+       default void applySuggestedNames(BiConsumer<String, String> callback) {}\r
+\r
+}\r