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.



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

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.



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

def dependencies
  @dependencies
end

#goalObject

Returns the value of attribute goal.



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

def goal
  @goal
end

#initObject

Returns the value of attribute init.



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

def init
  @init
end

#jointsObject

Returns the value of attribute joints.



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

def joints
  @joints
end

#nameObject (readonly)

Returns the value of attribute name.



91
92
93
# File 'lib/sfpagent/sfplanner.rb', line 91

def name
  @name
end

#symObject (readonly)

Returns the value of attribute sym.



91
92
93
# File 'lib/sfpagent/sfplanner.rb', line 91

def sym
  @sym
end

Class Method Details

.read(i, lines) ⇒ Object



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

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



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

alias :super_to_s :to_s

#to_sObject



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

def to_s
	@name + " " + super_to_s
end