Exemple #1
0
        private QVTTemplate.IObjectTemplateExp ConstructObjectTemplateExp(QVTRelations.IRelation relation, QVTRelations.IDomainPattern domainPattern, EnAr.Element objectElement, ISet <EnAr.Connector> visitedConnectors = null)
        {
            EssentialOCL.IVariable variable = null;
            EMOF.IType             type     = emofImporter.ConstructTypeOfTyped(objectElement);

            // TODO manage the not ?
            if (objectElement.Name != "{not}")
            {
                variable = ConstructVariable(relation, objectElement);
                domainPattern?.BindsTo.Add(variable);
            }

            QVTTemplate.IObjectTemplateExp objectTemplateExp = new QVTTemplate.ObjectTemplateExp()
            {
                BindsTo       = variable,
                ReferredClass = type as EMOF.IClass,
                Where         = null // TODO
            };
            objectTemplateExp.SetAntiTemplate(variable == null);
            objectElementToObjectTemplate.Add(objectElement, objectTemplateExp);

            foreach (RunStateField runStateField in EnArExplorer.GetRunState(objectElement))
            {
                ConstructPropertyTemplateItem(relation, domainPattern, objectTemplateExp, runStateField);
            }

            foreach (EnAr.Connector connector in explorer.GetConnectorsLinkedTo(objectElement).FindAll(c => c.Stereotype != "qvtTransformationLink"))
            {
                Tuple <EnAr.ConnectorEnd, EnAr.Element> linked = explorer.GetElementOppositeTo(objectElement, connector);
                EnAr.ConnectorEnd connectorEnd  = linked.Item1;
                EnAr.Element      linkedElement = linked.Item2;
                //if (!string.IsNullOrWhiteSpace(connectorEnd.Role))
                //{
                ConstructPropertyTemplateItem(relation, domainPattern, objectTemplateExp, connector, connectorEnd, linkedElement, visitedConnectors);
                //}
            }

            return(objectTemplateExp);
        }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ObjectTemplateExpReferencedElementsCollection(ObjectTemplateExp parent)
 {
     this._parent = parent;
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ObjectTemplateExpChildrenCollection(ObjectTemplateExp parent)
 {
     this._parent = parent;
 }