Class: Longjing::PDDL::Action
- Inherits:
-
Object
- Object
- Longjing::PDDL::Action
- Defined in:
- lib/longjing/pddl/action.rb
Instance Attribute Summary collapse
-
#effect ⇒ Object
readonly
Returns the value of attribute effect.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#precond ⇒ Object
readonly
Returns the value of attribute precond.
Instance Method Summary collapse
-
#initialize(name, params, precond, effect) ⇒ Action
constructor
A new instance of Action.
- #signature ⇒ Object
- #substitute(arguments) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(name, params, precond, effect) ⇒ Action
Returns a new instance of Action.
8 9 10 11 12 13 |
# File 'lib/longjing/pddl/action.rb', line 8 def initialize(name, params, precond, effect) @name = name @params = params @precond = precond @effect = effect end |
Instance Attribute Details
#effect ⇒ Object (readonly)
Returns the value of attribute effect.
6 7 8 |
# File 'lib/longjing/pddl/action.rb', line 6 def effect @effect end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/longjing/pddl/action.rb', line 6 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/longjing/pddl/action.rb', line 6 def params @params end |
#precond ⇒ Object (readonly)
Returns the value of attribute precond.
6 7 8 |
# File 'lib/longjing/pddl/action.rb', line 6 def precond @precond end |
Instance Method Details
#signature ⇒ Object
22 23 24 |
# File 'lib/longjing/pddl/action.rb', line 22 def signature "#{@name}(#{@params.map(&:name).map(&:to_s).join(' ')})" end |
#substitute(arguments) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/longjing/pddl/action.rb', line 15 def substitute(arguments) variables = Hash[@params.zip(arguments)] return nil unless precond = @precond.substitute(variables) return nil unless effect = @effect.substitute(variables) Action.new(@name, arguments, precond, effect) end |
#to_s ⇒ Object Also known as: inspect
26 27 28 |
# File 'lib/longjing/pddl/action.rb', line 26 def to_s "(action #{@name} :parameters #{@params.join(' ')} :precondition #{@precond} :effect #{@effect})" end |