Exemplo n.º 1
0
 void PreorderLeaves(IState stateNode, FAName sn)
 {
     if (sn != null)
     {
         IPairState pstate = stateNode as IPairState;
         if (pstate != null)
         {
             PreorderLeaves(pstate.First, sn.left);
             PreorderLeaves(pstate.Second, sn.right);
         }
         else
         {
             string modelName = sn.ToString();
             leafStates.Add(stateNode);
             modelNames.Add(modelName);
         }
     }
 }
Exemplo n.º 2
0
            /// <summary>
            /// Create a post-order traversal of the leaves and
            /// create the composed name that reflects the structure of the tree,
            /// disambiguate multiple occurrences of the same model name
            /// </summary>
            void PreorderLeaves(IState stateNode, StringBuilder sb)
            {
                IPairState pstate = stateNode as IPairState;

                if (pstate != null)
                {
                    sb.Append("(");
                    PreorderLeaves(pstate.First, sb);
                    sb.Append(" x ");
                    PreorderLeaves(pstate.Second, sb);
                    sb.Append(")");
                }
                else
                {
                    string modelName = GetModelName(stateNode);
                    leafStates.Add(stateNode);
                    modelNames.Add(modelName);
                    sb.Append(modelName);
                }
            }