Class: Plumb::SemanticMatcher::Node

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

Direct Known Subclasses

FiniteSet, Interval, Literal, Nominal, Opaque, Pattern

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Node

Returns a new instance of Node.



35
36
37
38
# File 'lib/plumb/semantic_matcher.rb', line 35

def initialize(raw)
  @raw = raw
  freeze
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



33
34
35
# File 'lib/plumb/semantic_matcher.rb', line 33

def raw
  @raw
end

Instance Method Details

#equivalent?(other) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/plumb/semantic_matcher.rb', line 48

def equivalent?(other)
  other.instance_of?(self.class) && raw == other.raw
end

#error_messageObject



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

def error_message = "Must match #{raw.inspect}"

#intersect(_other) ⇒ Object



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

def intersect(_other) = Merge::UNKNOWN

#intersect_with_finite_set(_other) ⇒ Object



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

def intersect_with_finite_set(_other) = Merge::UNKNOWN

#intersect_with_range(_other) ⇒ Object



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

def intersect_with_range(_other) = Merge::UNKNOWN

#kindObject



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

def kind = :opaque

#matcher_domainObject



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

def matcher_domain = []

#matches_value(_candidate) ⇒ Object



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

def matches_value(_candidate) = Relation::UNKNOWN

#nominal?Boolean

Returns:

  • (Boolean)


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

def nominal? = false

#overlap(other) ⇒ Object



67
68
69
70
71
# File 'lib/plumb/semantic_matcher.rb', line 67

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

  other.overlap_with_opaque(self)
end

#overlap_with_finite_set(_other) ⇒ Object



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

def overlap_with_finite_set(_other) = Relation::UNKNOWN

#overlap_with_literal(_other) ⇒ Object



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

def overlap_with_literal(_other) = Relation::UNKNOWN

#overlap_with_nominal(_other) ⇒ Object



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

def overlap_with_nominal(_other) = Relation::UNKNOWN

#overlap_with_numeric_literal(other) ⇒ Object



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

def overlap_with_numeric_literal(other) = overlap_with_literal(other)

#overlap_with_opaque(_other) ⇒ Object



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

def overlap_with_opaque(_other) = Relation::UNKNOWN

#overlap_with_pattern(_other) ⇒ Object



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

def overlap_with_pattern(_other) = Relation::UNKNOWN

#overlap_with_range(_other) ⇒ Object



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

def overlap_with_range(_other) = Relation::UNKNOWN

#overlap_with_text_literal(other) ⇒ Object



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

def overlap_with_text_literal(other) = overlap_with_literal(other)

#singleton?Boolean

Returns:

  • (Boolean)


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

def singleton? = false

#subset_from_finite_set(_other) ⇒ Object



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

def subset_from_finite_set(_other) = Relation::UNKNOWN

#subset_from_literal(_other) ⇒ Object



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

def subset_from_literal(_other) = Relation::UNKNOWN

#subset_from_nominal(_other) ⇒ Object



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

def subset_from_nominal(_other) = Relation::UNKNOWN

#subset_from_numeric_literal(other) ⇒ Object



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

def subset_from_numeric_literal(other) = subset_from_literal(other)

#subset_from_opaque(_other) ⇒ Object



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

def subset_from_opaque(_other) = Relation::UNKNOWN

#subset_from_pattern(_other) ⇒ Object



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

def subset_from_pattern(_other) = Relation::UNKNOWN

#subset_from_range(_other) ⇒ Object



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

def subset_from_range(_other) = Relation::UNKNOWN

#subset_from_text_literal(other) ⇒ Object



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

def subset_from_text_literal(other) = subset_from_literal(other)

#subset_of(other) ⇒ Object



52
53
54
55
56
# File 'lib/plumb/semantic_matcher.rb', line 52

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

  other.subset_from_opaque(self)
end

#value_domainObject



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

def value_domain = raw.class