/// <summary> /// Creates a tree from the given chunks using the 'MaximallyPacked' algorithm. /// </summary> /// <returns> /// The root of the tree. /// </returns> public static DedupNode Create( IEnumerable <ChunkInfo> chunks) { DedupNode root; root = PackedDedupNodeTree.EnumerateTree(chunks).Last(); return(root); }
/// <summary> /// Creates a tree from the given chunks using the given algorithm. /// </summary> /// <returns> /// The root of the tree. /// </returns> public static DedupNode Create( IEnumerable <ChunkInfo> chunks, Algorithm algorithm) { DedupNode root; switch (algorithm) { case Algorithm.MaximallyPacked: root = PackedDedupNodeTree.EnumerateTree(chunks).Last(); break; case Algorithm.RollingHash: root = CreateRollingHashTree(chunks.Select(c => new DedupNode(c)).ToList()); break; default: throw new ArgumentException($"Unknown Algorithm: {algorithm}", nameof(algorithm)); } return(root); }