/// <summary>
 /// Merges the <paramref name="other"/> hierarchy into this hierarchy.
 /// </summary>
 /// <remarks>
 /// This method does not check whether the two hierarchies have independent parts and will fail otherwise.
 /// </remarks>
 /// <typeparam name="TAssetPartDesign">The type used for the design information of a part.</typeparam>
 /// <typeparam name="TAssetPart">The type used for the actual parts,</typeparam>
 /// <param name="asset">This hierarchy.</param>
 /// <param name="other">The other hierarchy which parts will added to this hierarchy.</param>
 public static void MergeInto <TAssetPartDesign, TAssetPart>([NotNull] this AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> asset,
                                                             [NotNull] AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> other)
     where TAssetPartDesign : class, IAssetPartDesign <TAssetPart>
     where TAssetPart : class, IIdentifiable
 {
     if (asset == null)
     {
         throw new ArgumentNullException(nameof(asset));
     }
     asset.RootParts.AddRange(other.RootParts);
     foreach (var part in other.Parts)
     {
         asset.Parts.Add(part.Value);
     }
 }
Example #2
0
 public IEnumerable <TAssetPartDesign> EnumerateChildPartDesigns([NotNull] TAssetPartDesign partDesign, AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> hierarchyData, bool isRecursive)
 {
     return(EnumerateChildParts(partDesign.Part, isRecursive).Select(e => hierarchyData.Parts[e.Id]));
 }
 public static IEnumerable <TAssetPartDesign> EnumerateRootPartDesigns <TAssetPartDesign, TAssetPart>([NotNull] this AssetCompositeHierarchyData <TAssetPartDesign, TAssetPart> asset)
     where TAssetPartDesign : class, IAssetPartDesign <TAssetPart>
     where TAssetPart : class, IIdentifiable
 {
     if (asset == null)
     {
         throw new ArgumentNullException(nameof(asset));
     }
     return(asset.RootParts.Select(x => asset.Parts[x.Id]));
 }