public AreaInstance Visit(AreaInstance area, IEnumerable <int> path) { if (area.Path.IsEquivalentTo(path)) { return(area); } return(area.Components.Select(c => c.Accept(this, path)).FirstOrDefault(a => a != null)); }
public ComponentInstance Visit(AreaInstance area, IEnumerable <int> path) { if (!path.Any()) { return(area); } if (area.Components.Count() < path.First()) { throw new KolaException("No component at specified path"); } return(area.Components.ElementAt(path.First()).Accept(this, path.Skip(1))); }