Class: Longjing::PDDL::Var

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type = nil) ⇒ Var

Returns a new instance of Var.



5
6
7
8
9
# File 'lib/longjing/pddl/var.rb', line 5

def initialize(name, type=nil)
  @name = name
  @type = type || Type::OBJECT
  @hash = name.hash
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



4
5
6
# File 'lib/longjing/pddl/var.rb', line 4

def hash
  @hash
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/longjing/pddl/var.rb', line 4

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/longjing/pddl/var.rb', line 4

def type
  @type
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/longjing/pddl/var.rb', line 15

def inspect
  "(var #{to_s})"
end

#to_sObject



11
12
13
# File 'lib/longjing/pddl/var.rb', line 11

def to_s
  "#{@name} - #{@type}"
end