X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2Fgraph%2FCopyAdvisorUtil.java;fp=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2Fgraph%2FCopyAdvisorUtil.java;h=61d09acdd3cb18981d53c67e9300d255a3fc23d6;hp=60d4c56aeaa54d9c5d0559dcea7b189d188e6a06;hb=e84008c029ef2336cf55ad371256c9a12a889e98;hpb=0f3c8efc2d05f7d76b6fa1c2228c9c6ba224374e diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java index 60d4c56ae..61d09acdd 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/CopyAdvisorUtil.java @@ -15,6 +15,7 @@ import gnu.trove.map.hash.THashMap; import java.util.Map; import java.util.Set; +import java.util.function.BiFunction; import org.simantics.databoard.Bindings; import org.simantics.databoard.binding.Binding; @@ -44,7 +45,6 @@ import org.simantics.diagram.synchronization.SynchronizationHints; import org.simantics.graph.db.TransferableGraphs; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.layer0.Layer0; -import org.simantics.utils.datastructures.BinaryFunction; /** * This class contains utility methods for the basic cut/copy operations @@ -223,7 +223,7 @@ public class CopyAdvisorUtil { * @return the copied resource * @throws DatabaseException */ - public static Resource copy(WriteGraph graph, Resource source, BinaryFunction advisor) throws DatabaseException { + public static Resource copy(WriteGraph graph, Resource source, BiFunction advisor) throws DatabaseException { return copy(graph, source, 0, advisor, new THashMap()); } @@ -238,11 +238,11 @@ public class CopyAdvisorUtil { * @return * @throws DatabaseException */ - public static Resource copy(WriteGraph graph, Resource source, BinaryFunction advisor, Map copyMap) throws DatabaseException { + public static Resource copy(WriteGraph graph, Resource source, BiFunction advisor, Map copyMap) throws DatabaseException { return copy(graph, source, 0, advisor, copyMap); } - private static Resource copy(WriteGraph graph, Resource source, int level, BinaryFunction advisor, Map copyMap) throws DatabaseException { + private static Resource copy(WriteGraph graph, Resource source, int level, BiFunction advisor, Map copyMap) throws DatabaseException { if (DEBUG_COPY) System.out.println("[" + level + "] CopyAdvisorUtil.copy(" + NameUtils.getSafeName(graph, source) + ", advisor=" + advisor + ")"); @@ -320,7 +320,7 @@ public class CopyAdvisorUtil { } } else { if (advisor != null) { - Boolean result = advisor.call(graph, stm); + Boolean result = advisor.apply(graph, stm); if (Boolean.TRUE.equals(result)) { // Don't clone the object, just add relation to the same object. if (inverse != null) @@ -363,7 +363,7 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy2(WriteGraph graph, Resource source, - BinaryFunction advisor) throws DatabaseException { + BiFunction advisor) throws DatabaseException { return copy2(graph, source, 0, advisor, new THashMap()); } @@ -379,13 +379,13 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy2(WriteGraph graph, Resource source, - BinaryFunction advisor, Map copyMap) + BiFunction advisor, Map copyMap) throws DatabaseException { return copy2(graph, source, 0, advisor, copyMap); } private static Resource copy2(final WriteGraph graph, final Resource source, final int level, - BinaryFunction advisor, Map copyMap) + BiFunction advisor, Map copyMap) throws DatabaseException { if (DEBUG_COPY) System.out.println("[" + level + "] CopyAdvisorUtil.copy(" + NameUtils.getSafeName(graph, source) + ", advisor=" + advisor + ")"); @@ -536,7 +536,7 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy3(WriteGraph graph, Resource source, Resource model, - BinaryFunction advisor) throws DatabaseException { + BiFunction advisor) throws DatabaseException { String modelURI = graph.getURI(model); return copy3(graph, modelURI, source, 0, advisor, new THashMap()); } @@ -554,13 +554,13 @@ public class CopyAdvisorUtil { * @throws DatabaseException */ public static Resource copy3(WriteGraph graph, Resource source, Resource model, - BinaryFunction advisor, Map copyMap) throws DatabaseException { + BiFunction advisor, Map copyMap) throws DatabaseException { String modelURI = graph.getURI(model); return copy3(graph, modelURI, source, 0, advisor, copyMap); } private static Resource copy3(WriteGraph graph, String modelURI, Resource source, int level, - BinaryFunction advisor, Map copyMap) + BiFunction advisor, Map copyMap) throws DatabaseException { if (DEBUG_COPY) System.out.println("[" + level + "] CopyAdvisorUtil.copy(" + NameUtils.getSafeName(graph, source) + ", advisor=" + advisor + ")"); @@ -698,10 +698,10 @@ public class CopyAdvisorUtil { return copy; } - protected static StatementEvaluation evaluate(ReadGraph graph, Statement stm, BinaryFunction tester) { + protected static StatementEvaluation evaluate(ReadGraph graph, Statement stm, BiFunction tester) { if (tester == null) return StatementEvaluation.USE_DEFAULT; - return tester.call(graph, stm); + return tester.apply(graph, stm); } /**