Class: Sfp::SasTranslator::GoalVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/sfp/sas_translator.rb

Overview

Visitor that set goal value of each variable

Instance Method Summary collapse

Methods inherited from Visitor

#initialize

Constructor Details

This class inherits a constructor from Sfp::SasTranslator::Visitor

Instance Method Details

#set_equals(name, value) ⇒ Object



1546
1547
1548
1549
1550
# File 'lib/sfp/sas_translator.rb', line 1546

def set_equals(name, value)
	value = @types[@vars[name].type][0] if value.is_a?(Hash) and value.isnull
	value = @root['initial'].at?(value) if value.is_a?(String) and value.isref
	@vars[name].goal = value
end

#visit(name, value, obj) ⇒ Object



1552
1553
1554
1555
1556
1557
1558
1559
1560
# File 'lib/sfp/sas_translator.rb', line 1552

def visit(name, value, obj)
	return if name[0,1] == '_'
	raise VariableNotFoundException, 'Variable not found: ' + name if
		not @vars.has_key?(name)
	if value.isconstraint
		self.set_equals(name, value['_value']) if value['_type'] == 'equals'
	end
	return true
end