Exemplo n.º 1
0
 /// <summary>
 /// Learn BaseTypes which are subset of this class.
 /// </summary>
 /// <param name="match">The BaseType match to learn BaseTypes from.</param>
 public void Learn(MatchBaseType match)
 {
     foreach (string str in match.Values)
     {
         if (!BaseTypes.Contains(str)) BaseTypes.Add(str);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Learn BaseTypes which are subset of this class.
 /// </summary>
 /// <param name="match">The BaseType match to learn BaseTypes from.</param>
 public void Learn(MatchBaseType match)
 {
     foreach (string str in match.Values)
     {
         if (!BaseTypes.Contains(str))
         {
             BaseTypes.Add(str);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Determines whether BaseType match is contained in this Class match based on learnt strings.
        /// </summary>
        /// <param name="match">The BaseType match.</param>
        /// <returns>true, if this Class match contains all strings of BaseType match; otherwise false.</returns>
        public bool Contains(MatchBaseType match)
        {
            // Find this Class strings defined in dictionary as whole or partially.
            foreach (string clazz in FindMatched(BaseTypesOfClass.Keys.ToArray()))
            {
                foreach (string baseType in match.Values)
                {
                    if (BaseTypesOfClass[clazz].Exists(bt => bt.Contains(baseType)))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Learn BaseTypes which are subset of this class.
 /// </summary>
 /// <param name="match">The BaseType match to learn BaseTypes from.</param>
 public void Learn(MatchBaseType match)
 {
     // First, to learn BaseType of Class relationship, this Class must have only one string defined.
     if (Values.Count == 1)
     {
         // If this Class has already learnt some BaseType(s), then add only new BaseType strings.
         if (BaseTypesOfClass.ContainsKey(Values[0]))
         {
             foreach (string str in match.Values)
             {
                 if (!BaseTypesOfClass[Values[0]].Contains(str))
                 {
                     BaseTypesOfClass[Values[0]].Add(str);
                 }
             }
         }
         else // Otherwise create new entry with copy of all BaseType strings.
         {
             BaseTypesOfClass.Add(Values[0], new List <string>(match.Values));
         }
     }
 }
Exemplo n.º 5
0
 protected MatchBaseType(MatchBaseType copy) : base(copy)
 {
 }
Exemplo n.º 6
0
 protected MatchBaseType(MatchBaseType copy) : base(copy) { }
Exemplo n.º 7
0
 protected MatchClass(MatchClass copy) : base(copy)
 {
     NarrowedBy = copy.NarrowedBy;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Narrows Class match by BaseType match within same rule.
        /// Also invokes Learn.
        /// </summary>
        /// <param name="match"></param>
        public void NarrowBy(MatchBaseType match)
        {
            NarrowedBy = match;

            Learn(match);
        }