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); }
public RegionMap(RegionType type, InstructionRange range) { Type = type; Range = range; AssociatedRegions = new List <RegionMap>(); ChildRegions = new List <RegionMap>(); }