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); }
/// <summary> /// Adds the child region. /// </summary> /// <param name="region">The region.</param> public void AddChildRegion(Region region) { ChildRegions.Add(region); Priority = 1000 / ChildRegions.Count; }