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



1558
1559
1560
1561
1562
# File 'lib/sfp/sas_translator.rb', line 1558

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



1564
1565
1566
1567
1568
1569
1570
1571
1572
# File 'lib/sfp/sas_translator.rb', line 1564

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