public void ProcessPart(FramePart partToProcess) { Console.WriteLine($"Processing part {partToProcess.Name}"); foreach (var joiningPart in partToProcess.JoiningParts) { var cuttingStrategy = partToProcess.SelectCornerCuttingStrategy(joiningPart); Console.Write($"\tProcessing join with {joiningPart.Name}: "); cuttingStrategy.Execute(); } }
public static void Join(FramePart part1, FramePart part2) { part1.JoiningParts.Add(part2); part2.JoiningParts.Add(part1); }
public ICornerCuttingStrategy SelectCornerCuttingStrategy(FramePart otherPart) => this.CuttingStrategy.Priority > otherPart.CuttingStrategy.Priority ? this.CuttingStrategy : otherPart.CuttingStrategy;