コード例 #1
0
ファイル: BTValues.cs プロジェクト: DragonXYZ/cilpe
        private static Creators pseudoMerge(ReferenceBTValue val1, ReferenceBTValue val2, BTValuePairs pairs)
        {
            val1 = val1.findLeaf();
            val2 = val2.findLeaf();
            bool flag = pairs[val1, val2];

            if (! flag && val1 != val2 && val1.btType == BTType.Static && val2.btType == BTType.Static)
            {
                Creators crtrs = new Creators();

                int count = 0;
                for (int i = 0; i < val1.types.Count; i++)
                    if (val2.types.Contains(val1.types[i]))
                        count++;

                if (val1.types.Count > count)
                    crtrs.AddCreators(val2.crtrs);
                if (val2.types.Count > count)
                    crtrs.AddCreators(val1.crtrs);

                foreach (object key in val2.flds.Keys)
                {
                    ReferenceBTValue fld1 = val1.flds[key] as ReferenceBTValue;
                    ReferenceBTValue fld2 = val2.flds[key] as ReferenceBTValue;
                    if (fld1 != null)
                        crtrs.AddCreators(ReferenceBTValue.pseudoMerge(fld1, fld2, pairs));
                }

                return crtrs;
            }
            else if (flag || val1.btType == val2.btType)
                return new Creators();
            else if (val1.btType == BTType.Static)
                return val1.crtrs;
            else if (val2.btType == BTType.Static)
                return val2.crtrs;
            else
                throw new InternalException();
        }
コード例 #2
0
        private static Creators pseudoMerge(ReferenceBTValue val1, ReferenceBTValue val2, BTValuePairs pairs)
        {
            val1 = val1.findLeaf();
            val2 = val2.findLeaf();
            bool flag = pairs[val1, val2];

            if (!flag && val1 != val2 && val1.btType == BTType.Static && val2.btType == BTType.Static)
            {
                Creators crtrs = new Creators();

                int count = 0;
                for (int i = 0; i < val1.types.Count; i++)
                {
                    if (val2.types.Contains(val1.types[i]))
                    {
                        count++;
                    }
                }

                if (val1.types.Count > count)
                {
                    crtrs.AddCreators(val2.crtrs);
                }
                if (val2.types.Count > count)
                {
                    crtrs.AddCreators(val1.crtrs);
                }

                foreach (object key in val2.flds.Keys)
                {
                    ReferenceBTValue fld1 = val1.flds[key] as ReferenceBTValue;
                    ReferenceBTValue fld2 = val2.flds[key] as ReferenceBTValue;
                    if (fld1 != null)
                    {
                        crtrs.AddCreators(ReferenceBTValue.pseudoMerge(fld1, fld2, pairs));
                    }
                }

                return(crtrs);
            }
            else if (flag || val1.btType == val2.btType)
            {
                return(new Creators());
            }
            else if (val1.btType == BTType.Static)
            {
                return(val1.crtrs);
            }
            else if (val2.btType == BTType.Static)
            {
                return(val2.crtrs);
            }
            else
            {
                throw new InternalException();
            }
        }