Exemple #1
0
 /// <summary>
 /// Find a node, under and including this node, statisfy special feature.
 /// </summary>
 /// <param name="feature">Unit feature.</param>
 /// <returns>Cart node most closing to the feature.</returns>
 public CartNode Test(TtsUnitFeature feature)
 {            
     if (LeftChild != null)
     {
         System.Diagnostics.Debug.Assert(RightChild != null);
         bool passed = this.Question.Test(feature);
         if (passed)
         {
             return LeftChild.Test(feature);
         }
         else
         {
             return RightChild.Test(feature);
         }
     }
     else
     {
         System.Diagnostics.Debug.Assert(RightChild == null);
         return this;
     }
 }
Exemple #2
0
 /// <summary>
 /// Search all node in this tree for which node that satisfies the special feature.
 /// </summary>
 /// <param name="feature">Unit feature.</param>
 /// <returns>Cart node most closing to the feature.</returns>
 public CartNode Test(TtsUnitFeature feature)
 {
     return Root.Test(feature);
 }
Exemple #3
0
 /// <summary>
 /// Verify on a special feature whether feature is satisfy with this question.
 /// </summary>
 /// <param name="featureId">Feature id.</param>
 /// <param name="feature">Feature.</param>
 /// <returns>True if this logic satisfies the feature, otherwise false.</returns>
 public bool TestFeature(int featureId, TtsUnitFeature feature)
 {
     return MetaCart.Features[featureId].Test(feature);
 }
Exemple #4
0
        /// <summary>
        /// Verify whether feature is satisfy with this question.
        /// </summary>
        /// <param name="feature">Feature.</param>
        /// <returns>True if the feature satisfies this question , otherwise false.</returns>
        public bool Test(TtsUnitFeature feature)
        {
            foreach (AndOperator andop in _andOperators)
            {
                if (andop.Test(feature))
                {
                    return true;
                }
            }

            return false;
        }
Exemple #5
0
        /// <summary>
        /// Verify whether feature is satisfy with this question.
        /// </summary>
        /// <param name="feature">Feature.</param>
        /// <returns>True if the feature satisfies this logic, otherwise false.</returns>
        public bool Test(TtsUnitFeature feature)
        {
            foreach (NotOperator nop in NotOperators)
            {
                bool fpass = TestFeature(nop.FeatureId, feature);
                if ((!fpass && !nop.IsNot) || (fpass && nop.IsNot))
                {
                    return false;
                }
            }

            return true;
        }