Class: Plumb::SemanticMatcher::Pattern
- Inherits:
-
Node
- Object
- Node
- Plumb::SemanticMatcher::Pattern
show all
- Defined in:
- lib/plumb/semantic_matcher.rb
Instance Attribute Summary
Attributes inherited from Node
#raw
Instance Method Summary
collapse
Methods inherited from Node
#equivalent?, #error_message, #initialize, #intersect, #intersect_with_finite_set, #intersect_with_range, #nominal?, #overlap_with_finite_set, #overlap_with_numeric_literal, #overlap_with_opaque, #overlap_with_pattern, #overlap_with_range, #overlap_with_text_literal, #singleton?, #subset_from_finite_set, #subset_from_literal, #subset_from_nominal, #subset_from_numeric_literal, #subset_from_opaque, #subset_from_pattern, #subset_from_range, #value_domain
Instance Method Details
#kind ⇒ Object
333
|
# File 'lib/plumb/semantic_matcher.rb', line 333
def kind = :pattern
|
#matcher_domain ⇒ Object
334
|
# File 'lib/plumb/semantic_matcher.rb', line 334
def matcher_domain = [::String, ::Symbol]
|
#matches_value(candidate) ⇒ Object
335
|
# File 'lib/plumb/semantic_matcher.rb', line 335
def matches_value(candidate) = Relation.from(raw === candidate)
|
#overlap(other) ⇒ Object
345
346
347
348
349
|
# File 'lib/plumb/semantic_matcher.rb', line 345
def overlap(other)
return Relation::PROVEN if equivalent?(other)
other.overlap_with_pattern(self)
end
|
#overlap_with_literal(other) ⇒ Object
355
356
357
358
359
|
# File 'lib/plumb/semantic_matcher.rb', line 355
def overlap_with_literal(other)
return Relation::UNKNOWN unless other.is_a?(TextLiteral)
matches_value(other.raw.to_s)
end
|
#overlap_with_nominal(other) ⇒ Object
351
352
353
|
# File 'lib/plumb/semantic_matcher.rb', line 351
def overlap_with_nominal(other)
Relation.any(matcher_domain.map { |domain| SemanticMatcher.wrap(domain).overlap(other) })
end
|
#subset_from_text_literal(other) ⇒ Object
343
|
# File 'lib/plumb/semantic_matcher.rb', line 343
def subset_from_text_literal(other) = matches_value(other.raw.to_s)
|
#subset_of(other) ⇒ Object
337
338
339
340
341
|
# File 'lib/plumb/semantic_matcher.rb', line 337
def subset_of(other)
return Relation::PROVEN if equivalent?(other)
other.subset_from_pattern(self)
end
|