class Sfp::Axiom
A class for Grounded Axiom
Attributes
id[RW]
target[RW]
Public Class Methods
new()
click to toggle source
# File lib/sfp/sas_translator.rb, line 2154 def initialize @id = Sfp::SasTranslator.next_axiom_id end
Public Instance Methods
to_s()
click to toggle source
# File lib/sfp/sas_translator.rb, line 2158 def to_s return 'axiom#' + @id.to_s end
to_sas(root, variables)
click to toggle source
# File lib/sfp/sas_translator.rb, line 2162 def to_sas(root, variables) prevails = select { |var,param| param.post.nil? } preposts = select { |var,param| !param.post.nil? } raise Exception, "Invalid axiom: total preposts > 1" if preposts.length > 1 raise Exception, "Invalid axiom: total preposts <= 0" if preposts.length <= 0 sas = "begin_rule" sas << "\n#{prevails.length}" prevails.each { |var,param| sas << "\n#{param.to_sas(root, variables)}" } preposts.each { |var,param| sas << "\n#{param.to_sas(root, variables)}" } sas << "\nend_rule" return sas end