예제 #1
0
        public void Modify(GRGEN_LGSP.LGSPActionExecutionEnvironment actionEnv, GRGEN_LIBGR.IMatch _curMatch)
        {
            GRGEN_LGSP.LGSPGraph graph    = actionEnv.graph;
            Match_testRule       curMatch = (Match_testRule)_curMatch;

            GRGEN_LGSP.LGSPNode node_a = curMatch._node_a;
            GRGEN_LGSP.LGSPNode node_f = curMatch._node_f;
            GRGEN_LGSP.LGSPNode node_m = curMatch._node_m;
            graph.SettingAddedNodeNames(testRule_addedNodeNames);
            GRGEN_LGSP.LGSPNode        node_are  = graph.Retype(node_a, GRGEN_MODEL.NodeType_D2211_2222_31.typeVar);
            GRGEN_MODEL.ID2211_2222_31 inode_are = (GRGEN_MODEL.ID2211_2222_31)node_are;
            GRGEN_LGSP.LGSPNode        node_fre  = graph.Retype(node_f, GRGEN_MODEL.NodeType_D231_4121.typeVar);
            GRGEN_MODEL.ID231_4121     inode_fre = (GRGEN_MODEL.ID231_4121)node_fre;
            GRGEN_LGSP.LGSPNode        node_mre  = graph.Retype(node_m, GRGEN_MODEL.NodeType_D11_2221.typeVar);
            GRGEN_MODEL.ID11_2221      inode_mre = (GRGEN_MODEL.ID11_2221)node_mre;
            graph.SettingAddedEdgeNames(testRule_addedEdgeNames);
            {             // eval_0
                int tempvar_0 = (int )1234;
                graph.ChangingNodeAttribute(node_are, GRGEN_MODEL.NodeType_D2211_2222_31.AttributeType_d2211_2222_31, GRGEN_LIBGR.AttributeChangeType.Assign, tempvar_0, null);
                inode_are.@d2211_2222_31 = tempvar_0;
                graph.ChangedNodeAttribute(node_are, GRGEN_MODEL.NodeType_D2211_2222_31.AttributeType_d2211_2222_31);
                int tempvar_1 = (int )5678;
                graph.ChangingNodeAttribute(node_fre, GRGEN_MODEL.NodeType_D231_4121.AttributeType_d231_4121, GRGEN_LIBGR.AttributeChangeType.Assign, tempvar_1, null);
                inode_fre.@d231_4121 = tempvar_1;
                graph.ChangedNodeAttribute(node_fre, GRGEN_MODEL.NodeType_D231_4121.AttributeType_d231_4121);
                int tempvar_2 = (int )9012;
                graph.ChangingNodeAttribute(node_mre, GRGEN_MODEL.NodeType_D11_2221.AttributeType_d11_2221, GRGEN_LIBGR.AttributeChangeType.Assign, tempvar_2, null);
                inode_mre.@d11_2221 = tempvar_2;
                graph.ChangedNodeAttribute(node_mre, GRGEN_MODEL.NodeType_D11_2221.AttributeType_d11_2221);
            }
            return;
        }
예제 #2
0
        public GRGEN_LIBGR.IMatchesExact <Rule_testRule.IMatch_testRule> myMatch(GRGEN_LGSP.LGSPActionExecutionEnvironment actionEnv, int maxMatches)
        {
            GRGEN_LGSP.LGSPGraph graph = actionEnv.graph;
            matches.Clear();
            int isoSpace = 0;
            // Lookup testRule_edge__edge1
            int type_id_candidate_testRule_edge__edge1 = 1;

            for (GRGEN_LGSP.LGSPEdge head_candidate_testRule_edge__edge1 = graph.edgesByTypeHeads[type_id_candidate_testRule_edge__edge1], candidate_testRule_edge__edge1 = head_candidate_testRule_edge__edge1.lgspTypeNext; candidate_testRule_edge__edge1 != head_candidate_testRule_edge__edge1; candidate_testRule_edge__edge1 = candidate_testRule_edge__edge1.lgspTypeNext)
            {
                uint prev__candidate_testRule_edge__edge1;
                prev__candidate_testRule_edge__edge1      = candidate_testRule_edge__edge1.lgspFlags & (uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace;
                candidate_testRule_edge__edge1.lgspFlags |= (uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace;
                // Implicit Source testRule_node_f from testRule_edge__edge1
                GRGEN_LGSP.LGSPNode candidate_testRule_node_f = candidate_testRule_edge__edge1.lgspSource;
                if (candidate_testRule_node_f.lgspType.TypeID != 6)
                {
                    candidate_testRule_edge__edge1.lgspFlags = candidate_testRule_edge__edge1.lgspFlags & ~((uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace) | prev__candidate_testRule_edge__edge1;
                    continue;
                }
                // Implicit Target testRule_node_m from testRule_edge__edge1
                GRGEN_LGSP.LGSPNode candidate_testRule_node_m = candidate_testRule_edge__edge1.lgspTarget;
                if (candidate_testRule_node_m.lgspType.TypeID != 17)
                {
                    candidate_testRule_edge__edge1.lgspFlags = candidate_testRule_edge__edge1.lgspFlags & ~((uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace) | prev__candidate_testRule_edge__edge1;
                    continue;
                }
                // Extend Incoming testRule_edge__edge0 from testRule_node_f
                GRGEN_LGSP.LGSPEdge head_candidate_testRule_edge__edge0 = candidate_testRule_node_f.lgspInhead;
                if (head_candidate_testRule_edge__edge0 != null)
                {
                    GRGEN_LGSP.LGSPEdge candidate_testRule_edge__edge0 = head_candidate_testRule_edge__edge0;
                    do
                    {
                        if (candidate_testRule_edge__edge0.lgspType.TypeID != 1)
                        {
                            continue;
                        }
                        if ((candidate_testRule_edge__edge0.lgspFlags & (uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace) != 0)
                        {
                            continue;
                        }
                        // Implicit Source testRule_node_a from testRule_edge__edge0
                        GRGEN_LGSP.LGSPNode candidate_testRule_node_a = candidate_testRule_edge__edge0.lgspSource;
                        if (candidate_testRule_node_a.lgspType.TypeID != 18)
                        {
                            continue;
                        }
                        Rule_testRule.Match_testRule match = matches.GetNextUnfilledPosition();
                        match._node_a      = candidate_testRule_node_a;
                        match._node_f      = candidate_testRule_node_f;
                        match._node_m      = candidate_testRule_node_m;
                        match._edge__edge0 = candidate_testRule_edge__edge0;
                        match._edge__edge1 = candidate_testRule_edge__edge1;
                        matches.PositionWasFilledFixIt();
                        // if enough matches were found, we leave
                        if (maxMatches > 0 && matches.Count >= maxMatches)
                        {
                            candidate_testRule_node_f.MoveInHeadAfter(candidate_testRule_edge__edge0);
                            graph.MoveHeadAfter(candidate_testRule_edge__edge1);
                            candidate_testRule_edge__edge1.lgspFlags = candidate_testRule_edge__edge1.lgspFlags & ~((uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace) | prev__candidate_testRule_edge__edge1;
                            return(matches);
                        }
                    }while((candidate_testRule_edge__edge0 = candidate_testRule_edge__edge0.lgspInNext) != head_candidate_testRule_edge__edge0);
                }
                candidate_testRule_edge__edge1.lgspFlags = candidate_testRule_edge__edge1.lgspFlags & ~((uint)GRGEN_LGSP.LGSPElemFlags.IS_MATCHED << isoSpace) | prev__candidate_testRule_edge__edge1;
            }
            return(matches);
        }