Esempio n. 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;
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 public bool IntersectWith(FrequencyGroup other)
 {
     return(MinFrequencyCoef >= other.MinFrequencyCoef && MinFrequencyCoef < other.MaxFrequencyCoef ||
            MaxFrequencyCoef > other.MinFrequencyCoef && MaxFrequencyCoef <= other.MaxFrequencyCoef);
 }