Class: Planner::Variable

Inherits:
Array
  • Object
show all
Defined in:
lib/sfpagent/sfplanner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, init = nil, goal = nil) ⇒ Variable

Returns a new instance of Variable.



108
109
110
111
112
113
114
115
116
117
# File 'lib/sfpagent/sfplanner.rb', line 108

def initialize(name, init=nil, goal=nil)
	@name = name
	@sym = @name.to_sym
	@values = []
	@map = {}
	@init = init
	@goal = goal
	@joints = {}
	@dependencies = {}
end

Instance Attribute Details

#dependenciesObject

Returns the value of attribute dependencies.



94
95
96
# File 'lib/sfpagent/sfplanner.rb', line 94

def dependencies
  @dependencies
end

#goalObject

Returns the value of attribute goal.



94
95
96
# File 'lib/sfpagent/sfplanner.rb', line 94

def goal
  @goal
end

#initObject

Returns the value of attribute init.



94
95
96
# File 'lib/sfpagent/sfplanner.rb', line 94

def init
  @init
end

#jointsObject

Returns the value of attribute joints.



94
95
96
# File 'lib/sfpagent/sfplanner.rb', line 94

def joints
  @joints
end

#nameObject (readonly)

Returns the value of attribute name.



93
94
95
# File 'lib/sfpagent/sfplanner.rb', line 93

def name
  @name
end

#symObject (readonly)

Returns the value of attribute sym.



93
94
95
# File 'lib/sfpagent/sfplanner.rb', line 93

def sym
  @sym
end

Class Method Details

.read(i, lines) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/sfpagent/sfplanner.rb', line 96

def self.read(i, lines)
	var = Variable.new(lines[i+1])
	i += 4
	i.upto(lines.length) do |j|
		i = j
		break if lines[j] == 'end_variable'
		var << lines[j].to_sym
	end
	fail "Cannot find end_variable" if lines[i] != 'end_variable'
	[i, var]
end

Instance Method Details

#super_to_sObject



119
# File 'lib/sfpagent/sfplanner.rb', line 119

alias :super_to_s :to_s

#to_sObject



120
121
122
# File 'lib/sfpagent/sfplanner.rb', line 120

def to_s
	@name + " " + super_to_s
end