Class: Metamorpher::Terms::Term

Inherits:
Object
  • Object
show all
Extended by:
Attributable
Includes:
Matcher::Matching, Rewriter::Replacement, Rewriter::Substitution, Visitable
Defined in:
lib/metamorpher/terms/term.rb

Direct Known Subclasses

Derived, Literal, TermSet, Variable

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Rewriter::Substitution

#substitute

Methods included from Rewriter::Replacement

#replace

Methods included from Matcher::Matching

#match

Methods included from Visitable

#accept

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



12
13
14
# File 'lib/metamorpher/terms/term.rb', line 12

def parent
  @parent
end

Instance Method Details

#alternativesObject



23
24
25
# File 'lib/metamorpher/terms/term.rb', line 23

def alternatives
  [self]
end

#inspectObject



19
20
21
# File 'lib/metamorpher/terms/term.rb', line 19

def inspect
  name
end

#pathObject



27
28
29
30
31
32
33
# File 'lib/metamorpher/terms/term.rb', line 27

def path
  if parent
    parent.path << parent.children.index { |c| c.equal?(self) }
  else
    []
  end
end

#with_younger_siblingsObject



35
36
37
38
39
40
41
# File 'lib/metamorpher/terms/term.rb', line 35

def with_younger_siblings
  if parent
    parent.children_younger_than_or_equal_to(self)
  else
    [self]
  end
end