public static void PreOrder <T, U>(Segment s0, Segment s1, ref T context, U inData, Visitor4 <T, U> visitor, int mask, ref HashSet <Segment> visited) { if (s1.Highway && (mask & HIGHWAYS_MASK) == 0 || !s1.Highway && (mask & STREETS_MASK) == 0) { return; } if (visited.Contains(s1)) { return; } visited.Add(s1); U outData; if (s1.Destinations.Count == 0) { if (!visitor(s1, null, ref context, inData, out outData)) { return; } } else { if (!visitor(s0, s1, ref context, inData, out outData)) { return; } foreach (var s2 in s1.Destinations) { PreOrder(s1, s2, ref context, outData, visitor, mask, ref visited); } } }
public static void PreOrder <T, U>(Segment s0, ref T context, U inData, Visitor4 <T, U> visitor, int mask, ref HashSet <Segment> visited) { PreOrder <T, U>(null, s0, ref context, inData, visitor, mask, ref visited); }