Class: HQMF::Converter::SimplePrecondition
- Inherits:
-
Precondition
- Object
- Precondition
- HQMF::Converter::SimplePrecondition
- Defined in:
- lib/hqmf-parser/converter/pass1/simple_precondition.rb
Constant Summary collapse
- COMPARISON =
"COMPARISON"
- PRECONDITION =
"PRECONDITION"
Constants inherited from Precondition
Precondition::ALL_FALSE, Precondition::ALL_TRUE, Precondition::AT_LEAST_ONE_FALSE, Precondition::AT_LEAST_ONE_TRUE, Precondition::INVERSIONS, Precondition::NEGATIONS
Instance Attribute Summary collapse
-
#conjunction_code ⇒ Object
Returns the value of attribute conjunction_code.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#processed ⇒ Object
Returns the value of attribute processed.
-
#subset_comparison ⇒ Object
Returns the value of attribute subset_comparison.
Attributes inherited from Precondition
#comments, #id, #negation, #preconditions, #reference
Instance Method Summary collapse
- #comparison? ⇒ Boolean
- #delete_converted_restrictions! ⇒ Object
- #has_preconditions? ⇒ Boolean
-
#initialize(id, preconditions, reference, conjunction_code, negation) ⇒ SimplePrecondition
constructor
A new instance of SimplePrecondition.
- #reference=(reference) ⇒ Object
- #restriction? ⇒ Boolean
- #restrictions ⇒ Object
- #to_json ⇒ Object
Methods inherited from Precondition
#conjunction?, #conjunction_code_with_negation, from_json, #referenced_data_criteria
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(id, preconditions, reference, conjunction_code, negation) ⇒ SimplePrecondition
Returns a new instance of SimplePrecondition.
12 13 14 15 16 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 12 def initialize(id, preconditions,reference,conjunction_code,negation) super(id, preconditions,reference,conjunction_code,negation) @id = HQMF::Counter.instance.next if (@id.nil?) @klass = PRECONDITION end |
Instance Attribute Details
#conjunction_code ⇒ Object
Returns the value of attribute conjunction_code.
10 11 12 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 10 def conjunction_code @conjunction_code end |
#klass ⇒ Object
Returns the value of attribute klass.
10 11 12 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 10 def klass @klass end |
#processed ⇒ Object
Returns the value of attribute processed.
10 11 12 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 10 def processed @processed end |
#subset_comparison ⇒ Object
Returns the value of attribute subset_comparison.
10 11 12 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 10 def subset_comparison @subset_comparison end |
Instance Method Details
#comparison? ⇒ Boolean
24 25 26 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 24 def comparison? @klass == COMPARISON end |
#delete_converted_restrictions! ⇒ Object
43 44 45 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 43 def delete_converted_restrictions! preconditions.delete_if {|precondition| precondition.restriction? and precondition.converted} end |
#has_preconditions? ⇒ Boolean
31 32 33 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 31 def has_preconditions? preconditions and !preconditions.empty? end |
#reference=(reference) ⇒ Object
39 40 41 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 39 def reference=(reference) @reference = reference end |
#restriction? ⇒ Boolean
27 28 29 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 27 def restriction? false end |
#restrictions ⇒ Object
35 36 37 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 35 def restrictions preconditions.select {|precondition| precondition.restriction?} end |
#to_json ⇒ Object
18 19 20 21 22 |
# File 'lib/hqmf-parser/converter/pass1/simple_precondition.rb', line 18 def to_json json = super # json[:klass] = @klass json end |