Example #1
0
        public static bool updatetreeviaFeture(string path)
        {
            string[] feature_arr = FileProcess.readFeature(path);
            string[] text        = File.ReadAllLines("txtfolder\\model_subtree.txt");
            string   parent_child;

            string[] childs_arr;
            int      c    = 0;
            bool     flag = true;

            for (int i = 0; i < text.Length; i++)
            {
                parent_child = text[i].Split(':').ElementAt(0);
                childs_arr   = text[i].Split(':').ElementAt(1).Split(',');
                string chilstr = "";
                for (int j = c; j < feature_arr.Length; j++)
                {
                    if ((parent_child == feature_arr[j].Split(',').ElementAt(0)) && (feature_arr[j].Split(',').ElementAt(1) == "0"))
                    {
                        parent_child = "";
                        c            = j;
                        break;
                    }
                    else if ((parent_child == feature_arr[j].Split(',').ElementAt(0)) && (feature_arr[j].Split(',').ElementAt(1) == "1"))
                    {
                        for (int k = 0; k < childs_arr.Length; k++)
                        {
                            for (int l = j; l < feature_arr.Length; l++)
                            {
                                if ((childs_arr[k] == feature_arr[l].Split(',').ElementAt(0) && (feature_arr[l].Split(',').ElementAt(1) == "0")))
                                {
                                    childs_arr[k] = "null";
                                    c             = j;
                                    break;
                                }
                                else if ((childs_arr[k] == feature_arr[l].Split(',').ElementAt(0) && (feature_arr[l].Split(',').ElementAt(1) == "1")))
                                {
                                    chilstr = chilstr + childs_arr[k] + ",";
                                }
                                else
                                {
                                    flag = false;
                                }
                            }
                        }
                        c = j;
                        break;
                    }
                    else
                    {
                        flag = false;
                    }
                }
                if (parent_child != "")
                {
                    CreateLogFile(parent_child + ":" + chilstr.TrimEnd(',') + "\n");
                }
            }
            return(flag);
        }
Example #2
0
        public static bool consistenceCheck(string path)
        {
            bool flag = true;

            string[] feature_arr = FileProcess.readFeature(path);
            string   text        = File.ReadAllText("txtfolder\\model_subtree.txt").ToLower();

            for (int i = 0; i < feature_arr.Length; i++)
            {
                if (!(text.Contains(feature_arr[i].Split(',').ElementAt(0).ToLower())))
                {
                    flag = false;
                    break;
                }
            }

            return(flag);
        }
Example #3
0
        public void eskifonk_calculatenewfeature_btn_Click()
        {
            string[]         feature_arr      = FileProcess.readFeature(openfeaturemodel_tb.Text);
            List <ModelTree> updatedModelTree = new List <ModelTree>(ModelUpdate.CreateModelTree());

            foreach (ModelTree item in ModelUpdate.CreateModelTree())
            {
                for (int i = 0; i < feature_arr.Length; i++)
                {
                    if ((item.parent == feature_arr[i].Split(',').ElementAt(0)) && (feature_arr[i].Split(',').ElementAt(1) == "1"))
                    {
                        foreach (string child in item.childs)
                        {
                            for (int j = i; j < feature_arr.Length; j++)
                            {
                                if (child == feature_arr[j].Split(',').ElementAt(0) && (feature_arr[j].Split(',').ElementAt(1) == "0"))
                                {
                                    List <string> childs_list = new List <string>(item.childs);
                                    childs_list.Remove(child);
                                    item.childs     = childs_list.ToArray();
                                    item.childvalue = 1 / item.childs.Length;
                                    //numbers.RemoveAt(numbers.IndexOf(4));
                                }
                            }
                        }
                    }
                    else if ((item.parent == feature_arr[i].Split(',').ElementAt(0)) && (feature_arr[i].Split(',').ElementAt(1) == "0"))
                    {
                        updatedModelTree.Remove(item);
                    }
                }
            }
            updatedModelTree = ModelUpdate.CreateModelTree();
            foreach (ModelTree item in updatedModelTree)
            {
                modeltreeshow_rtb.AppendText(item.parent.ToString().ToUpper() + "\n");
                foreach (var child in item.childs)
                {
                    modeltreeshow_rtb.AppendText("  --" + child.ToString().ToUpper() + " =>  child_value: " + item.childvalue.ToString() + "\n");
                }
            }
        }
Example #4
0
 private void chkfeaturetree_bttn_Click(object sender, EventArgs e)
 {
     if (openfeaturemodel_tb.Text == "")
     {
         MessageBox.Show("Please Select feature Model!");
     }
     else
     {
         int a = 1;
         feature_list_rtb.Clear();
         foreach (string item in FileProcess.readFeature(openfeaturemodel_tb.Text))
         {
             feature_list_rtb.AppendText(a + ". feature -> " + item + "\n");
             a++;
         }
         //status_rtb.Clear();
         status_rtb.AppendText("*** Feature tree imported ***\n");
     }
     info_pnl.Visible = true;
 }