コード例 #1
0
 def add_new_rule(self,
                  grammar: Grammar,
                  first_symbol: Symbol,
                  second_symbol: Symbol = None) -> Rule:
     new_rule = Rule([grammar.get_start_symbol(), first_symbol])
     new_rule.origin = RuleOrigin.COVERING
     grammar.add_rule(new_rule)
     self.iteration.add_covering_rule(new_rule)
     return new_rule
コード例 #2
0
 def add_new_rule(self,
                  grammar: Grammar,
                  first_symbol: Symbol,
                  second_symbol: Symbol = None) -> Rule:
     new_rule = Rule([
         RandomUtils.get_random_nonterminal_symbol_from(grammar),
         first_symbol, second_symbol
     ])
     new_rule.origin = RuleOrigin.COVERING
     self.crowding.add_rule(grammar, new_rule)
     self.iteration.add_covering_rule(new_rule)
     return new_rule