class HQMF::Converter::SimpleRestriction

Attributes

converted[RW]
generated_data_criteria[RW]
negation[RW]
operator[RW]
preconditions[RW]
target[RW]

Public Class Methods

from_json(json) click to toggle source

Create a new population criteria from a JSON hash keyed off symbols

# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 17
def self.from_json(json)
  raise "not implemented"
end
new(operator, target, preconditions = []) click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 10
def initialize(operator, target, preconditions = [])
  @operator = operator
  @target = target
  @preconditions = preconditions
end

Public Instance Methods

comparison?() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 25
def comparison?
  false
end
has_preconditions?() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 32
def has_preconditions?
  preconditions and !preconditions.empty?
end
klass() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 21
def klass
  "RESTRICTION"
end
multi_target?() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 39
def multi_target?
  has_preconditions?
end
restriction?() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 28
def restriction?
  true
end
restrictions() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 43
def restrictions
  preconditions.select {|precondition| precondition.restriction?}
end
single_target?() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 36
def single_target?
  !target.nil?
end
to_json() click to toggle source
# File lib/hqmf-parser/converter/pass1/simple_restriction.rb, line 47
def to_json
  x = nil
  json = {}
  json[:klass] = klass
  json[:operator] = @operator.to_json if @operator
  json[:target] = @target if @target
  json[:negation] = @negation if @negation
  if (@preconditions)
    json[:preconditions] = x if x = json_array(@preconditions)
  end
  json
end