コード例 #1
0
 public TagGroup(Size size, FrequencyGroup frequencyGroup)
 {
     if (size.Width <= 0 || size.Height <= 0)
     {
         throw new ArgumentException($"Size can't be negative or zero");
     }
     Size           = size;
     FrequencyGroup = frequencyGroup;
 }
コード例 #2
0
ファイル: TagGroups.cs プロジェクト: Rozentor/tdd
        public void AddSizeGroup(string name, FrequencyGroup frequencyGroup, Size size)
        {
            if (Groups.ContainsKey(name))
            {
                throw new ArgumentException($"Group {name} already exist");
            }
            if (size.Width <= 0 || size.Height <= 0)
            {
                throw new ArgumentException($"Size can't be negative or zero");
            }
            foreach (var sizeGroup in Groups)
            {
                if (sizeGroup.Value.FrequencyGroup.IntersectWith(frequencyGroup))
                {
                    throw new ArgumentException($"Group {name} intersect with {sizeGroup.Value}");
                }
            }

            Groups.Add(name, new TagGroup(size, frequencyGroup));
        }
コード例 #3
0
ファイル: FrequencyGroup.cs プロジェクト: Rozentor/tdd
 public bool IntersectWith(FrequencyGroup other)
 {
     return(MinFrequencyCoef >= other.MinFrequencyCoef && MinFrequencyCoef < other.MaxFrequencyCoef ||
            MaxFrequencyCoef > other.MinFrequencyCoef && MaxFrequencyCoef <= other.MaxFrequencyCoef);
 }