コード例 #1
0
        bool isMatchGrRule(SType stype, ElmAttSet.Group gr, Rule.Rule rule)
        {
            if (rule == null || !fps.ContainsKey(stype))
            {
                return(true);
            }
            var    ruleSyns  = rule.synonyms;
            string comMatPrf = fps[stype].pars[0].par.ToString();
            string grMatPrf  = stype == SType.Material ? gr.mat : gr.prf;

            if (grMatPrf == comMatPrf)
            {
                return(true);
            }
            if (ruleSyns != null && ruleSyns.ContainsKey(stype))
            {
                List <string> Syns = ruleSyns[stype].ToList();
                if (!Lib.IContains(Syns, comMatPrf) || !Lib.IContains(Syns, grMatPrf))
                {
                    return(false);
                }

                string c = strExclude(comMatPrf, Syns);
                string g = strExclude(grMatPrf, Syns);
//27/3                if(c == g) return true;
                return(c.Contains(g));

                ////////////////var p1 = Params(Syns, comMatPrf, );
                //// 27/3 //////var p2 = Params(Syns, grMatPrf);
                ////////////////bool b = p1 != p2  && stype == SType.Material;

                return(Params(Syns, comMatPrf) == Params(Syns, grMatPrf));
            }
            return(false);
        }
コード例 #2
0
ファイル: Components.cs プロジェクト: PavelKhrapkin/TSmatch
        bool isMatchGrRule(SType stype, ElmAttSet.Group gr, Rule.Rule rule)
        {
            if (rule == null || !compDP.dpar.ContainsKey(stype))
            {
                return(true);
            }
            var    ruleSyns  = rule.synonyms;
            string comMatPrf = viewComp_(stype);
            string grMatPrf  = stype == SType.Material ? gr.mat : gr.prf;

            if (grMatPrf.Contains("ш2") && comMatPrf.Contains("ш2"))
            {
                log.Info("--");                                                       //5/4
            }
            if (ruleSyns != null && ruleSyns.ContainsKey(stype))
            {
                List <string> Syns = ruleSyns[stype].ToList();
                if (!Lib.IContains(Syns, comMatPrf) || !Lib.IContains(Syns, grMatPrf))
                {
                    return(false);
                }
                string c = strExclude(comMatPrf, Syns);
                string g = strExclude(grMatPrf, Syns);
                if (c == g)
                {
                    return(true);
                }
                return(c.Contains(g));
                ////////////////var p1 = Params(Syns, comMatPrf, );
                //// 27/3 //////var p2 = Params(Syns, grMatPrf);
                ////////////////bool b = p1 != p2  && stype == SType.Material;
                //31/3//////////return Params(Syns, comMatPrf) == Params(Syns, grMatPrf);
            }
            return(comMatPrf == grMatPrf);
        }
コード例 #3
0
        bool isMatchGrRule(SType stype, Group.Group gr, Rule.Rule rule)
        {
            if (rule == null || !compDP.dpar.ContainsKey(stype))
            {
                return(true);
            }
            string sb = new Sec(rule.text, stype).body;

            if (sb == "")
            {
                return(true);
            }
            var    ruleSyns  = rule.synonyms;
            string comMatPrf = viewComp_(stype);
            string grMatPrf  = stype == SType.Material ? gr.mat : gr.prf;

            if (ruleSyns != null && ruleSyns.ContainsKey(stype))
            {
                List <string> Syns = ruleSyns[stype].ToList();
                if (!Lib.IContains(Syns, comMatPrf) || !Lib.IContains(Syns, grMatPrf))
                {
                    return(false);
                }
                string c = strExclude(comMatPrf, Syns);
                string g = strExclude(grMatPrf, Syns);
                if (c == g)
                {
                    return(true);
                }
                string pattern = new Sec(rule.text, stype).body.Replace("=", "");
                foreach (var s in Syns)
                {
                    pattern = strExclude(pattern, Syns);
                }
                return(isOK(pattern, c, g));
            }
            return(comMatPrf == grMatPrf);
        }