Exemplo n.º 1
0
 /// <summary>
 /// Create a child Navigator of the given parent.
 /// </summary>
 public Navigator(Navigator parent)
 {
     ValidateParentIsNonTerminating(parent);
     destinationParts = parent.DestinationParts;
     destinationPartIndex = parent.DestinationPartIndex + 1;
     context = parent.Context.GetImmediateSimulatableRelative(destinationParts[destinationPartIndex]);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Get the simulatable relative, immediate or distant, using the given navigator.
 /// May return null if the relative is not found.
 /// </summary>
 public Simulatable GetSimulatableRelative(Navigator navigator)
 {
     return
         navigator.IsTerminating ?
         navigator.Context :
         navigator.Context.GetSimulatableRelative(new Navigator(navigator));
 }
Exemplo n.º 3
0
 private static void ValidateParentIsNonTerminating(Navigator parent)
 {
     if (parent.IsTerminating)
         throw new ArgumentException("Cannot make a child from a terminating navigator.");
 }