Class: Longjing::PDDL::Equal

Inherits:
Literal
  • Object
show all
Defined in:
lib/longjing/pddl/literal.rb

Direct Known Subclasses

EqualFormula

Instance Attribute Summary collapse

Attributes inherited from Literal

#ff_goal, #ff_layer, #ff_neg_goal

Instance Method Summary collapse

Methods inherited from Literal

#applicable?, #apply, #to_a

Constructor Details

#initialize(left, right) ⇒ Equal

Returns a new instance of Equal.


146
147
148
# File 'lib/longjing/pddl/literal.rb', line 146

def initialize(left, right)
  @left, @right = left, right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.


145
146
147
# File 'lib/longjing/pddl/literal.rb', line 145

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.


145
146
147
# File 'lib/longjing/pddl/literal.rb', line 145

def right
  @right
end

Instance Method Details

#inspectObject


158
159
160
# File 'lib/longjing/pddl/literal.rb', line 158

def inspect
  "(= #{@left.inspect} #{@right.inspect})"
end

#substitute(variables) ⇒ Object


150
151
152
# File 'lib/longjing/pddl/literal.rb', line 150

def substitute(variables)
  variables[@left] == variables[@right] ? EMPTY : nil
end

#to_sObject


154
155
156
# File 'lib/longjing/pddl/literal.rb', line 154

def to_s
  "(= #{@left} #{@right})"
end