The cascading effect of enabling `RewindOnChange`.

ID: 979

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
// Rule 1: Replace 'A' with 'B'. Rewind is off by default.
t.FromTo("A", "B");
// Rule 2: Replace 'B' with 'C'.
t.FromTo("B", "C");

Console.WriteLine("--- Rewind Disabled ---");
// The 'A' becomes 'B', but the scan continues *after* the 'B', so rule 2 is not triggered.
Console.WriteLine(t.Transform("Start A End"));
t.Reset();

// Now, enable rewind on the first rule.
t.FromTo("A", "B").RewindOnChange = true;
t.FromTo("B", "C");

Console.WriteLine("");
Console.WriteLine("--- Rewind Enabled ---");
// The 'A' becomes 'B', rewind occurs, the 'B' is re-scanned and becomes 'C'.
Console.WriteLine(t.Transform("Start A End"));
				
			
--- Rewind Disabled ---
Start B End

--- Rewind Enabled ---
Start C End
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   // Rule 1: Replace 'A' with 'B'. Rewind is off by default.
   t.FromTo("A", "B");
   // Rule 2: Replace 'B' with 'C'.
   t.FromTo("B", "C");

   cout << "--- Rewind Disabled ---" << endl;
   // The 'A' becomes 'B', but the scan continues *after* the 'B', so rule 2 is not triggered.
   cout << t.Transform("Start A End") << endl;
   t.Reset();

   // Now, enable rewind on the first rule.
   t.FromTo("A", "B").RewindOnChange(true);
   t.FromTo("B", "C");

   cout << "" << endl;
   cout << "--- Rewind Enabled ---" << endl;
   // The 'A' becomes 'B', rewind occurs, the 'B' is re-scanned and becomes 'C'.
   cout << t.Transform("Start A End") << endl;
}
				
			
--- Rewind Disabled ---
Start B End

--- Rewind Enabled ---
Start C End
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      '// Rule 1: Replace 'A' with 'B'. Rewind is off by default.
      t.FromTo("A", "B")
      '// Rule 2: Replace 'B' with 'C'.
      t.FromTo("B", "C")
      
      Console.WriteLine("--- Rewind Disabled ---")
      '// The 'A' becomes 'B', but the scan continues *after* the 'B', so rule 2 is not triggered.
      Console.WriteLine(t.Transform("Start A End"))
      t.Reset()
      
      '// Now, enable rewind on the first rule.
      t.FromTo("A", "B").RewindOnChange = true
      t.FromTo("B", "C")
      
      Console.WriteLine("")
      Console.WriteLine("--- Rewind Enabled ---")
      '// The 'A' becomes 'B', rewind occurs, the 'B' is re-scanned and becomes 'C'.
      Console.WriteLine(t.Transform("Start A End"))
   End Sub
End Module
				
			
--- Rewind Disabled ---
Start B End

--- Rewind Enabled ---
Start C End