diff options
14 files changed, 185 insertions, 70 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java index fe367793a..789cfca2f 100644 --- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java +++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java @@ -112,9 +112,9 @@ import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement; import org.eclipse.qvtd.pivot.qvtimperative.SetStatement; import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiTransformationAnalysis; import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil; +import org.eclipse.qvtd.runtime.evaluation.AbstractComputation; import org.eclipse.qvtd.runtime.evaluation.AbstractInvocation; import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer; -import org.eclipse.qvtd.runtime.evaluation.AbstractValueOccurrence; import org.eclipse.qvtd.runtime.evaluation.Connection; import org.eclipse.qvtd.runtime.evaluation.InvocationConstructor; import org.eclipse.qvtd.runtime.evaluation.InvocationManager; @@ -1730,7 +1730,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato js.append("protected class "); js.append(functionName); js.append(" extends "); - js.appendClassReference(/*isIncremental ? AbstractIdentification.Incremental.class :*/ AbstractValueOccurrence.class); + js.appendClassReference(isIncremental ? AbstractComputation.Incremental.class : AbstractComputation.class); js.pushClassBody(functionName); js.append("protected final "); js.appendTypeDeclaration(cgFunction); @@ -1750,7 +1750,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato js.append("protected class "); js.append(functionName); js.append(" extends "); - js.appendClassReference(/*isIncremental ? AbstractIdentification.Incremental.class :*/ AbstractValueOccurrence.class); + js.appendClassReference(isIncremental ? AbstractComputation.Incremental.class : AbstractComputation.class); js.pushClassBody(functionName); js.append("protected final "); js.appendIsRequired(true); diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/Execution2GraphVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/Execution2GraphVisitor.java index e7e54ca36..2879918d1 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/Execution2GraphVisitor.java +++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/Execution2GraphVisitor.java @@ -36,7 +36,9 @@ import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.AttributeStatus; import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.ClassStatus; import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.PropertyStatus; import org.eclipse.qvtd.runtime.evaluation.AbstractExecutionVisitor; +import org.eclipse.qvtd.runtime.evaluation.Computation; import org.eclipse.qvtd.runtime.evaluation.Connection; +import org.eclipse.qvtd.runtime.evaluation.Execution; import org.eclipse.qvtd.runtime.evaluation.Interval; import org.eclipse.qvtd.runtime.evaluation.Invocation; import org.eclipse.qvtd.runtime.evaluation.InvocationConstructor; @@ -103,6 +105,7 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O private Map<@NonNull AssociationStatus, @NonNull String> associationId = new HashMap<>(); private Map<@NonNull ClassStatus, @NonNull String> classId = new HashMap<>(); + private Map<@NonNull Computation, @NonNull GraphNode> computation2node = new HashMap<>(); private Map<@NonNull Connection, @NonNull GraphNode> connection2node = new HashMap<>(); private Map<@NonNull Interval, @NonNull GraphNode> interval2node = new HashMap<>(); private Map<@NonNull Invocation, @NonNull GraphNode> invocation2node = new HashMap<>(); @@ -177,6 +180,36 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O return id; } + protected @NonNull GraphNode getComputationNode(@NonNull Computation object) { + GraphNode node = computation2node.get(object); + if (node == null) { + // id = object.getReferredMappingCall().getReferredMapping().getName() + "-" + (mappingId.size() + 1); + final String label = object.getName(); + // final String label; + // if (object instanceof EObject) { + // label = ((EObject)object).eClass().getName() + "-" + (invocation2node.size() + 1); + // } + // else { + // label = object.toString().replace("@", "\n@"); + // label = object.getClass().getSimpleName() + "-" + (invocation2node.size() + 1); + // } + node = new GraphNode() + { + @Override + public void appendNode(@NonNull GraphStringBuilder s, @NonNull String nodeName) { + s.setLabel(label); + s.setShape("hexagon"); + s.setColor("brown"); + // context.appendNode(mappingId, "hexagon", "#ffcc00", 30, 150, mappingId.replace("-", "\n")); + s.appendAttributedNode(nodeName); + } + }; + computation2node.put(object, node); + context.appendNode(node); + } + return node; + } + protected @NonNull GraphNode getConnectionNode(@NonNull Connection object) { GraphNode node = connection2node.get(object); if (node == null) { @@ -197,6 +230,18 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O return node; } + protected @NonNull GraphNode getExecutionNode(@NonNull Execution object) { + if (object instanceof Computation) { + return getComputationNode((@NonNull Computation) object); + } + else if (object instanceof Invocation) { + return getInvocationNode((@NonNull Invocation) object); + } + else { + throw new UnsupportedOperationException(); + } + } + protected @NonNull GraphNode getIntervalNode(@NonNull Interval object) { GraphNode node = interval2node.get(object); if (node == null) { @@ -350,6 +395,13 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O } @Override + public @Nullable String visitComputation(@NonNull Computation object) { + @SuppressWarnings("unused") + GraphNode computationNode = getComputationNode(object); + return null; + } + + @Override public @Nullable Object visitConnection(@NonNull Connection object) { GraphNode connectionNode = getConnectionNode(object); if (object instanceof Connection.Incremental) { @@ -511,7 +563,7 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O @Override public @Nullable String visitObjectManager(@NonNull ObjectManager objectManager) { - Set<Invocation.@NonNull Incremental> allInvocations = new HashSet<>(); + Set<Execution.@NonNull Incremental> allExecutions = new HashSet<>(); Set<SlotState.@NonNull Incremental> allSlots = new HashSet<>(); Map<@NonNull Object, @NonNull List<SlotState.@NonNull Incremental>> object2slots = new HashMap<>(); for (@NonNull Object object : objectManager.getObjects()) { @@ -525,14 +577,14 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O object2slots.put(object, objectSlots); } for (SlotState.@NonNull Incremental slotState : allSlots) { - Iterables.addAll(allInvocations, slotState.getSources()); - Iterables.addAll(allInvocations, slotState.getTargets()); + Iterables.addAll(allExecutions, slotState.getSources()); + Iterables.addAll(allExecutions, slotState.getTargets()); slotState.accept(this); } - for (Invocation.@NonNull Incremental invocation : allInvocations) { - invocation.accept(this); - GraphNode invocationNode = getInvocationNode(invocation); - for (@NonNull Object createdObject : invocation.getCreatedObjects()) { + for (Execution.@NonNull Incremental execution : allExecutions) { + execution.accept(this); + GraphNode invocationNode = getExecutionNode(execution); + for (@NonNull Object createdObject : execution.getCreatedObjects()) { GraphNode objectNode = getObjectNode(createdObject); appendEdge(invocationNode, objectNode, "green", null); } @@ -543,10 +595,10 @@ public class Execution2GraphVisitor extends AbstractExecutionVisitor<@Nullable O for (@NonNull Invocation invocation : slotState.getSources()) { appendEdge(getInvocationNode(invocation), slotNode, "green", null); } - for (@NonNull Invocation invocation : slotState.getTargets()) { - appendEdge(slotNode, getInvocationNode(invocation), "cyan", null); + for (@NonNull Execution invocation : slotState.getTargets()) { + appendEdge(slotNode, getExecutionNode(invocation), "cyan", null); } - Iterables.addAll(allInvocations, slotState.getTargets()); + Iterables.addAll(allExecutions, slotState.getTargets()); } for (@NonNull Object object : objectManager.getObjects()) { GraphNode objectNode = getObjectNode(object); diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractComputation.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractComputation.java index 4c1bb64ff..801e2ad5e 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractComputation.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractComputation.java @@ -10,6 +10,11 @@ *******************************************************************************/ package org.eclipse.qvtd.runtime.evaluation; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.eclipse.jdt.annotation.NonNull; /** @@ -19,10 +24,32 @@ public abstract class AbstractComputation implements Computation { public abstract static class Incremental extends AbstractComputation implements Computation.Incremental { + public static final @NonNull List<@NonNull Object> EMPTY_OBJECT_LIST = Collections.emptyList(); + + private Set<SlotState.@NonNull Incremental> readSlots = null; + + @Override + public void addReadSlot(SlotState.@NonNull Incremental readSlot) { + if (readSlots == null) { + readSlots = new HashSet<>(); + } + readSlots.add(readSlot); + readSlot.addTargetInternal(this); + } + + @Override + public @NonNull Iterable<@NonNull Object> getCreatedObjects() { + return /*createdObjects != null ? createdObjects :*/ EMPTY_OBJECT_LIST; + } } @Override public <R> R accept(@NonNull ExecutionVisitor<R> visitor) { return visitor.visitComputation(this); } + + @Override + public @NonNull String getName() { + return toString().replace("@", "\n@"); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractSlotState.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractSlotState.java index d9ba21b31..33ed9e9a5 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractSlotState.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractSlotState.java @@ -26,23 +26,24 @@ public abstract class AbstractSlotState implements SlotState public abstract static class Incremental extends AbstractSlotState implements SlotState.Incremental { + public static final @NonNull List<Execution.@NonNull Incremental> EMPTY_EXECUTIONS_LIST = Collections.emptyList(); public static final @NonNull List<Invocation.@NonNull Incremental> EMPTY_INVOCATIONS_LIST = Collections.emptyList(); private Set<Invocation.@NonNull Incremental> sources = null; - private Set<Invocation.@NonNull Incremental> targets = null; + private Set<Execution.@NonNull Incremental> targets = null; @Override public void addSourceInternal(Invocation.@NonNull Incremental invocation) { if (sources == null) { - sources = new HashSet<Invocation.@NonNull Incremental>(); + sources = new HashSet<>(); } sources.add(invocation); } @Override - public void addTargetInternal(Invocation.@NonNull Incremental invocation) { + public void addTargetInternal(Execution.@NonNull Incremental invocation) { if (targets == null) { - targets = new HashSet<Invocation.@NonNull Incremental>(); + targets = new HashSet<>(); } targets.add(invocation); } @@ -54,8 +55,8 @@ public abstract class AbstractSlotState implements SlotState @Override - public @NonNull Iterable<Invocation.@NonNull Incremental> getTargets() { - return targets != null ? targets : EMPTY_INVOCATIONS_LIST; + public @NonNull Iterable<Execution.@NonNull Incremental> getTargets() { + return targets != null ? targets : EMPTY_EXECUTIONS_LIST; } } diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractValueOccurrence.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractValueOccurrence.java deleted file mode 100644 index 495d264d9..000000000 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractValueOccurrence.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Willink Transformations and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * E.D.Willink - Initial API and implementation - *******************************************************************************/ -package org.eclipse.qvtd.runtime.evaluation; - -import org.eclipse.jdt.annotation.NonNull; - -/** - * AbstractValueOccurrence provides the mandatory shared functionality of a cached value. - */ -public abstract class AbstractValueOccurrence implements Computation -{ - @Override - public <R> R accept(@NonNull ExecutionVisitor<R> visitor) { - return visitor.visitComputation(this); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Computation.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Computation.java index 0ee303cbe..a413b477c 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Computation.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Computation.java @@ -22,7 +22,7 @@ import org.eclipse.ocl.pivot.ids.IdResolver; * * @noimplement clients should derive from AbstractIdentification */ -public interface Computation extends ExecutionVisitable +public interface Computation extends Execution { @Nullable Object getResult(); @@ -40,7 +40,7 @@ public interface Computation extends ExecutionVisitable public @NonNull Computation getUniqueComputation(@Nullable Object @NonNull ... argValues); } - public interface Incremental extends Computation + public interface Incremental extends Computation, Execution.Incremental { } }
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Execution.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Execution.java new file mode 100644 index 000000000..413b5b772 --- /dev/null +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Execution.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2013, 2016 Willink Transformations and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * E.D.Willink - Initial API and implementation + *******************************************************************************/ +package org.eclipse.qvtd.runtime.evaluation; + +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.ocl.pivot.utilities.Nameable; + +/** + * An Execution identifies a unique execution and the objects/values that it uses. + * Derived EXecutions support Mapping Invocations and unique Function Computations + * + * @noimplement clients should derive from AbstractInvocation + */ +public interface Execution extends ExecutionVisitable, Nameable +{ + public interface Incremental extends Execution + { + void addReadSlot(SlotState.@NonNull Incremental readSlot); + @NonNull Iterable<@NonNull Object> getCreatedObjects(); + @Override + @NonNull String getName(); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java index 0ad5857a1..aad465730 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java @@ -12,14 +12,13 @@ package org.eclipse.qvtd.runtime.evaluation; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.ocl.pivot.ids.IdResolver; -import org.eclipse.ocl.pivot.utilities.Nameable; /** * An Invocation identifies a unique invocation of a Mapping and the objects/values bound to its guard variables. * * @noimplement clients should derive from AbstractInvocation */ -public interface Invocation extends ExecutionVisitable, Nameable +public interface Invocation extends Execution { /** * Execute the mapping invocation, returning true if successfully executed, or false if some predicate failed. @@ -46,14 +45,10 @@ public interface Invocation extends ExecutionVisitable, Nameable void unblock(); - public interface Incremental extends Invocation + public interface Incremental extends Invocation, Execution.Incremental { void addCreatedObject(@NonNull Object createdObject); - void addReadSlot(SlotState.@NonNull Incremental readSlot); void addWriteSlot(SlotState.@NonNull Incremental writeSlot); - @NonNull Iterable<@NonNull Object> getCreatedObjects(); - @Override - @NonNull String getName(); @NonNull Iterable<SlotState.@NonNull Incremental> getReadSlots(); @NonNull Iterable<SlotState.@NonNull Incremental> getWriteSlots(); // void invalidate(); diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/ObjectManager.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/ObjectManager.java index 41877374b..b23adb716 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/ObjectManager.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/ObjectManager.java @@ -50,7 +50,7 @@ public interface ObjectManager extends ExecutionVisitable void getting(@NonNull Object eObject, /*@NonNull*/ EStructuralFeature eFeature, boolean isOpposite) throws InvocationFailedException; /** - * Identify that the read of eFeature of eObject return ecoreValue. + * Identify that the read of eFeature of eObject returns ecoreValue. */ - void got(Invocation.@NonNull Incremental invocation, @NonNull Object eObject, /*@NonNull*/ EStructuralFeature eFeature, @Nullable Object ecoreValue); + void got(Execution.@NonNull Incremental invocation, @NonNull Object eObject, /*@NonNull*/ EStructuralFeature eFeature, @Nullable Object ecoreValue); } diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/SlotState.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/SlotState.java index 89bd6cb6e..7668dca99 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/SlotState.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/SlotState.java @@ -43,11 +43,11 @@ public interface SlotState extends ExecutionVisitable public interface Incremental extends SlotState { void addSourceInternal(Invocation.@NonNull Incremental invocation); - void addTargetInternal(Invocation.@NonNull Incremental invocation); + void addTargetInternal(Execution.@NonNull Incremental invocation); @NonNull EStructuralFeature getEFeature(); SlotState.@NonNull Incremental getPrimarySlotState(); @Nullable Object getValue(); @NonNull Iterable<Invocation.@NonNull Incremental> getSources(); - @NonNull Iterable<Invocation.@NonNull Incremental> getTargets(); + @NonNull Iterable<Execution.@NonNull Incremental> getTargets(); } } diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/IncrementalObjectManager.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/IncrementalObjectManager.java index 0f0a35f7d..cbcd0dedd 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/IncrementalObjectManager.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/IncrementalObjectManager.java @@ -26,6 +26,7 @@ import org.eclipse.ocl.pivot.utilities.LabelUtil; import org.eclipse.qvtd.runtime.evaluation.AbstractObjectManager; import org.eclipse.qvtd.runtime.evaluation.AbstractSlotState; import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer; +import org.eclipse.qvtd.runtime.evaluation.Execution; import org.eclipse.qvtd.runtime.evaluation.Invocation; import org.eclipse.qvtd.runtime.evaluation.InvocationFailedException; import org.eclipse.qvtd.runtime.evaluation.ObjectManager; @@ -830,9 +831,9 @@ public class IncrementalObjectManager extends AbstractObjectManager } @Override - public void got(Invocation.@NonNull Incremental invocation, @NonNull Object eObject, /*@NonNull*/ EStructuralFeature eFeature, @Nullable Object ecoreValue) { + public void got(Execution.@NonNull Incremental execution, @NonNull Object eObject, /*@NonNull*/ EStructuralFeature eFeature, @Nullable Object ecoreValue) { assert eFeature != null; BasicSlotState slotState = getSlotState(eObject, eFeature); - invocation.addReadSlot(slotState); + execution.addReadSlot(slotState); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java index 8183d0136..cc4de1c3b 100644 --- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java +++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java @@ -39,6 +39,7 @@ import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue; import org.eclipse.qvtd.runtime.evaluation.AbstractObjectManager; import org.eclipse.qvtd.runtime.evaluation.AbstractSlotState; import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer; +import org.eclipse.qvtd.runtime.evaluation.Execution; import org.eclipse.qvtd.runtime.evaluation.Invocation; import org.eclipse.qvtd.runtime.evaluation.InvocationFailedException; import org.eclipse.qvtd.runtime.evaluation.ObjectManager; @@ -1014,7 +1015,7 @@ public class LazyObjectManager extends AbstractObjectManager } @Override - public void got(Invocation.@NonNull Incremental invocation, @NonNull Object eObject, EStructuralFeature eFeature, @Nullable Object ecoreValue) { + public void got(Execution.@NonNull Incremental computation, @NonNull Object eObject, EStructuralFeature eFeature, @Nullable Object ecoreValue) { // Ignore incremental API } }
\ No newline at end of file diff --git a/tests/org.eclipse.qvtd.doc.bigmde2016.tests/src-copy/org/eclipse/qvtd/doc/bigmde2016/tests/qvtc/tx/Families2Persons.java b/tests/org.eclipse.qvtd.doc.bigmde2016.tests/src-copy/org/eclipse/qvtd/doc/bigmde2016/tests/qvtc/tx/Families2Persons.java index b62d2d250..2bc177ae8 100644 --- a/tests/org.eclipse.qvtd.doc.bigmde2016.tests/src-copy/org/eclipse/qvtd/doc/bigmde2016/tests/qvtc/tx/Families2Persons.java +++ b/tests/org.eclipse.qvtd.doc.bigmde2016.tests/src-copy/org/eclipse/qvtd/doc/bigmde2016/tests/qvtc/tx/Families2Persons.java @@ -26,8 +26,8 @@ import org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Families2Persons.Families2Pers import org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Families2Persons.Families2PersonsPackage; import org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Persons.PersonsFactory; import org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Persons.PersonsPackage; +import org.eclipse.qvtd.runtime.evaluation.AbstractComputation; import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer; -import org.eclipse.qvtd.runtime.evaluation.AbstractValueOccurrence; import org.eclipse.qvtd.runtime.evaluation.TransformationExecutor; import org.eclipse.qvtd.runtime.internal.evaluation.AbstractComputationConstructor; import org.eclipse.qvtd.runtime.library.model.ModelObjectsOfKindOperation; @@ -116,7 +116,7 @@ public class Families2Persons extends AbstractTransformer /** * ::isFemale(member : Families::Member[1]) : Boolean[1] */ - protected class FUN_isFemale extends AbstractValueOccurrence + protected class FUN_isFemale extends AbstractComputation { protected final @NonNull Families2Persons self; protected /*@NonInvalid*/ org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Families.@org.eclipse.jdt.annotation.NonNull Member member; @@ -188,7 +188,7 @@ public class Families2Persons extends AbstractTransformer /** * ::familyName(member : Families::Member[1]) : String[1] */ - protected class FUN_familyName extends AbstractValueOccurrence + protected class FUN_familyName extends AbstractComputation { protected final @NonNull Families2Persons self; protected /*@NonInvalid*/ org.eclipse.qvtd.doc.bigmde2016.tests.qvtc.Families.@org.eclipse.jdt.annotation.NonNull Member member_0; diff --git a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java index a57a52bd6..42b57f595 100644 --- a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java +++ b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java @@ -59,7 +59,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiIncrementalExecutor; import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiTransformationExecutor; import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperative; import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil; -import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer; import org.eclipse.qvtd.runtime.evaluation.Transformer; import org.eclipse.qvtd.xtext.qvtbase.tests.LoadTestCase; import org.eclipse.qvtd.xtext.qvtbase.tests.utilities.TestsXMLUtil; @@ -631,7 +630,6 @@ public class QVTrCompilerTests extends LoadTestCase Class<? extends Transformer> txClass = myQVT.buildTransformation("HierarchicalStateMachine2FlatStateMachine", "HierarchicalStateMachine2FlatStateMachine.qvtr", "flat", "http://www.eclipse.org/qvtd/xtext/qvtrelation/tests/hstm2fstm/HierarchicalStateMachine2FlatStateMachine", false);//, - // "FlatStateMachine.FlatStateMachinePackage", "HierarchicalStateMachine.HierarchicalStateMachinePackage"); // myQVT.createGeneratedExecutor(txClass); myQVT.loadInput("hier", "MiniModel.xmi"); @@ -647,11 +645,44 @@ public class QVTrCompilerTests extends LoadTestCase myQVT.loadInput("hier", "LargerModel.xmi"); myQVT.executeTransformation(); myQVT.saveOutput("flat", "LargerModel_CG.xmi", "LargerModel_expected.xmi", FlatStateMachineNormalizer.INSTANCE); + } + finally { + myQVT.dispose(); + } + } + + @Test + public void testQVTrCompiler_HierarchicalStateMachine2FlatStateMachine_iCG() throws Exception { + // Splitter.RESULT.setState(true); + // Splitter.STAGES.setState(true); + // Scheduler.DEBUG_GRAPHS.setState(true); + // AbstractTransformer.EXCEPTIONS.setState(true); + // AbstractTransformer.INVOCATIONS.setState(true); + // QVTm2QVTp.PARTITIONING.setState(true); + // QVTr2QVTc.VARIABLES.setState(true); + MyQVT myQVT = new MyQVT("hstm2fstm"); + try { + Class<? extends Transformer> txClass = myQVT.buildTransformation("HierarchicalStateMachine2FlatStateMachine", + "HierarchicalStateMachine2FlatStateMachine.qvtr", "flat", + "http://www.eclipse.org/qvtd/xtext/qvtrelation/tests/hstm2fstm/HierarchicalStateMachine2FlatStateMachine", true);//, // - // myQVT.createGeneratedExecutor(txClass); - // myQVT.loadInput("seqDgm", "SeqUM.xmi"); - // myQVT.executeTransformation(); - // myQVT.saveOutput("stm", "StmcUM_CG.xmi", "StmcUM_expected.xmi", null); + myQVT.createGeneratedExecutor(txClass); + myQVT.loadInput("hier", "MiniModel.xmi"); + Transformer tx = myQVT.executeTransformation(); + Execution2GraphVisitor.writeGraphMLfile(tx, getProjectFileURI("hstm2fstm/temp/MiniModel-incremental.graphml")); + myQVT.saveOutput("flat", "MiniModel_CG.xmi", "MiniModel_expected.xmi", FlatStateMachineNormalizer.INSTANCE); + // + myQVT.createGeneratedExecutor(txClass); + myQVT.loadInput("hier", "SimpleModel.xmi"); + tx = myQVT.executeTransformation(); + Execution2GraphVisitor.writeGraphMLfile(tx, getProjectFileURI("hstm2fstm/temp/SimpleModel-incremental.graphml")); + myQVT.saveOutput("flat", "SimpleModel_CG.xmi", "SimpleModel_expected.xmi", FlatStateMachineNormalizer.INSTANCE); + // + myQVT.createGeneratedExecutor(txClass); + myQVT.loadInput("hier", "LargerModel.xmi"); + tx = myQVT.executeTransformation(); + Execution2GraphVisitor.writeGraphMLfile(tx, getProjectFileURI("hstm2fstm/temp/LargerModel-incremental.graphml")); + myQVT.saveOutput("flat", "LargerModel_CG.xmi", "LargerModel_expected.xmi", FlatStateMachineNormalizer.INSTANCE); } finally { myQVT.dispose(); @@ -742,8 +773,8 @@ public class QVTrCompilerTests extends LoadTestCase // Splitter.GROUPS.setState(true); // Splitter.RESULT.setState(true); // Splitter.STAGES.setState(true); - AbstractTransformer.EXCEPTIONS.setState(true); - AbstractTransformer.INVOCATIONS.setState(true); + // AbstractTransformer.EXCEPTIONS.setState(true); + // AbstractTransformer.INVOCATIONS.setState(true); // QVTm2QVTp.PARTITIONING.setState(true); MyQVT myQVT = new MyQVT("seq2stm"); try { |