Пример #1
0
        internal static ISet <CheckResultRelation1> Check(LL.MDE.DataModels.EnAr.Package p, string someString, LL.MDE.DataModels.EnAr.Package p2)
        {
            ISet <CheckResultRelation1> result = new HashSet <CheckResultRelation1>(); ISet <MatchDomainP> matchDomainPs = CheckDomainP(p); ISet <MatchDomainP2> matchDomainP2s = CheckDomainP2(p2); foreach (MatchDomainP matchDomainP in matchDomainPs)

            {
                foreach (MatchDomainP2 matchDomainP2 in matchDomainP2s)
                {
                    string s = matchDomainP.s;

                    LL.MDE.DataModels.EnAr.Element   pe = matchDomainP.pe;
                    LL.MDE.DataModels.EnAr.Connector c  = matchDomainP.c;
                    int target = matchDomainP.target;
                    int source = matchDomainP.source;
                    if (p2.Name == (s + "Other"))
                    {
                        CheckResultRelation1 checkonlysMatch = new CheckResultRelation1()
                        {
                            matchDomainP = matchDomainP, matchDomainP2 = matchDomainP2,
                        };
                        result.Add(checkonlysMatch);
                    }                             // End if
                }                                 // End foreach
            }                                     // End foreach
            return(result);
        }
Пример #2
0
        internal MatchDomainPo EnforcePo(CheckResultRelation1 checkresult, string s, string someString, int source, LL.MDE.DataModels.EnAr.Package po)
        {
            MatchDomainPo match = new MatchDomainPo(); LL.MDE.DataModels.EnAr.Package p = checkresult.matchDomainP.p;

            LL.MDE.DataModels.EnAr.Element   pe = checkresult.matchDomainP.pe;
            LL.MDE.DataModels.EnAr.Connector c = checkresult.matchDomainP.c;

            LL.MDE.DataModels.EnAr.Package p2 = checkresult.matchDomainP2.p2;

            // Contructing po
            editor.AddOrSetInField(po, "Name", s + "Out");
            LL.MDE.DataModels.EnAr.Element e = null;

            // Trying to resolve the object'e' globally using the transformation key
            transformation.ElementKeys.TryGetValue(new Tuple <string>(s + someString), out e);
            // If the object wasn't found globally, we try to find it locally
            if (e == null)
            {
                e = po.Elements.OfType <LL.MDE.DataModels.EnAr.Element>().FirstOrDefault(var865311109 => var865311109?.Name == s + someString);

                // If the object was found locally, we add it to the global cache
                if (e != null)
                {
                    transformation.ElementKeys[new Tuple <string>(e?.Name)] = e;
                }
                // If the object still doesn't exist, we create it
                else
                {
                    e = (LL.MDE.DataModels.EnAr.Element)editor.CreateNewObjectInField(po, "Elements");
                    // We add the created object to the global cache
                    if (transformation.ElementKeys.ContainsKey(new Tuple <string>(e?.Name)))
                    {
                        throw new Exception("Two objects cannot have the same key");
                    }
                    else
                    {
                        transformation.ElementKeys[new Tuple <string>(e?.Name)] = e;
                    }
                }
            }

            // Contructing e
            editor.AddOrSetInField(e, "Name", s + someString);
            editor.AddOrSetInField(e, "Type", "Component");
            LL.MDE.DataModels.EnAr.Connector con = null;
            con = (LL.MDE.DataModels.EnAr.Connector)editor.CreateNewObjectInField(e, "Connectors");

            // Contructing con
            editor.AddOrSetInField(con, "SupplierID", source);
            editor.AddOrSetInField(con, "Type", "Dependency");

            // Return newly binded variables
            match.po  = po;
            match.e   = e;
            match.con = con;
            return(match);
        }