Class: Ruleby::Core::CompositePattern
- Defined in:
- lib/core/patterns.rb
Overview
A composite pattern represents a logical conjunction of two patterns. The inference engine interprets this differently from an ObjectPattern because it simply aggregates patterns.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#left_pattern ⇒ Object
readonly
Returns the value of attribute left_pattern.
-
#right_pattern ⇒ Object
readonly
Returns the value of attribute right_pattern.
Instance Method Summary collapse
- #atoms ⇒ Object
-
#initialize(left_pattern, right_pattern) ⇒ CompositePattern
constructor
A new instance of CompositePattern.
Constructor Details
#initialize(left_pattern, right_pattern) ⇒ CompositePattern
Returns a new instance of CompositePattern.
72 73 74 75 |
# File 'lib/core/patterns.rb', line 72 def initialize(left_pattern, right_pattern) @left_pattern = left_pattern @right_pattern = right_pattern end |
Instance Attribute Details
#left_pattern ⇒ Object (readonly)
Returns the value of attribute left_pattern.
69 70 71 |
# File 'lib/core/patterns.rb', line 69 def left_pattern @left_pattern end |
#right_pattern ⇒ Object (readonly)
Returns the value of attribute right_pattern.
70 71 72 |
# File 'lib/core/patterns.rb', line 70 def right_pattern @right_pattern end |
Instance Method Details
#atoms ⇒ Object
77 78 79 80 81 82 |
# File 'lib/core/patterns.rb', line 77 def atoms atoms = [] atoms.push @left_pattern.atoms atoms.push @right_pattern.atoms return atoms end |