private void ReduceInto(List <Ring> res) { Ring resRing = ring; // while sorting here is a decent solution, // it is not complete, and it can be fooled. foreach (var child in ChildRingSorter.Sort(this)) { resRing = JoinRings(resRing, child.ring); child.ReduceChildrenInto(res); } res.Add(resRing); }
// ------------------------------------ // Reduce to simple rings recursively // ------------------------------------ public List <Ring> Reduce() { List <Ring> res = new List <Ring>(); Ring resRing = ring; // while sorting here is a decent solution, // it is not complete, and it can be fooled. foreach (var child in ChildRingSorter.Sort(this)) { resRing = JoinRings(resRing, child.ring); child.ReduceChildrenInto(res); } res.Add(resRing); return(res); }