Class: ADSL::DS::DSVariable

Inherits:
DSNode show all
Defined in:
lib/adsl/ds/data_store_spec.rb,
lib/adsl/spass/spass_ds_extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSNode

#list_entity_classes_read, #list_entity_classes_written_to, #replace, #replace_var

Instance Attribute Details

#contextObject

Returns the value of attribute context.



649
650
651
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 649

def context
  @context
end

#predObject

Returns the value of attribute pred.



649
650
651
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 649

def pred
  @pred
end

Instance Method Details

#[](*args) ⇒ Object



677
678
679
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 677

def [](*args)
  @pred[args]
end

#action_nameObject



651
652
653
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 651

def action_name
  "var_#{@name}"
end

#define_predicate(translation) ⇒ Object



660
661
662
663
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 660

def define_predicate(translation)
  @context = translation.context
  @pred = translation.create_predicate action_name, context.level + 1
end

#invariant_nameObject



669
670
671
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 669

def invariant_name
  "invariant_var_#{@name}"
end

#prepare_action(translation) ⇒ Object

The predicate is not defined in prepare_action as we want the predicate to be defined only when assigning to the variable not when using it a nil check does not work because it makes the translation non-reusable



659
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 659

def prepare_action(translation); end

#resolve_action_objset(translation, ps, var) ⇒ Object



665
666
667
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 665

def resolve_action_objset(translation, ps, var)
  return @pred[ps.first(@context.level), var]
end

#resolve_invariant_objset(translation, var) ⇒ Object



673
674
675
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 673

def resolve_invariant_objset(translation, var)
  FOL::Equal.new(invariant_name, var)
end