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



1646
1647
1648
1649
1650
# File 'lib/sfp/sas_translator.rb', line 1646

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



1652
1653
1654
1655
1656
1657
1658
1659
1660
# File 'lib/sfp/sas_translator.rb', line 1652

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