public static RawNode GetRawNode(IContext context, string path, IRandom random) { var parts = GetParts(path); RawNode current = context.repositoryNode; for (int i = 0; i < parts.Count; i++) { current = current.GetNode(parts[i][0]); if (SelectPathUtil.IsSimple(parts[i][1])) { current = current.GetNode(parts[i][1]); } else { var allKeys = new List <string>(); allKeys.AddRange(current.GetSortedKeys()); var affectedKeys = SelectPathUtil.GetAffectedKeys(parts[i][1], allKeys); if (affectedKeys.Count == 0) { return(null); } var selectedKey = affectedKeys[random.Range(0, affectedKeys.Count)]; current = current.GetNode(selectedKey); } } return(current); }