using System.Collections; using System.Collections.Generic; namespace Rokojori { public class ParentsIterator: TreeIterator where N:class { N iterator; N current; TreeWalker walker; public static ParentsIterator Create( TreeWalker walker, N start ) { var iterator = new ParentsIterator(); iterator.current = null; iterator.iterator = start; iterator.walker = walker; return iterator; } public override bool HasNext() { return walker.HasParent( iterator ); } public override N Current() { return current; } protected override void _MoveToNext() { iterator = walker.Parent( iterator ); current = iterator; } } }