private void ParseSetupMap(string line, string[] tokens) { switch (tokens[1]) { case "super_regions": this.Map.Setup(SetupSuperRegionsInstruction.Detokenize(tokens)); break; case "regions": this.Map.Setup(SetupRegionsInstruction.Detokenize(tokens)); break; case "neighbors": this.Map.Setup(SetupNeighborInstruction.Detokenize(tokens)); break; } }
/// <summary>Handles the setup instruction.</summary> public void Setup(SetupNeighborInstruction instruction) { Guard.NotNull(instruction, "instruction"); foreach (var info in instruction.Neighbors) { var region = this[info.Id]; foreach (var nId in info.Neighbors) { var neighbor = this[nId]; region.AddNeighbor(neighbor); } } }