Пример #1
0
        public RegionMap AddRegion(RegionType type, InstructionRange range)
        {
            if (Range.Equals(range))
            {
                if (Type != type)
                {
                    throw new NotSupportedException("Multipurpose regions!");
                }
                return(this);
            }
            if (!Range.IsContained(range))
            {
                throw new ArgumentException("Cannot create sub regionMap with a subregion not contained");
            }
            foreach (RegionMap sregion in ChildRegions)
            {
                if (sregion.Range.IsContained(range))
                {
                    return(sregion.AddRegion(type, range));
                }
            }

            RegionMap newRegionMap = new RegionMap(type, range);

            ChildRegions.Add(newRegionMap);
            return(newRegionMap);
        }
Пример #2
0
 /// <summary>
 /// Adds the child region.
 /// </summary>
 /// <param name="region">The region.</param>
 public void AddChildRegion(Region region)
 {
     ChildRegions.Add(region);
     Priority = 1000 / ChildRegions.Count;
 }