Ejemplo n.º 1
0
        public AffinityTable(AffinityMatrix m, string name, DbTable t)
        {
            List <string> opts = T.TakeTokens(ref name);

            foreach (string opt in opts)
            {
                if (opt.IsInteger())
                {
                    weight = Convert.ToInt32(opt);
                }
                else if (opt == "*")
                {
                    allowPartialMatch = true;
                }
                else if (opt == "#")
                {
                    requiredNumeric = true;
                }
                else if (opt.StartsWith("[") && opt.EndsWith("]"))
                {
                    requiredType = QObject.GetTypeFromName(opt.Substring(1, opt.Length - 2));
                }
            }

            affinityTableName = name;
            matrix            = m;
            table             = t;
        }
Ejemplo n.º 2
0
 public void AddWords(IEnumerable <string> words)
 {
     foreach (string s in words)
     {
         string          value = s;
         List <string>   opts  = T.TakeTokens(ref value);
         AffinityKeyword k     = new AffinityKeyword(value);
         foreach (string opt in opts)
         {
             if (opt.IsInteger())
             {
                 k.weight = Convert.ToInt32(opt);
             }
             else if (opt == "*")
             {
                 k.allowPartialMatch = true;
             }
             else
             {
                 k.requiredType = QObject.GetTypeFromName(opt);
             }
         }
         keywords.Add(keywords.Count(), k);
     }
 }
Ejemplo n.º 3
0
 public AffinityKeyword(string w)
 {
     if (w.StartsWith("[") && w.EndsWith("]"))
     {
         w            = w.Substring(1, w.Length - 2);
         isType       = true;
         requiredType = QObject.GetTypeFromName(w);
     }
     word = w;
     T.Assert(word.ToLower() == word);
 }