コード例 #1
0
        // For zone by zone information (conditionals as columns)
        public string FillCollection1(DiscreteCondDistribution currColl)
        {
            string strTok = FileReader.ReadLine();
            if (strTok != null)
            {
                string[] strColl = strTok.Split(',');
                for (int i = 0; i < ConditionalNames.Count; i++)
                {
                    string currCond = (string) ConditionalNames[i];
                    string[] currDimVal = currCond.Split(
                        Utils.Constants.CATEGORY_DELIMITER[0]);

                    currColl.AddValue(currDimVal[0], currDimVal[1],
                                        uint.Parse(strColl[i+1]));
                }
                return strColl[0];
            }
            return "";
        }
コード例 #2
0
        // For 1 values for all zones (conditionals as rows)
        public void FillCollection2(DiscreteCondDistribution currColl)
        {
            string strTok = FileReader.ReadLine();
            while ((strTok = FileReader.ReadLine()) != null)
            {
                string[] strToken = strTok.Split(',');
                int j = strToken[0].IndexOf(
                        Utils.Constants.CATEGORY_DELIMITER);
                string catName = strToken[0].Substring(0, j);
                string condName = strToken[0].Substring(j + 1,
                         strToken[0].Length - (catName.Length + 1));

                /*string[] strToken = strTok.Split(',');
                //int j =  strToken[0].IndexOf(
                //        Utils.Constants.CATEGORY_DELIMITER);
                string catName = strTok.Substring(0,1);
                string condName = strTok.Substring(2, strTok.LastIndexOf(',')-2);*/

                currColl.AddValue(catName, condName,
                        double.Parse(strToken[1]));
            }
        }