예제 #1
0
 /// <summary>
 /// Checks if all properties in k1 are found in k2. If yes, k2 is useless.
 /// </summary>
 /// <param name="k1"></param>
 /// <param name="k2"></param>
 /// <returns></returns>
 private static bool Subsumes(QVTRelations.IKey k1, QVTRelations.IKey k2)
 {
     if (k1.Part.Count <= k2.Part.Count && k1.PropertyPaths().Count <= k2.PropertyPaths().Count)
     {
         return(k1.Part.IsSubsetOf(k2.Part) &&
                k1.PropertyPaths().All(k1PropertyPath => k2.PropertyPaths()
                                       .Any(k2PropertyPath => AreEqual(k1PropertyPath, k2PropertyPath))));
     }
     return(false);
 }
예제 #2
0
 private static void MergeKeyInto(QVTRelations.IKey existingKey, QVTRelations.IKey keyToBeMergedInto)
 {
     foreach (EMOF.IProperty propertyToMerge in keyToBeMergedInto.Part)
     {
         if (!existingKey.Part.Contains(propertyToMerge))
         {
             existingKey.Part.Add(propertyToMerge);
         }
     }
     foreach (PropertyPath propertyPathToMerge in keyToBeMergedInto.PropertyPaths())
     {
         if (existingKey.PropertyPaths().FirstOrDefault(pp => AreEqual(pp, propertyPathToMerge)) == null)
         {
             existingKey.PropertyPaths().Add(propertyPathToMerge);
         }
     }
 }