Class: Mapper::Rule
- Inherits:
-
Array
- Object
- Array
- Mapper::Rule
- Defined in:
- ../lib/grammar.rb
Overview
Right-hand side of the syntactic rule, composed from logical aternatives. Rule contains one or more Mapper::RuleAlt objects, for GE Mapper::Base to select from.
For instance:
<expr> ::= X | X+Y | X*Y
defines the Rule of three RuleAlts for the symbol “
Instance Attribute Summary (collapse)
-
- (Object) min_depth
The min_depth attribute used in Validator.analyze_recursivity process (see).
-
- (Object) recursivity
The Rule (symbol) recursivity used in Validator.analyze_min_depth process (see).
-
- (Object) sn_altering
The sn_altering (structural/nodal altering) attribute is used in Validator.analyze_sn_altering process (see).
Instance Method Summary (collapse)
-
- (Object) deep_copy
Return a deep copy of the instance.
-
- (Rule) initialize(ary = nil, recursive = nil, sn_altering = nil, min_depth = nil)
constructor
Initialize the Rule from the ary argument (ie. from the Enumerable of RuleAlts).
Constructor Details
- (Rule) initialize(ary = nil, recursive = nil, sn_altering = nil, min_depth = nil)
Initialize the Rule from the ary argument (ie. from the Enumerable of RuleAlts). The recursive, sn_altering and min_depth arguments will be copied into self.recursivity, self.sn_altering and self.min_depth attribute, respectively.
119 120 121 122 123 124 |
# File '../lib/grammar.rb', line 119 def initialize( ary=nil, recursive=nil, sn_altering=nil, min_depth=nil ) super ary unless ary.nil? @recursivity = recursive @sn_altering = sn_altering @min_depth = min_depth end |
Instance Attribute Details
- (Object) min_depth
The min_depth attribute used in Validator.analyze_recursivity process (see).
This is a minimal number of mapping steps required by the generator to finish the mapping process.
149 150 151 |
# File '../lib/grammar.rb', line 149 def min_depth @min_depth end |
- (Object) recursivity
The Rule (symbol) recursivity used in Validator.analyze_min_depth process (see). Allowed values are:
:infinite ... the Rule contains only :infinite RuleAlts,
:cyclic ... the Rule contains at least one :cyclic RuleAlt,
:terminating .. the Rule contains only :terminating RuleAlts.
138 139 140 |
# File '../lib/grammar.rb', line 138 def recursivity @recursivity end |
- (Object) sn_altering
The sn_altering (structural/nodal altering) attribute is used in Validator.analyze_sn_altering process (see). Allowed values are:
:structural ... the mutation on this position can result in the structural change of the phenotype.
:nodal ... the mutation on this position cannot result in the structural change (the decision tree is unchanged).
145 146 147 |
# File '../lib/grammar.rb', line 145 def sn_altering @sn_altering end |
Instance Method Details
- (Object) deep_copy
Return a deep copy of the instance.
127 128 129 130 |
# File '../lib/grammar.rb', line 127 def deep_copy rule = map {|r| r.deep_copy } Rule.new( rule, @recursivity, @sn_altering, @min_depth ) end |