public static CutPattern Clone(this CutPattern original)
        {
            var clone = new CutPattern();

            foreach (var m in original.Measurements)
            {
                clone.Measurements.Add(m);
            }
            return(clone);
        }
        public static bool ContainsPattern(this List <CutPattern> list, CutPattern cutPattern)
        {
            foreach (var thisPattern in list.Where(e => e.Measurements.Count == cutPattern.Measurements.Count).ToList())
            {
                if (thisPattern.Measurements.All(m => cutPattern.Measurements.Contains(m)) && cutPattern.Measurements.All(s => thisPattern.Measurements.Contains(s)))
                {
                    var thisPatternDict = new Dictionary <decimal, int>();
                    var patternDict     = new Dictionary <decimal, int>();
                    for (int i = 0; i < thisPattern.Measurements.Count; i++)
                    {
                        if (!thisPatternDict.ContainsKey(thisPattern.Measurements[i]))
                        {
                            thisPatternDict.Add(thisPattern.Measurements[i], 1);
                        }
                        else
                        {
                            thisPatternDict[thisPattern.Measurements[i]]++;
                        }

                        if (!patternDict.ContainsKey(cutPattern.Measurements[i]))
                        {
                            patternDict.Add(cutPattern.Measurements[i], 1);
                        }
                        else
                        {
                            patternDict[cutPattern.Measurements[i]]++;
                        }
                    }
                    var result = false;
                    foreach (var dict in thisPatternDict)
                    {
                        if (patternDict.ContainsKey(dict.Key))
                        {
                            if (dict.Value != patternDict[dict.Key])
                            {
                                result = false;
                                break;
                            }
                        }
                        result = true;
                    }
                    if (result)
                    {
                        return(result);
                    }
                }
            }
            return(false);
        }
 public void SetPattern(CutPattern pattern)
 {
     _cutPattern = pattern;
 }