Esempio n. 1
0
 public void ModifyAll(GRGEN_LIBGR.IActionExecutionEnvironment actionEnv, GRGEN_LIBGR.IMatchesExact <Rule_testRule.IMatch_testRule> matches)
 {
     foreach (Rule_testRule.IMatch_testRule match in matches)
     {
         _rulePattern.Modify((GRGEN_LGSP.LGSPActionExecutionEnvironment)actionEnv, match);
     }
 }
Esempio n. 2
0
 public bool Apply(GRGEN_LIBGR.IActionExecutionEnvironment actionEnv)
 {
     GRGEN_LIBGR.IMatchesExact <Rule_testRule.IMatch_testRule> matches = DynamicMatch((GRGEN_LGSP.LGSPActionExecutionEnvironment)actionEnv, 1);
     if (matches.Count <= 0)
     {
         return(false);
     }
     _rulePattern.Modify((GRGEN_LGSP.LGSPActionExecutionEnvironment)actionEnv, matches.First);
     return(true);
 }
Esempio n. 3
0
 public int ApplyAll(int maxMatches, GRGEN_LIBGR.IActionExecutionEnvironment actionEnv)
 {
     GRGEN_LIBGR.IMatchesExact <Rule_testRule.IMatch_testRule> matches = DynamicMatch((GRGEN_LGSP.LGSPActionExecutionEnvironment)actionEnv, maxMatches);
     if (matches.Count <= 0)
     {
         return(0);
     }
     foreach (Rule_testRule.IMatch_testRule match in matches)
     {
         _rulePattern.Modify((GRGEN_LGSP.LGSPActionExecutionEnvironment)actionEnv, match);
     }
     return(matches.Count);
 }
        public static void Filter_filterBass_auto(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterBass.IMatch_filterBass> matches)
        {
            if (matches.Count < 2)
            {
                return;
            }
            List <Rule_filterBass.IMatch_filterBass> matchesArray = matches.ToList();

            for (int i = 0; i < matchesArray.Count; ++i)
            {
                if (matchesArray[i] == null)
                {
                    continue;
                }
                for (int j = i + 1; j < matchesArray.Count; ++j)
                {
                    if (matchesArray[j] == null)
                    {
                        continue;
                    }
                    if (GRGEN_LIBGR.SymmetryChecker.AreSymmetric(matchesArray[i], matchesArray[j], procEnv.graph))
                    {
                        matchesArray[j] = null;
                    }
                }
            }
            matches.FromList();
        }
 public static void Filter_f1(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterBase.IMatch_filterBase> matches)
 {
     // just let pass
 }
        public static void Filter_f4(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterHass.IMatch_filterHass> matches, System.Int32 i, System.String s)
        {
            // inspect matches carefully and manipulate as needed, depending on input parameters
            // transforming to a List<IMatch> for easier manipulation and back to an IMatchesExact if needed
            List <Rule_filterHass.IMatch_filterHass> matchesArray = matches.ToList();

            for (int j = 0; j < matchesArray.Count; ++j)
            {
                Rule_filterHass.IMatch_filterHass match = matchesArray[j];
                if (match.node_n.i < i)
                {
                    matchesArray[j] = null;                     // setting to null is an efficient way to delete, better than List.RemoveAt
                }
                if (match.node_n.s != s)
                {
                    match.node_n.s = s;
                }
            }
            matches.FromList();
        }
        public static void Filter_f3(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterBass.IMatch_filterBass> matches)
        {
            // inspect matches carefully and manipulate as needed,
            // transforming to a List<IMatch> for easier manipulation and back to an IMatchesExact if needed
            List <Rule_filterBass.IMatch_filterBass> matchesArray = matches.ToList();

            matchesArray.Reverse();
            Rule_filterBass.IMatch_filterBass match = matchesArray[matchesArray.Count - 1];
            matchesArray[matchesArray.Count - 1] = null; // setting to null is an efficient way to delete, better than List.RemoveAt
            ++match.node_n.i;
            matchesArray.Add(match);
            matchesArray.Reverse();
            matches.FromList();
        }
        public static void Filter_f2(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterBass.IMatch_filterBass> matches)
        {
            // inspect matches carefully and manipulate as needed
            IEnumerator <Rule_filterBass.IMatch_filterBass> e = matches.GetEnumeratorExact();

            while (e.MoveNext())
            {
                Rule_filterBass.IMatch_filterBass match = e.Current;
                if (match.node_n.i != 42)
                {
                    break;
                }
            }
        }
 public static void Filter_nomnomnom(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <Rule_filterBase.IMatch_filterBase> matches)
 {
     // eat away the single match of the empty rule
     matches.RemoveMatch(0);
 }
Esempio n. 10
0
            public static void Filter_TransformSingle_orderAscendingBy_order(GRGEN_LGSP.LGSPGraphProcessingEnvironment procEnv, GRGEN_LIBGR.IMatchesExact <na.Rule_TransformSingle.IMatch_TransformSingle> matches)
            {
                List <na.Rule_TransformSingle.IMatch_TransformSingle> matchesArray = matches.ToList();

                matchesArray.Sort(new Comparer_TransformSingle_orderAscendingBy_order());
                matches.FromList();
            }