public string[] Transform(string from, string to) { if (string.IsNullOrEmpty(from)) { throw new ArgumentNullException(nameof(from)); } if (string.IsNullOrEmpty(to)) { throw new ArgumentNullException(nameof(to)); } // CONSIDER: for cleanliness, maybe ITransformationTraversal needs a "clear/reset" action traversal.Embark(nodeFactory.CreateNode(from)); do { var node = traversal.Disembark(); if (node.Word == to) { // hit goal return(GetRouteTo(node)); } ModulateAndTraverse(node); } while (!traversal.IsEmpty); // transform not possible return(new string[0]); }
public TransformationNode Disembark() { var node = core.Disembark(); backlogCount.RawValue--; rateOfDisembark.RawValue++; return(node); }