[unrelated] Promote some Utils/Helpers from QVTd
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/utilities/PivotUtilInternal.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/utilities/PivotUtilInternal.java
index 9102dcf..8780c1f 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/utilities/PivotUtilInternal.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/utilities/PivotUtilInternal.java
@@ -36,6 +36,7 @@
 import org.eclipse.ocl.pivot.Constraint;
 import org.eclipse.ocl.pivot.DataType;
 import org.eclipse.ocl.pivot.Element;
+import org.eclipse.ocl.pivot.Import;
 import org.eclipse.ocl.pivot.LambdaType;
 import org.eclipse.ocl.pivot.LanguageExpression;
 import org.eclipse.ocl.pivot.LoopExp;
@@ -190,6 +191,7 @@
 		}
 		else {
 			EClass eClass = eObject.eClass();
+			assert eClass != null;
 			Attribution attribution = Attribution.REGISTRY.get(eClass);
 			if (attribution == null) {
 				for (EClass superClass = eClass; superClass.getESuperTypes().size() > 0;) {
@@ -452,6 +454,13 @@
 	/**
 	 * @since 1.3
 	 */
+	public static @NonNull List<@NonNull Import> getOwnedImportsList(@NonNull Model asModel) {
+		return ClassUtil.nullFree(asModel.getOwnedImports());
+	}
+
+	/**
+	 * @since 1.3
+	 */
 	public static @NonNull List<@NonNull Variable> getOwnedIteratorsList(@NonNull LoopExp loopExp) {
 		return ClassUtil.nullFree(loopExp.getOwnedIterators());
 	}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
index bc71630..4e7411e 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
@@ -26,6 +26,7 @@
 import org.eclipse.ocl.pivot.CollectionLiteralPart;
 import org.eclipse.ocl.pivot.CollectionRange;
 import org.eclipse.ocl.pivot.CollectionType;
+import org.eclipse.ocl.pivot.Comment;
 import org.eclipse.ocl.pivot.CompleteClass;
 import org.eclipse.ocl.pivot.Element;
 import org.eclipse.ocl.pivot.IfExp;
@@ -127,6 +128,12 @@
 		return collectionRange;
 	}
 
+	public @NonNull Comment createComment(@NonNull String comment) {
+		Comment asComment = PivotFactory.eINSTANCE.createComment();
+		asComment.setBody(comment);
+		return asComment;
+	}
+
 	public @NonNull IfExp createIfExp(@NonNull OCLExpression asCondition, @NonNull OCLExpression asThen, @NonNull OCLExpression asElse) {
 		Type commonType = getMetamodelManager().getCommonType(ClassUtil.nonNullState(asThen.getType()), TemplateParameterSubstitutions.EMPTY,
 			ClassUtil.nonNullState(asElse.getType()), TemplateParameterSubstitutions.EMPTY);
@@ -227,6 +234,14 @@
 		return asVariable;
 	}
 
+	public @NonNull LetVariable createLetVariable(@NonNull String name, @NonNull Type asType, boolean isRequired) {
+		LetVariable asVariable = PivotFactory.eINSTANCE.createLetVariable();
+		asVariable.setName(name);
+		asVariable.setType(asType);
+		asVariable.setIsRequired(isRequired);
+		return asVariable;
+	}
+
 	public @NonNull LetVariable createLetVariable(@NonNull String name, @NonNull Type asType, boolean isRequired, @NonNull OCLExpression asInitExpression) {
 		LetVariable asVariable = PivotFactory.eINSTANCE.createLetVariable();
 		asVariable.setName(name);
@@ -604,9 +619,6 @@
 		eContainer.eSet(eContainmentFeature, safeExp);
 	}
 
-	/**
-	 * @since 1.3
-	 */
 	public void setType(@NonNull OCLExpression asExpression, Type type, boolean isRequired, @Nullable Type typeValue) {
 		setType(asExpression, type, isRequired);
 		Type primaryTypeValue = typeValue != null ? getMetamodelManager().getPrimaryType(typeValue) : null;
@@ -624,9 +636,6 @@
 		}
 	} */
 
-	/**
-	 * @since 1.3
-	 */
 	public void setType(@NonNull TypedElement asTypedElement, Type type, boolean isRequired) {
 		Type primaryType = type != null ? getMetamodelManager().getPrimaryType(type) : null;
 		if (primaryType != asTypedElement.getType()) {
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotUtil.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotUtil.java
index 4191de9..1e98fd2 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotUtil.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotUtil.java
@@ -16,6 +16,7 @@
 import java.util.List;
 
 import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EClassifier;
 import org.eclipse.emf.ecore.EDataType;
@@ -24,6 +25,7 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EOperation;
 import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -89,6 +91,7 @@
 import org.eclipse.ocl.pivot.TupleLiteralPart;
 import org.eclipse.ocl.pivot.TupleType;
 import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.TypeExp;
 import org.eclipse.ocl.pivot.TypedElement;
 import org.eclipse.ocl.pivot.Variable;
 import org.eclipse.ocl.pivot.VariableDeclaration;
@@ -103,6 +106,7 @@
 import org.eclipse.ocl.pivot.internal.utilities.EnvironmentFactoryInternal;
 import org.eclipse.ocl.pivot.internal.utilities.OCLInternal;
 import org.eclipse.ocl.pivot.internal.utilities.PivotObjectImpl;
+import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
 import org.eclipse.ocl.pivot.library.LibraryFeature;
 import org.eclipse.ocl.pivot.resource.CSResource;
 import org.eclipse.ocl.pivot.values.InvalidValueException;
@@ -1037,6 +1041,13 @@
 	/**
 	 * @since 1.3
 	 */
+	public static @NonNull Property getOpposite(@NonNull Property asProperty) {
+		return ClassUtil.nonNullState(asProperty.getOpposite());
+	}
+
+	/**
+	 * @since 1.3
+	 */
 	public static @NonNull OCLExpression getOwnedArgument(@NonNull OperationCallExp object, int index) {
 		return ClassUtil.nonNullState(object.getOwnedArguments().get(index));
 	}
@@ -1366,6 +1377,13 @@
 	/**
 	 * @since 1.3
 	 */
+	public static @NonNull Type getReferredType(@NonNull TypeExp typeExp) {
+		return ClassUtil.nonNullState(typeExp.getReferredType());
+	}
+
+	/**
+	 * @since 1.3
+	 */
 	public static @NonNull VariableDeclaration getReferredVariable(@NonNull VariableExp variableExp) {
 		return ClassUtil.nonNullState(variableExp.getReferredVariable());
 	}
@@ -1480,6 +1498,26 @@
 	}
 
 	/**
+	 * Replace oldChild at its eContainer.eContainmentFeature by newChild.
+	 * @since 1.3
+	 */
+	public static void replaceChild(@NonNull EObject oldChild, @NonNull EObject newChild) {
+		EObject eContainer = oldChild.eContainer();
+		EReference eContainmentFeature = oldChild.eContainmentFeature();
+		if (eContainmentFeature.isMany()) {
+			@SuppressWarnings("unchecked") EList<EObject> list = (EList<EObject>)eContainer.eGet(eContainmentFeature);
+			int index = list.indexOf(oldChild);
+			assert index >= 0;
+			PivotUtilInternal.resetContainer(oldChild);
+			list.add(index, newChild);
+		}
+		else {
+			PivotUtilInternal.resetContainer(oldChild);
+			eContainer.eSet(eContainmentFeature, newChild);
+		}
+	}
+
+	/**
 	 * Rewrite asTree and all its descendants to replace all "?." and "?->" navigations by their safe counterparts.
 	 * @since 1.3
 	 * @deprecated use PivotHelper