Ejemplo n.º 1
0
 //VeryfiedClassInfo[] ch_classes=null)
 //public VeryfiedClassInfo[] checked_classes;
 public TreeNode(TreeNode l_child = null, TreeNode r_child =null, Rule new_rule = null, bool isleaf = false)
 {
     left_child = l_child;
     right_child = r_child;
     rule = new_rule;
     is_leaf = isleaf;
     //checked_classes = ch_classes;
 }
Ejemplo n.º 2
0
        public Rule GetRuleWithRequest(String req)
        {
            Rule res = null;
            SQLiteCommand cmd = new SQLiteCommand(conn);
            cmd.Transaction = trans;
            cmd.CommandText = req;
            try
            {
                SQLiteDataReader r = cmd.ExecuteReader();
                string line = String.Empty;
                res = new Rule();
                while (r.Read())
                {

                    res.index_of_param = int.Parse(string.Format("{0}", r["PARAM_INDEX"]));
                    res.value = r["VALUE"].ToString();
                }
                r.Close();
            }
            catch (SQLiteException ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
            return res;
        }
Ejemplo n.º 3
0
 private void SaveRuleToDB(Rule rule)
 {
     String sqlReqStr = "INSERT INTO RULE (PARAM_INDEX, VALUE) " +
         "VALUES('" + rule.index_of_param + "','" + rule.value + "');";
     int state = sqlManager.SendInsertRequest(sqlReqStr);
     if (state == 0)
         Console.WriteLine("error");
 }
Ejemplo n.º 4
0
 public void SplitEducationTable(EducationTable education_table,Rule split_rule,Parametr param, ref EducationTable left_table, ref EducationTable right_table)
 {
     if ((param.Type == TypeParametr.Real) || (param.Type == TypeParametr.Int))
     {
         for (int i = 0; i < education_table.Rows.Count; i++)
         {
             double curVal = Convert.ToDouble(education_table.Rows.ElementAt(i)[split_rule.index_of_param].Value, UsCulture);
             double splitVal = Convert.ToDouble(split_rule.value, UsCulture);
             if (curVal <= splitVal)
             {
                 right_table.Rows.Add(education_table.Rows.ElementAt(i));
             }
             else
             {
                 left_table.Rows.Add(education_table.Rows.ElementAt(i));
             }
         }
         right_table.ParameterCount = education_table.ParameterCount;
         left_table.ParameterCount = education_table.ParameterCount;
     }
     else
     {
         for (int i = 0; i < education_table.Rows.Count; i++)
         {
             String curVal = education_table.Rows.ElementAt(i)[split_rule.index_of_param].Value;
             String splitVal = split_rule.value;
             if (curVal == splitVal)
             {
                 right_table.Rows.Add(education_table.Rows.ElementAt(i));
             }
             else
             {
                 left_table.Rows.Add(education_table.Rows.ElementAt(i));
             }
         }
         right_table.ParameterCount = education_table.ParameterCount;
         left_table.ParameterCount = education_table.ParameterCount;
     }
 }