Class: Plumb::SemanticMatcher::Literal

Inherits:
Node
  • Object
show all
Defined in:
lib/plumb/semantic_matcher.rb

Direct Known Subclasses

NumericLiteral, TextLiteral

Instance Attribute Summary

Attributes inherited from Node

#raw

Instance Method Summary collapse

Methods inherited from Node

#equivalent?, #initialize, #intersect, #intersect_with_finite_set, #intersect_with_range, #nominal?, #overlap_with_finite_set, #overlap_with_numeric_literal, #overlap_with_opaque, #overlap_with_text_literal, #subset_from_finite_set, #subset_from_nominal, #subset_from_numeric_literal, #subset_from_opaque, #subset_from_pattern, #subset_from_range, #subset_from_text_literal, #value_domain

Constructor Details

This class inherits a constructor from Plumb::SemanticMatcher::Node

Instance Method Details

#error_messageObject



100
# File 'lib/plumb/semantic_matcher.rb', line 100

def error_message = "Must be equal to #{raw}"

#kindObject



96
# File 'lib/plumb/semantic_matcher.rb', line 96

def kind = :literal

#matcher_domainObject



98
# File 'lib/plumb/semantic_matcher.rb', line 98

def matcher_domain = [value_domain]

#matches_value(candidate) ⇒ Object



99
# File 'lib/plumb/semantic_matcher.rb', line 99

def matches_value(candidate) = Relation.from(raw === candidate)

#overlap(other) ⇒ Object



110
111
112
113
114
# File 'lib/plumb/semantic_matcher.rb', line 110

def overlap(other)
  return Relation::PROVEN if equivalent?(other)

  other.overlap_with_literal(self)
end

#overlap_with_literal(_other) ⇒ Object



116
# File 'lib/plumb/semantic_matcher.rb', line 116

def overlap_with_literal(_other) = Relation::DISPROVEN

#overlap_with_nominal(other) ⇒ Object



117
# File 'lib/plumb/semantic_matcher.rb', line 117

def overlap_with_nominal(other) = other.overlap_with_literal(self)

#overlap_with_pattern(other) ⇒ Object



119
# File 'lib/plumb/semantic_matcher.rb', line 119

def overlap_with_pattern(other) = other.overlap_with_literal(self)

#overlap_with_range(other) ⇒ Object



118
# File 'lib/plumb/semantic_matcher.rb', line 118

def overlap_with_range(other) = other.overlap_with_literal(self)

#singleton?Boolean

Returns:

  • (Boolean)


97
# File 'lib/plumb/semantic_matcher.rb', line 97

def singleton? = true

#subset_from_literal(_other) ⇒ Object



108
# File 'lib/plumb/semantic_matcher.rb', line 108

def subset_from_literal(_other) = Relation::DISPROVEN

#subset_of(other) ⇒ Object



102
103
104
105
106
# File 'lib/plumb/semantic_matcher.rb', line 102

def subset_of(other)
  return Relation::PROVEN if equivalent?(other)

  other.subset_from_literal(self)
end