コード例 #1
0
        /// <summary>
        ///   Retrieves the index of the next rule set.A helper function to RecognizeChooseApplyCycle.
        ///   This function returns what the new ruleSet will be. Here the enumerator nextGenerationSteps
        ///   and GenerationStatuses is used to great affect. Understand that if a negative number is
        ///   returned, the cycle will be stopped.
        /// </summary>
        /// <param name = "status">The status.</param>
        /// <returns></returns>
        public int nextRuleSet(GenerationStatuses status)
        {
            switch (nextGenerationStep[(int)status])
            {
            case nextGenerationSteps.Loop:
                return(RuleSetIndex);

            case nextGenerationSteps.GoToNext:
                return(RuleSetIndex + 1);

            case nextGenerationSteps.GoToPrevious:
                return(RuleSetIndex - 1);

            default:
                return((int)nextGenerationStep[(int)status]);
            }
        }
コード例 #2
0
        /// <summary>
        /// This function returns what the new ruleSet
        /// will be. Here the enumerator nextGenerationSteps and GenerationStatuses is used to great
        /// affect. Understand that if a negative number is returned, the cycle will be stopped.
        /// </summary>
        /// <param name="RuleSets">The rule sets.</param>
        /// <param name="ruleSetIndex">Index of the rule set.</param>
        /// <param name="status">The status.</param>
        /// <returns></returns>
        public static int NextRuleSet(ruleSet[] RuleSets, int ruleSetIndex, GenerationStatuses status)
        {
            switch (RuleSets[ruleSetIndex].nextGenerationStep[(int)status])
            {
            case nextGenerationSteps.Loop:
                return(ruleSetIndex);

            case nextGenerationSteps.GoToNext:
                return(++ruleSetIndex);

            case nextGenerationSteps.GoToPrevious:
                return(--ruleSetIndex);

            default:
                return((int)RuleSets[ruleSetIndex].nextGenerationStep[(int)status]);
            }
        }
コード例 #3
0
 /* A helper function to RecognizeChooseApplyCycle. This function returns what the new ruleSet
  * will be. Here the enumerator nextGenerationSteps and GenerationStatuses is used to great
  * affect. Understand that if a negative number is returned, the cycle will be stopped. */
 private int nextRuleSet(int ruleSetIndex, GenerationStatuses status)
 {
     if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.Loop)
     {
         return(ruleSetIndex);
     }
     else if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.GoToNext)
     {
         return(++ruleSetIndex);
     }
     else if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.GoToPrevious)
     {
         return(--ruleSetIndex);
     }
     else
     {
         return((int)rulesets[ruleSetIndex].nextGenerationStep[(int)status]);
     }
 }
コード例 #4
0
 /// <summary>
 ///   This function returns what the new ruleSet
 ///   will be. Here the enumerator nextGenerationSteps and GenerationStatuses is used to great
 ///   affect. Understand that if a negative number is returned, the cycle will be stopped.
 /// </summary>
 /// <param name="ruleSetIndex">Index of the rule set.</param>
 /// <param name="status">The status.</param>
 /// <returns></returns>
 protected int nextRuleSet(int ruleSetIndex, GenerationStatuses status)
 {
     return(NextRuleSet(rulesets, ruleSetIndex, status));
 }
コード例 #5
0
 /* A helper function to RecognizeChooseApplyCycle. This function returns what the new ruleSet
  * will be. Here the enumerator nextGenerationSteps and GenerationStatuses is used to great
  * affect. Understand that if a negative number is returned, the cycle will be stopped. */
 private int nextRuleSet(int ruleSetIndex, GenerationStatuses status)
 {
     if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.Loop)
         return ruleSetIndex;
     else if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.GoToNext)
         return ++ruleSetIndex;
     else if (rulesets[ruleSetIndex].nextGenerationStep[(int)status] == nextGenerationSteps.GoToPrevious)
         return --ruleSetIndex;
     else
         return (int)rulesets[ruleSetIndex].nextGenerationStep[(int)status];
 }