using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace ln.types.odb.ng.index { public class Path { public String Element { get; } public Path Next { get; } public Path Parent { get; } private Path(Path parent,IEnumerator path) { Parent = parent; if (path.MoveNext()) { Element = path.Current; Next = new Path(this,path); } else { Element = null; Next = null; } } public Path(String[] path) :this(null,((IEnumerable)path).GetEnumerator()) { } public string Complete { get { List path = new List(); Climb(path); StringBuilder sb = new StringBuilder(); sb.Append(path[0]); path.RemoveAt(0); foreach (String pe in path) { if (!pe.Equals("[]")) sb.Append('_'); sb.Append(pe); } return sb.ToString(); } } private void Climb(List path) { if (Parent != null) Parent.Climb(path); if (Element != null) path.Add(Element); } } }