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 void Embark(TransformationNode node) { core.Embark(node); // note directly manipulate the RawValue because we are *NOT* targeting thread safety backlogCount.RawValue++; rateOfEmbark.RawValue++; }