rtp-connect 1.8 → 1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ module RTP
9
9
  class Prescription < Record
10
10
 
11
11
  # The Record which this instance belongs to.
12
- attr_reader :parent
12
+ attr_accessor :parent
13
13
  # The SiteSetup record (if any) that belongs to this Prescription.
14
14
  attr_reader :site_setup
15
15
  # An array of SimulationField records (if any) that belongs to this Prescription.
@@ -93,6 +93,7 @@ module RTP
93
93
  #
94
94
  def add_field(child)
95
95
  @fields << child.to_field
96
+ child.parent = self
96
97
  end
97
98
 
98
99
  # Adds a simulation field record to this instance.
@@ -101,6 +102,7 @@ module RTP
101
102
  #
102
103
  def add_simulation_field(child)
103
104
  @simulation_fields << child.to_simulation_field
105
+ child.parent = self
104
106
  end
105
107
 
106
108
  # Adds a site setup record to this instance.
@@ -109,6 +111,7 @@ module RTP
109
111
  #
110
112
  def add_site_setup(child)
111
113
  @site_setup = child.to_site_setup
114
+ child.parent = self
112
115
  end
113
116
 
114
117
  # Collects the child records of this instance in a properly sorted array.
@@ -119,6 +122,41 @@ module RTP
119
122
  return [@site_setup, @simulation_fields, @fields].flatten.compact
120
123
  end
121
124
 
125
+ # Removes the reference of the given instance from this instance.
126
+ #
127
+ # @param [Field, SimulationField, SiteSetup] record a child record to be removed from this instance
128
+ #
129
+ def delete(record)
130
+ case record
131
+ when Field
132
+ delete_child(:fields, record)
133
+ when SimulationField
134
+ delete_child(:simulation_fields, record)
135
+ when SiteSetup
136
+ delete_site_setup
137
+ else
138
+ logger.warn("Unknown class (record) given to Prescription#delete: #{record.class}")
139
+ end
140
+ end
141
+
142
+ # Removes all field references from this instance.
143
+ #
144
+ def delete_fields
145
+ delete_children(:fields)
146
+ end
147
+
148
+ # Removes all simulation_field references from this instance.
149
+ #
150
+ def delete_simulation_fields
151
+ delete_children(:simulation_fields)
152
+ end
153
+
154
+ # Removes the site setup reference from this instance.
155
+ #
156
+ def delete_site_setup
157
+ delete_child(:site_setup)
158
+ end
159
+
122
160
  # Computes a hash code for this object.
123
161
  #
124
162
  # @note Two objects with the same attributes will have the same hash code.
@@ -137,25 +175,6 @@ module RTP
137
175
  self
138
176
  end
139
177
 
140
- # Encodes the Prescription object + any hiearchy of child objects,
141
- # to a properly formatted RTPConnect ascii string.
142
- #
143
- # @param [Hash] options an optional hash parameter
144
- # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
145
- # @return [String] an RTP string with a single or multiple lines/records
146
- #
147
- def to_s(options={})
148
- str = encode(options)
149
- if children
150
- children.each do |child|
151
- str += child.to_s(options)
152
- end
153
- end
154
- return str
155
- end
156
-
157
- alias :to_str :to_s
158
-
159
178
  # Sets the course_id attribute.
160
179
  #
161
180
  # @param [nil, #to_s] value the new attribute value
@@ -1,144 +1,202 @@
1
- module RTP
2
-
3
- # The Record class contains attributes and methods that are common
4
- # for the various record types defined in the RTPConnect standard.
5
- #
6
- class Record
7
-
8
- # The keyword defines the record type of a particular RTP string line.
9
- attr_reader :keyword
10
- # The CRC is used to validate the integrity of the content of the RTP string line.
11
- attr_reader :crc
12
-
13
- # Creates a new Record.
14
- #
15
- # @param [String] keyword the keyword which identifies this record
16
- # @param [Integer] min_elements the minimum number of data elements required for this record
17
- # @param [Integer] max_elements the maximum supported number of data elements for this record
18
- #
19
- def initialize(keyword, min_elements, max_elements)
20
- @keyword = keyword
21
- @min_elements = min_elements
22
- @max_elements = max_elements
23
- end
24
-
25
- # Sets the crc (checksum) attribute.
26
- #
27
- # @note This value is not used when creating an RTP string from a record (a new crc is calculated)
28
- # @param [#to_s] value the new attribute value
29
- #
30
- def crc=(value)
31
- @crc = value.to_s
32
- end
33
-
34
- # Encodes a string from the contents of this instance.
35
- #
36
- # This produces the full record string line, including a computed CRC checksum.
37
- #
38
- # @param [Hash] options an optional hash parameter
39
- # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
40
- # @return [String] a proper RTPConnect type CSV string
41
- #
42
- def encode(options={})
43
- encoded_values = values.collect {|v| v && v.encode('ISO8859-1')}
44
- encoded_values = discard_unsupported_attributes(encoded_values, options) if options[:version]
45
- content = CSV.generate_line(encoded_values, force_quotes: true, row_sep: '') + ","
46
- checksum = content.checksum
47
- # Complete string is content + checksum (in double quotes) + carriage return + line feed
48
- return (content + checksum.to_s.wrap + "\r\n").encode('ISO8859-1')
49
- end
50
-
51
- # Follows the tree of parents until the appropriate parent of the requesting record is found.
52
- #
53
- # @param [Record] last_parent the previous parent (the record from the previous line in the RTP file)
54
- # @param [Record] klass the expected parent record class of this record (e.g. Plan, Field)
55
- #
56
- def get_parent(last_parent, klass)
57
- if last_parent.is_a?(klass)
58
- return last_parent
59
- else
60
- return last_parent.get_parent(last_parent.parent, klass)
61
- end
62
- end
63
-
64
- # Verifies a proposed keyword attribute.
65
- #
66
- # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method.
67
- # @param [#to_s] value the proposed keyword attribute
68
- # @raise [ArgumentError] if given an unexpected keyword
69
- #
70
- def keyword=(value)
71
- value = value.to_s.upcase
72
- raise ArgumentError, "Invalid keyword. Expected '#{@keyword}', got #{value}." unless value == @keyword
73
- end
74
-
75
- # Sets up a record by parsing a RTPConnect string line.
76
- #
77
- # @param [#to_s] string the extended treatment field definition record string line
78
- # @return [Record] the updated Record instance
79
- # @raise [ArgumentError] if given a string containing an invalid number of elements
80
- #
81
- def load(string, options={})
82
- # Extract processed values:
83
- values = string.to_s.values(options[:repair])
84
- raise ArgumentError, "Invalid argument 'string': Expected at least #{@min_elements} elements for #{@keyword}, got #{values.length}." if values.length < @min_elements
85
- RTP.logger.warn "The number of given elements (#{values.length}) exceeds the known number of data elements for this record (#{@max_elements}). This may indicate an invalid string record or that the RTP format has recently been expanded with new elements." if values.length > @max_elements
86
- self.send(:set_attributes, values)
87
- self
88
- end
89
-
90
- # Returns self.
91
- #
92
- # @return [Record] self
93
- #
94
- def to_record
95
- self
96
- end
97
-
98
- # Collects the values (attributes) of this instance.
99
- #
100
- # @note The CRC is not considered part of the actual values and is excluded.
101
- # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
102
- #
103
- def values
104
- @attributes.collect {|attribute| self.send(attribute)}
105
- end
106
-
107
-
108
- private
109
-
110
-
111
- # Sets the attributes of the record instance.
112
- #
113
- # @param [Array<String>] values the record attributes (as parsed from a record string)
114
- #
115
- def set_attributes(values)
116
- ([values.length - 1, @max_elements - 1].min).times do |i|
117
- self.send("#{@attributes[i]}=", values[i])
118
- end
119
- @crc = values[-1]
120
- end
121
-
122
- # Removes any attributes that are newer than the given compatibility target version.
123
- # E.g. if a compatibility version of Mosaiq 2.4 is specified, attributes that were
124
- # introduced in Mosaiq 2.5 or later is removed before the RTP string is created.
125
- #
126
- # @param [Array<String>] values the complete set of values of this record
127
- # @param [Hash] options an optional hash parameter
128
- # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
129
- # @return [Array<String>] an array of attributes where some of the recent attributes may have been removed
130
- #
131
- def discard_unsupported_attributes(values, options={})
132
- case self
133
- when SiteSetup
134
- options[:version].to_f >= 2.6 ? values : values[0..-4]
135
- when ExtendedField
136
- options[:version].to_f >= 2.4 ? values : values[0..-5]
137
- else
138
- values
139
- end
140
- end
141
-
142
- end
143
-
1
+ module RTP
2
+
3
+ # The Record class contains attributes and methods that are common
4
+ # for the various record types defined in the RTPConnect standard.
5
+ #
6
+ class Record
7
+
8
+ # For most record types, there are no surplus (grouped) attributes.
9
+ NR_SURPLUS_ATTRIBUTES = 0
10
+
11
+ # An array of the record's attributes.
12
+ attr_reader :attributes
13
+ # The keyword defines the record type of a particular RTP string line.
14
+ attr_reader :keyword
15
+ # The CRC is used to validate the integrity of the content of the RTP string line.
16
+ attr_reader :crc
17
+
18
+ # Creates a new Record.
19
+ #
20
+ # @param [String] keyword the keyword which identifies this record
21
+ # @param [Integer] min_elements the minimum number of data elements required for this record
22
+ # @param [Integer] max_elements the maximum supported number of data elements for this record
23
+ #
24
+ def initialize(keyword, min_elements, max_elements)
25
+ @keyword = keyword
26
+ @min_elements = min_elements
27
+ @max_elements = max_elements
28
+ end
29
+
30
+ # Sets the crc (checksum) attribute.
31
+ #
32
+ # @note This value is not used when creating an RTP string from a record (a new crc is calculated)
33
+ # @param [#to_s] value the new attribute value
34
+ #
35
+ def crc=(value)
36
+ @crc = value.to_s
37
+ end
38
+
39
+ # Encodes a string from the contents of this instance.
40
+ #
41
+ # This produces the full record string line, including a computed CRC checksum.
42
+ #
43
+ # @param [Hash] options an optional hash parameter
44
+ # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
45
+ # @return [String] a proper RTPConnect type CSV string
46
+ #
47
+ def encode(options={})
48
+ encoded_values = values.collect {|v| v && v.encode('ISO8859-1')}
49
+ encoded_values = discard_unsupported_attributes(encoded_values, options) if options[:version]
50
+ content = CSV.generate_line(encoded_values, force_quotes: true, row_sep: '') + ","
51
+ checksum = content.checksum
52
+ # Complete string is content + checksum (in double quotes) + carriage return + line feed
53
+ return (content + checksum.to_s.wrap + "\r\n").encode('ISO8859-1')
54
+ end
55
+
56
+ # Follows the tree of parents until the appropriate parent of the requesting record is found.
57
+ #
58
+ # @param [Record] last_parent the previous parent (the record from the previous line in the RTP file)
59
+ # @param [Record] klass the expected parent record class of this record (e.g. Plan, Field)
60
+ #
61
+ def get_parent(last_parent, klass)
62
+ if last_parent.is_a?(klass)
63
+ return last_parent
64
+ else
65
+ return last_parent.get_parent(last_parent.parent, klass)
66
+ end
67
+ end
68
+
69
+ # Verifies a proposed keyword attribute.
70
+ #
71
+ # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method.
72
+ # @param [#to_s] value the proposed keyword attribute
73
+ # @raise [ArgumentError] if given an unexpected keyword
74
+ #
75
+ def keyword=(value)
76
+ value = value.to_s.upcase
77
+ raise ArgumentError, "Invalid keyword. Expected '#{@keyword}', got #{value}." unless value == @keyword
78
+ end
79
+
80
+ # Sets up a record by parsing a RTPConnect string line.
81
+ #
82
+ # @param [#to_s] string the extended treatment field definition record string line
83
+ # @return [Record] the updated Record instance
84
+ # @raise [ArgumentError] if given a string containing an invalid number of elements
85
+ #
86
+ def load(string, options={})
87
+ # Extract processed values:
88
+ values = string.to_s.values(options[:repair])
89
+ raise ArgumentError, "Invalid argument 'string': Expected at least #{@min_elements} elements for #{@keyword}, got #{values.length}." if values.length < @min_elements
90
+ RTP.logger.warn "The number of given elements (#{values.length}) exceeds the known number of data elements for this record (#{@max_elements}). This may indicate an invalid string record or that the RTP format has recently been expanded with new elements." if values.length > @max_elements
91
+ self.send(:set_attributes, values)
92
+ self
93
+ end
94
+
95
+ # Returns self.
96
+ #
97
+ # @return [Record] self
98
+ #
99
+ def to_record
100
+ self
101
+ end
102
+
103
+ # Encodes the record + any hiearchy of child objects,
104
+ # to a properly formatted RTPConnect ascii string.
105
+ #
106
+ # @param [Hash] options an optional hash parameter
107
+ # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
108
+ # @return [String] an RTP string with a single or multiple lines/records
109
+ #
110
+ def to_s(options={})
111
+ str = encode(options)
112
+ children.each do |child|
113
+ # Note that the extended plan record was introduced in Mosaiq 2.5.
114
+ str += child.to_s(options) unless child.class == ExtendedPlan && options[:version].to_f < 2.5
115
+ end
116
+ str
117
+ end
118
+
119
+ alias :to_str :to_s
120
+
121
+ # Collects the values (attributes) of this instance.
122
+ #
123
+ # @note The CRC is not considered part of the actual values and is excluded.
124
+ # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
125
+ #
126
+ def values
127
+ @attributes.collect {|attribute| self.send(attribute)}
128
+ end
129
+
130
+
131
+ private
132
+
133
+
134
+ # Removes the reference of the given instance from the attribute of this record.
135
+ #
136
+ # @param [Symbol] attribute the name of the child attribute from which to remove a child
137
+ # @param [Record] instance a child record to be removed from this instance
138
+ #
139
+ def delete_child(attribute, instance=nil)
140
+ if self.send(attribute).is_a?(Array)
141
+ deleted = self.send(attribute).delete(instance)
142
+ deleted.parent = nil if deleted
143
+ else
144
+ self.send(attribute).parent = nil if self.send(attribute)
145
+ self.instance_variable_set("@#{attribute}", nil)
146
+ end
147
+ end
148
+
149
+ # Removes all child references of the given type from this instance.
150
+ #
151
+ # @param [Symbol] attribute the name of the child attribute to be cleared
152
+ #
153
+ def delete_children(attribute)
154
+ self.send(attribute).each { |c| c.parent = nil }
155
+ self.send(attribute).clear
156
+ end
157
+
158
+ # Sets the attributes of the record instance.
159
+ #
160
+ # @param [Array<String>] values the record attributes (as parsed from a record string)
161
+ #
162
+ def set_attributes(values)
163
+ import_indices([values.length - 1, @max_elements - 1].min).each_with_index do |indices, i|
164
+ param = values.values_at(*indices)
165
+ param = param[0] if param.length == 1
166
+ self.send("#{@attributes[i]}=", param)
167
+ end
168
+ @crc = values[-1]
169
+ end
170
+
171
+ # Gives an array of indices indicating where the attributes of this record gets its
172
+ # values from in the comma separated string which the instance is created from.
173
+ #
174
+ # @param [Integer] length the number of elements to create in the indices array
175
+ #
176
+ def import_indices(length)
177
+ Array.new(length - NR_SURPLUS_ATTRIBUTES) { |i| [i] }
178
+ end
179
+
180
+ # Removes any attributes that are newer than the given compatibility target version.
181
+ # E.g. if a compatibility version of Mosaiq 2.4 is specified, attributes that were
182
+ # introduced in Mosaiq 2.5 or later is removed before the RTP string is created.
183
+ #
184
+ # @param [Array<String>] values the complete set of values of this record
185
+ # @param [Hash] options an optional hash parameter
186
+ # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
187
+ # @return [Array<String>] an array of attributes where some of the recent attributes may have been removed
188
+ #
189
+ def discard_unsupported_attributes(values, options={})
190
+ case self
191
+ when SiteSetup
192
+ options[:version].to_f >= 2.6 ? values : values[0..-4]
193
+ when ExtendedField
194
+ options[:version].to_f >= 2.4 ? values : values[0..-5]
195
+ else
196
+ values
197
+ end
198
+ end
199
+
200
+ end
201
+
144
202
  end
@@ -1,626 +1,607 @@
1
- module RTP
2
-
3
- # The simulation field class.
4
- #
5
- # @note Relations:
6
- # * Parent: Prescription
7
- # * Children: none
8
- #
9
- class SimulationField < Record
10
-
11
- # The Record which this instance belongs to.
12
- attr_reader :parent
13
- attr_reader :rx_site_name
14
- attr_reader :field_name
15
- attr_reader :field_id
16
- attr_reader :field_note
17
- attr_reader :treatment_machine
18
- attr_reader :gantry_angle
19
- attr_reader :collimator_angle
20
- attr_reader :field_x_mode
21
- attr_reader :field_x
22
- attr_reader :collimator_x1
23
- attr_reader :collimator_x2
24
- attr_reader :field_y_mode
25
- attr_reader :field_y
26
- attr_reader :collimator_y1
27
- attr_reader :collimator_y2
28
- attr_reader :couch_vertical
29
- attr_reader :couch_lateral
30
- attr_reader :couch_longitudinal
31
- attr_reader :couch_angle
32
- attr_reader :couch_pedestal
33
- attr_reader :sad
34
- attr_reader :ap_separation
35
- attr_reader :pa_separation
36
- attr_reader :lateral_separation
37
- attr_reader :tangential_separation
38
- attr_reader :other_label_1
39
- attr_reader :ssd_1
40
- attr_reader :sfd_1
41
- attr_reader :other_label_2
42
- attr_reader :other_measurement_1
43
- attr_reader :other_measurement_2
44
- attr_reader :other_label_3
45
- attr_reader :other_measurement_3
46
- attr_reader :other_measurement_4
47
- attr_reader :other_label_4
48
- attr_reader :other_measurement_5
49
- attr_reader :other_measurement_6
50
- attr_reader :blade_x_mode
51
- attr_reader :blade_x
52
- attr_reader :blade_x1
53
- attr_reader :blade_x2
54
- attr_reader :blade_y_mode
55
- attr_reader :blade_y
56
- attr_reader :blade_y1
57
- attr_reader :blade_y2
58
- attr_reader :ii_lateral
59
- attr_reader :ii_longitudinal
60
- attr_reader :ii_vertical
61
- attr_reader :kvp
62
- attr_reader :ma
63
- attr_reader :seconds
64
-
65
- # Creates a new SimulationField by parsing a RTPConnect string line.
66
- #
67
- # @param [#to_s] string the simulation field definition record string line
68
- # @param [Record] parent a record which is used to determine the proper parent of this instance
69
- # @return [Field] the created SimulationField instance
70
- # @raise [ArgumentError] if given a string containing an invalid number of elements
71
- #
72
- def self.load(string, parent)
73
- sf = self.new(parent)
74
- sf.load(string)
75
- end
76
-
77
- # Creates a new SimulationField.
78
- #
79
- # @param [Record] parent a record which is used to determine the proper parent of this instance
80
- #
81
- def initialize(parent)
82
- super('SIM_DEF', 17, 53)
83
- # Parent relation (may get more than one type of record here):
84
- @parent = get_parent(parent.to_record, Prescription)
85
- @parent.add_simulation_field(self)
86
- @attributes = [
87
- # Required:
88
- :keyword,
89
- :rx_site_name,
90
- :field_name,
91
- :field_id,
92
- :field_note,
93
- :treatment_machine,
94
- :gantry_angle,
95
- :collimator_angle,
96
- :field_x_mode,
97
- :field_x,
98
- :collimator_x1,
99
- :collimator_x2,
100
- :field_y_mode,
101
- :field_y,
102
- :collimator_y1,
103
- :collimator_y2,
104
- # Optional:
105
- :couch_vertical,
106
- :couch_lateral,
107
- :couch_longitudinal,
108
- :couch_angle,
109
- :couch_pedestal,
110
- :sad,
111
- :ap_separation,
112
- :pa_separation,
113
- :lateral_separation,
114
- :tangential_separation,
115
- :other_label_1,
116
- :ssd_1,
117
- :sfd_1,
118
- :other_label_2,
119
- :other_measurement_1,
120
- :other_measurement_2,
121
- :other_label_3,
122
- :other_measurement_3,
123
- :other_measurement_4,
124
- :other_label_4,
125
- :other_measurement_5,
126
- :other_measurement_6,
127
- :blade_x_mode,
128
- :blade_x,
129
- :blade_x1,
130
- :blade_x2,
131
- :blade_y_mode,
132
- :blade_y,
133
- :blade_y1,
134
- :blade_y2,
135
- :ii_lateral,
136
- :ii_longitudinal,
137
- :ii_vertical,
138
- :kvp,
139
- :ma,
140
- :seconds
141
- ]
142
- end
143
-
144
- # Checks for equality.
145
- #
146
- # Other and self are considered equivalent if they are
147
- # of compatible types and their attributes are equivalent.
148
- #
149
- # @param other an object to be compared with self.
150
- # @return [Boolean] true if self and other are considered equivalent
151
- #
152
- def ==(other)
153
- if other.respond_to?(:to_simulation_field)
154
- other.send(:state) == state
155
- end
156
- end
157
-
158
- alias_method :eql?, :==
159
-
160
- # Collects the child records of this instance in a properly sorted array.
161
- #
162
- # @return [Array] an emtpy array
163
- #
164
- def children
165
- return Array.new
166
- end
167
-
168
- # Computes a hash code for this object.
169
- #
170
- # @note Two objects with the same attributes will have the same hash code.
171
- #
172
- # @return [Fixnum] the object's hash code
173
- #
174
- def hash
175
- state.hash
176
- end
177
-
178
- # Returns self.
179
- #
180
- # @return [SimulationField] self
181
- #
182
- def to_simulation_field
183
- self
184
- end
185
-
186
- # Encodes the SimulationField object + any hiearchy of child objects,
187
- # to a properly formatted RTPConnect ascii string.
188
- #
189
- # @param [Hash] options an optional hash parameter
190
- # @option options [Float] :version the Mosaiq compatibility version number (e.g. 2.4) used for the output
191
- # @return [String] an RTP string with a single or multiple lines/records
192
- #
193
- def to_s(options={})
194
- str = encode(options)
195
- if children
196
- children.each do |child|
197
- str += child.to_s(options)
198
- end
199
- end
200
- return str
201
- end
202
-
203
- alias :to_str :to_s
204
-
205
- # Sets the rx_site_name attribute.
206
- #
207
- # @param [nil, #to_s] value the new attribute value
208
- #
209
- def rx_site_name=(value)
210
- @rx_site_name = value && value.to_s
211
- end
212
-
213
- # Sets the field_name attribute.
214
- #
215
- # @param [nil, #to_s] value the new attribute value
216
- #
217
- def field_name=(value)
218
- @field_name = value && value.to_s
219
- end
220
-
221
- # Sets the field_id attribute.
222
- #
223
- # @param [nil, #to_s] value the new attribute value
224
- #
225
- def field_id=(value)
226
- @field_id = value && value.to_s
227
- end
228
-
229
- # Sets the field_note attribute.
230
- #
231
- # @param [nil, #to_s] value the new attribute value
232
- #
233
- def field_note=(value)
234
- @field_note = value && value.to_s
235
- end
236
-
237
- # Sets the treatment_machine attribute.
238
- #
239
- # @param [nil, #to_s] value the new attribute value
240
- #
241
- def treatment_machine=(value)
242
- @treatment_machine = value && value.to_s
243
- end
244
-
245
- # Sets the gantry_angle attribute.
246
- #
247
- # @param [nil, #to_s] value the new attribute value
248
- #
249
- def gantry_angle=(value)
250
- @gantry_angle = value && value.to_s.strip
251
- end
252
-
253
- # Sets the collimator_angle attribute.
254
- #
255
- # @param [nil, #to_s] value the new attribute value
256
- #
257
- def collimator_angle=(value)
258
- @collimator_angle = value && value.to_s.strip
259
- end
260
-
261
- # Sets the field_x_mode attribute.
262
- #
263
- # @param [nil, #to_s] value the new attribute value
264
- #
265
- def field_x_mode=(value)
266
- @field_x_mode = value && value.to_s
267
- end
268
-
269
- # Sets the field_x attribute.
270
- #
271
- # @param [nil, #to_s] value the new attribute value
272
- #
273
- def field_x=(value)
274
- @field_x = value && value.to_s.strip
275
- end
276
-
277
- # Sets the collimator_x1 attribute.
278
- #
279
- # @param [nil, #to_s] value the new attribute value
280
- #
281
- def collimator_x1=(value)
282
- @collimator_x1 = value && value.to_s.strip
283
- end
284
-
285
- # Sets the collimator_x2 attribute.
286
- #
287
- # @param [nil, #to_s] value the new attribute value
288
- #
289
- def collimator_x2=(value)
290
- @collimator_x2 = value && value.to_s.strip
291
- end
292
-
293
- # Sets the field_y_mode attribute.
294
- #
295
- # @param [nil, #to_s] value the new attribute value
296
- #
297
- def field_y_mode=(value)
298
- @field_y_mode = value && value.to_s
299
- end
300
-
301
- # Sets the field_y attribute.
302
- #
303
- # @param [nil, #to_s] value the new attribute value
304
- #
305
- def field_y=(value)
306
- @field_y = value && value.to_s.strip
307
- end
308
-
309
- # Sets the collimator_y1 attribute.
310
- #
311
- # @param [nil, #to_s] value the new attribute value
312
- #
313
- def collimator_y1=(value)
314
- @collimator_y1 = value && value.to_s.strip
315
- end
316
-
317
- # Sets the collimator_y2 attribute.
318
- #
319
- # @param [nil, #to_s] value the new attribute value
320
- #
321
- def collimator_y2=(value)
322
- @collimator_y2 = value && value.to_s.strip
323
- end
324
-
325
- # Sets the couch_vertical attribute.
326
- #
327
- # @param [nil, #to_s] value the new attribute value
328
- #
329
- def couch_vertical=(value)
330
- @couch_vertical = value && value.to_s.strip
331
- end
332
-
333
- # Sets the couch_lateral attribute.
334
- #
335
- # @param [nil, #to_s] value the new attribute value
336
- #
337
- def couch_lateral=(value)
338
- @couch_lateral = value && value.to_s.strip
339
- end
340
-
341
- # Sets the couch_longitudinal attribute.
342
- #
343
- # @param [nil, #to_s] value the new attribute value
344
- #
345
- def couch_longitudinal=(value)
346
- @couch_longitudinal = value && value.to_s.strip
347
- end
348
-
349
- # Sets the couch_angle attribute.
350
- #
351
- # @param [nil, #to_s] value the new attribute value
352
- #
353
- def couch_angle=(value)
354
- @couch_angle = value && value.to_s.strip.strip
355
- end
356
-
357
- # Sets the couch_pedestal attribute.
358
- #
359
- # @param [nil, #to_s] value the new attribute value
360
- #
361
- def couch_pedestal=(value)
362
- @couch_pedestal = value && value.to_s.strip
363
- end
364
-
365
- # Sets the sad attribute.
366
- #
367
- # @param [nil, #to_s] value the new attribute value
368
- #
369
- def sad=(value)
370
- @sad = value && value.to_s.strip
371
- end
372
-
373
- # Sets the ap_separation attribute.
374
- #
375
- # @param [nil, #to_s] value the new attribute value
376
- #
377
- def ap_separation=(value)
378
- @ap_separation = value && value.to_s
379
- end
380
-
381
- # Sets the pa_separation attribute.
382
- #
383
- # @param [nil, #to_s] value the new attribute value
384
- #
385
- def pa_separation=(value)
386
- @pa_separation = value && value.to_s.strip
387
- end
388
-
389
- # Sets the lateral_separation attribute.
390
- #
391
- # @param [nil, #to_s] value the new attribute value
392
- #
393
- def lateral_separation=(value)
394
- @lateral_separation = value && value.to_s.strip
395
- end
396
-
397
- # Sets the tangential_separation attribute.
398
- #
399
- # @param [nil, #to_s] value the new attribute value
400
- #
401
- def tangential_separation=(value)
402
- @tangential_separation = value && value.to_s.strip
403
- end
404
-
405
- # Sets the other_label_1 attribute.
406
- #
407
- # @param [nil, #to_s] value the new attribute value
408
- #
409
- def other_label_1=(value)
410
- @other_label_1 = value && value.to_s
411
- end
412
-
413
- # Sets the ssd_1 attribute.
414
- #
415
- # @param [nil, #to_s] value the new attribute value
416
- #
417
- def ssd_1=(value)
418
- @ssd_1 = value && value.to_s
419
- end
420
-
421
- # Sets the sfd_1 attribute.
422
- #
423
- # @param [nil, #to_s] value the new attribute value
424
- #
425
- def sfd_1=(value)
426
- @sfd_1 = value && value.to_s
427
- end
428
-
429
- # Sets the other_label_2 attribute.
430
- #
431
- # @param [nil, #to_s] value the new attribute value
432
- #
433
- def other_label_2=(value)
434
- @other_label_2 = value && value.to_s
435
- end
436
-
437
- # Sets the other_measurement_1 attribute.
438
- #
439
- # @param [nil, #to_s] value the new attribute value
440
- #
441
- def other_measurement_1=(value)
442
- @other_measurement_1 = value && value.to_s
443
- end
444
-
445
- # Sets the other_measurement_2 attribute.
446
- #
447
- # @param [nil, #to_s] value the new attribute value
448
- #
449
- def other_measurement_2=(value)
450
- @other_measurement_2 = value && value.to_s
451
- end
452
-
453
- # Sets the other_label_3 attribute.
454
- #
455
- # @param [nil, #to_s] value the new attribute value
456
- #
457
- def other_label_3=(value)
458
- @other_label_3 = value && value.to_s
459
- end
460
-
461
- # Sets the other_measurement_3 attribute.
462
- #
463
- # @param [nil, #to_s] value the new attribute value
464
- #
465
- def other_measurement_3=(value)
466
- @other_measurement_3 = value && value.to_s
467
- end
468
-
469
- # Sets the other_measurement_4 attribute.
470
- #
471
- # @param [nil, #to_s] value the new attribute value
472
- #
473
- def other_measurement_4=(value)
474
- @other_measurement_4 = value && value.to_s
475
- end
476
-
477
- # Sets the other_label_4 attribute.
478
- #
479
- # @param [nil, #to_s] value the new attribute value
480
- #
481
- def other_label_4=(value)
482
- @other_label_4 = value && value.to_s
483
- end
484
-
485
- # Sets the other_measurement_5 attribute.
486
- #
487
- # @param [nil, #to_s] value the new attribute value
488
- #
489
- def other_measurement_5=(value)
490
- @other_measurement_5 = value && value.to_s
491
- end
492
-
493
- # Sets the other_measurement_6 attribute.
494
- #
495
- # @param [nil, #to_s] value the new attribute value
496
- #
497
- def other_measurement_6=(value)
498
- @other_measurement_6 = value && value.to_s
499
- end
500
-
501
- # Sets the blade_x_mode attribute.
502
- #
503
- # @param [nil, #to_s] value the new attribute value
504
- #
505
- def blade_x_mode=(value)
506
- @blade_x_mode = value && value.to_s
507
- end
508
-
509
- # Sets the blade_x attribute.
510
- #
511
- # @param [nil, #to_s] value the new attribute value
512
- #
513
- def blade_x=(value)
514
- @blade_x = value && value.to_s
515
- end
516
-
517
- # Sets the blade_x1 attribute.
518
- #
519
- # @param [nil, #to_s] value the new attribute value
520
- #
521
- def blade_x1=(value)
522
- @blade_x1 = value && value.to_s
523
- end
524
-
525
- # Sets the blade_x2 attribute.
526
- #
527
- # @param [nil, #to_s] value the new attribute value
528
- #
529
- def blade_x2=(value)
530
- @blade_x2 = value && value.to_s
531
- end
532
-
533
- # Sets the blade_y_mode attribute.
534
- #
535
- # @param [nil, #to_s] value the new attribute value
536
- #
537
- def blade_y_mode=(value)
538
- @blade_y_mode = value && value.to_s
539
- end
540
-
541
- # Sets the blade_y attribute.
542
- #
543
- # @param [nil, #to_s] value the new attribute value
544
- #
545
- def blade_y=(value)
546
- @blade_y = value && value.to_s
547
- end
548
-
549
- # Sets the blade_y1 attribute.
550
- #
551
- # @param [nil, #to_s] value the new attribute value
552
- #
553
- def blade_y1=(value)
554
- @blade_y1 = value && value.to_s
555
- end
556
-
557
- # Sets the blade_y2 attribute.
558
- #
559
- # @param [nil, #to_s] value the new attribute value
560
- #
561
- def blade_y2=(value)
562
- @blade_y2 = value && value.to_s
563
- end
564
-
565
- # Sets the ii_lateral attribute.
566
- #
567
- # @param [nil, #to_s] value the new attribute value
568
- #
569
- def ii_lateral=(value)
570
- @ii_lateral = value && value.to_s
571
- end
572
-
573
- # Sets the ii_longitudinal attribute.
574
- #
575
- # @param [nil, #to_s] value the new attribute value
576
- #
577
- def ii_longitudinal=(value)
578
- @ii_longitudinal = value && value.to_s
579
- end
580
-
581
- # Sets the ii_vertical attribute.
582
- #
583
- # @param [nil, #to_s] value the new attribute value
584
- #
585
- def ii_vertical=(value)
586
- @ii_vertical = value && value.to_s
587
- end
588
-
589
- # Sets the kvp attribute.
590
- #
591
- # @param [nil, #to_s] value the new attribute value
592
- #
593
- def kvp=(value)
594
- @kvp = value && value.to_s
595
- end
596
-
597
- # Sets the ma attribute.
598
- #
599
- # @param [nil, #to_s] value the new attribute value
600
- #
601
- def ma=(value)
602
- @ma = value && value.to_s
603
- end
604
-
605
- # Sets the seconds attribute.
606
- #
607
- # @param [nil, #to_s] value the new attribute value
608
- #
609
- def seconds=(value)
610
- @seconds = value && value.to_s
611
- end
612
-
613
-
614
- private
615
-
616
-
617
- # Collects the attributes of this instance.
618
- #
619
- # @note The CRC is not considered part of the attributes of interest and is excluded
620
- # @return [Array<String>] an array of attributes
621
- #
622
- alias_method :state, :values
623
-
624
- end
625
-
1
+ module RTP
2
+
3
+ # The simulation field class.
4
+ #
5
+ # @note Relations:
6
+ # * Parent: Prescription
7
+ # * Children: none
8
+ #
9
+ class SimulationField < Record
10
+
11
+ # The Record which this instance belongs to.
12
+ attr_accessor :parent
13
+ attr_reader :rx_site_name
14
+ attr_reader :field_name
15
+ attr_reader :field_id
16
+ attr_reader :field_note
17
+ attr_reader :treatment_machine
18
+ attr_reader :gantry_angle
19
+ attr_reader :collimator_angle
20
+ attr_reader :field_x_mode
21
+ attr_reader :field_x
22
+ attr_reader :collimator_x1
23
+ attr_reader :collimator_x2
24
+ attr_reader :field_y_mode
25
+ attr_reader :field_y
26
+ attr_reader :collimator_y1
27
+ attr_reader :collimator_y2
28
+ attr_reader :couch_vertical
29
+ attr_reader :couch_lateral
30
+ attr_reader :couch_longitudinal
31
+ attr_reader :couch_angle
32
+ attr_reader :couch_pedestal
33
+ attr_reader :sad
34
+ attr_reader :ap_separation
35
+ attr_reader :pa_separation
36
+ attr_reader :lateral_separation
37
+ attr_reader :tangential_separation
38
+ attr_reader :other_label_1
39
+ attr_reader :ssd_1
40
+ attr_reader :sfd_1
41
+ attr_reader :other_label_2
42
+ attr_reader :other_measurement_1
43
+ attr_reader :other_measurement_2
44
+ attr_reader :other_label_3
45
+ attr_reader :other_measurement_3
46
+ attr_reader :other_measurement_4
47
+ attr_reader :other_label_4
48
+ attr_reader :other_measurement_5
49
+ attr_reader :other_measurement_6
50
+ attr_reader :blade_x_mode
51
+ attr_reader :blade_x
52
+ attr_reader :blade_x1
53
+ attr_reader :blade_x2
54
+ attr_reader :blade_y_mode
55
+ attr_reader :blade_y
56
+ attr_reader :blade_y1
57
+ attr_reader :blade_y2
58
+ attr_reader :ii_lateral
59
+ attr_reader :ii_longitudinal
60
+ attr_reader :ii_vertical
61
+ attr_reader :kvp
62
+ attr_reader :ma
63
+ attr_reader :seconds
64
+
65
+ # Creates a new SimulationField by parsing a RTPConnect string line.
66
+ #
67
+ # @param [#to_s] string the simulation field definition record string line
68
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
69
+ # @return [Field] the created SimulationField instance
70
+ # @raise [ArgumentError] if given a string containing an invalid number of elements
71
+ #
72
+ def self.load(string, parent)
73
+ sf = self.new(parent)
74
+ sf.load(string)
75
+ end
76
+
77
+ # Creates a new SimulationField.
78
+ #
79
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
80
+ #
81
+ def initialize(parent)
82
+ super('SIM_DEF', 17, 53)
83
+ # Parent relation (may get more than one type of record here):
84
+ @parent = get_parent(parent.to_record, Prescription)
85
+ @parent.add_simulation_field(self)
86
+ @attributes = [
87
+ # Required:
88
+ :keyword,
89
+ :rx_site_name,
90
+ :field_name,
91
+ :field_id,
92
+ :field_note,
93
+ :treatment_machine,
94
+ :gantry_angle,
95
+ :collimator_angle,
96
+ :field_x_mode,
97
+ :field_x,
98
+ :collimator_x1,
99
+ :collimator_x2,
100
+ :field_y_mode,
101
+ :field_y,
102
+ :collimator_y1,
103
+ :collimator_y2,
104
+ # Optional:
105
+ :couch_vertical,
106
+ :couch_lateral,
107
+ :couch_longitudinal,
108
+ :couch_angle,
109
+ :couch_pedestal,
110
+ :sad,
111
+ :ap_separation,
112
+ :pa_separation,
113
+ :lateral_separation,
114
+ :tangential_separation,
115
+ :other_label_1,
116
+ :ssd_1,
117
+ :sfd_1,
118
+ :other_label_2,
119
+ :other_measurement_1,
120
+ :other_measurement_2,
121
+ :other_label_3,
122
+ :other_measurement_3,
123
+ :other_measurement_4,
124
+ :other_label_4,
125
+ :other_measurement_5,
126
+ :other_measurement_6,
127
+ :blade_x_mode,
128
+ :blade_x,
129
+ :blade_x1,
130
+ :blade_x2,
131
+ :blade_y_mode,
132
+ :blade_y,
133
+ :blade_y1,
134
+ :blade_y2,
135
+ :ii_lateral,
136
+ :ii_longitudinal,
137
+ :ii_vertical,
138
+ :kvp,
139
+ :ma,
140
+ :seconds
141
+ ]
142
+ end
143
+
144
+ # Checks for equality.
145
+ #
146
+ # Other and self are considered equivalent if they are
147
+ # of compatible types and their attributes are equivalent.
148
+ #
149
+ # @param other an object to be compared with self.
150
+ # @return [Boolean] true if self and other are considered equivalent
151
+ #
152
+ def ==(other)
153
+ if other.respond_to?(:to_simulation_field)
154
+ other.send(:state) == state
155
+ end
156
+ end
157
+
158
+ alias_method :eql?, :==
159
+
160
+ # Collects the child records of this instance in a properly sorted array.
161
+ #
162
+ # @return [Array] an emtpy array
163
+ #
164
+ def children
165
+ return Array.new
166
+ end
167
+
168
+ # Computes a hash code for this object.
169
+ #
170
+ # @note Two objects with the same attributes will have the same hash code.
171
+ #
172
+ # @return [Fixnum] the object's hash code
173
+ #
174
+ def hash
175
+ state.hash
176
+ end
177
+
178
+ # Returns self.
179
+ #
180
+ # @return [SimulationField] self
181
+ #
182
+ def to_simulation_field
183
+ self
184
+ end
185
+
186
+ # Sets the rx_site_name attribute.
187
+ #
188
+ # @param [nil, #to_s] value the new attribute value
189
+ #
190
+ def rx_site_name=(value)
191
+ @rx_site_name = value && value.to_s
192
+ end
193
+
194
+ # Sets the field_name attribute.
195
+ #
196
+ # @param [nil, #to_s] value the new attribute value
197
+ #
198
+ def field_name=(value)
199
+ @field_name = value && value.to_s
200
+ end
201
+
202
+ # Sets the field_id attribute.
203
+ #
204
+ # @param [nil, #to_s] value the new attribute value
205
+ #
206
+ def field_id=(value)
207
+ @field_id = value && value.to_s
208
+ end
209
+
210
+ # Sets the field_note attribute.
211
+ #
212
+ # @param [nil, #to_s] value the new attribute value
213
+ #
214
+ def field_note=(value)
215
+ @field_note = value && value.to_s
216
+ end
217
+
218
+ # Sets the treatment_machine attribute.
219
+ #
220
+ # @param [nil, #to_s] value the new attribute value
221
+ #
222
+ def treatment_machine=(value)
223
+ @treatment_machine = value && value.to_s
224
+ end
225
+
226
+ # Sets the gantry_angle attribute.
227
+ #
228
+ # @param [nil, #to_s] value the new attribute value
229
+ #
230
+ def gantry_angle=(value)
231
+ @gantry_angle = value && value.to_s.strip
232
+ end
233
+
234
+ # Sets the collimator_angle attribute.
235
+ #
236
+ # @param [nil, #to_s] value the new attribute value
237
+ #
238
+ def collimator_angle=(value)
239
+ @collimator_angle = value && value.to_s.strip
240
+ end
241
+
242
+ # Sets the field_x_mode attribute.
243
+ #
244
+ # @param [nil, #to_s] value the new attribute value
245
+ #
246
+ def field_x_mode=(value)
247
+ @field_x_mode = value && value.to_s
248
+ end
249
+
250
+ # Sets the field_x attribute.
251
+ #
252
+ # @param [nil, #to_s] value the new attribute value
253
+ #
254
+ def field_x=(value)
255
+ @field_x = value && value.to_s.strip
256
+ end
257
+
258
+ # Sets the collimator_x1 attribute.
259
+ #
260
+ # @param [nil, #to_s] value the new attribute value
261
+ #
262
+ def collimator_x1=(value)
263
+ @collimator_x1 = value && value.to_s.strip
264
+ end
265
+
266
+ # Sets the collimator_x2 attribute.
267
+ #
268
+ # @param [nil, #to_s] value the new attribute value
269
+ #
270
+ def collimator_x2=(value)
271
+ @collimator_x2 = value && value.to_s.strip
272
+ end
273
+
274
+ # Sets the field_y_mode attribute.
275
+ #
276
+ # @param [nil, #to_s] value the new attribute value
277
+ #
278
+ def field_y_mode=(value)
279
+ @field_y_mode = value && value.to_s
280
+ end
281
+
282
+ # Sets the field_y attribute.
283
+ #
284
+ # @param [nil, #to_s] value the new attribute value
285
+ #
286
+ def field_y=(value)
287
+ @field_y = value && value.to_s.strip
288
+ end
289
+
290
+ # Sets the collimator_y1 attribute.
291
+ #
292
+ # @param [nil, #to_s] value the new attribute value
293
+ #
294
+ def collimator_y1=(value)
295
+ @collimator_y1 = value && value.to_s.strip
296
+ end
297
+
298
+ # Sets the collimator_y2 attribute.
299
+ #
300
+ # @param [nil, #to_s] value the new attribute value
301
+ #
302
+ def collimator_y2=(value)
303
+ @collimator_y2 = value && value.to_s.strip
304
+ end
305
+
306
+ # Sets the couch_vertical attribute.
307
+ #
308
+ # @param [nil, #to_s] value the new attribute value
309
+ #
310
+ def couch_vertical=(value)
311
+ @couch_vertical = value && value.to_s.strip
312
+ end
313
+
314
+ # Sets the couch_lateral attribute.
315
+ #
316
+ # @param [nil, #to_s] value the new attribute value
317
+ #
318
+ def couch_lateral=(value)
319
+ @couch_lateral = value && value.to_s.strip
320
+ end
321
+
322
+ # Sets the couch_longitudinal attribute.
323
+ #
324
+ # @param [nil, #to_s] value the new attribute value
325
+ #
326
+ def couch_longitudinal=(value)
327
+ @couch_longitudinal = value && value.to_s.strip
328
+ end
329
+
330
+ # Sets the couch_angle attribute.
331
+ #
332
+ # @param [nil, #to_s] value the new attribute value
333
+ #
334
+ def couch_angle=(value)
335
+ @couch_angle = value && value.to_s.strip.strip
336
+ end
337
+
338
+ # Sets the couch_pedestal attribute.
339
+ #
340
+ # @param [nil, #to_s] value the new attribute value
341
+ #
342
+ def couch_pedestal=(value)
343
+ @couch_pedestal = value && value.to_s.strip
344
+ end
345
+
346
+ # Sets the sad attribute.
347
+ #
348
+ # @param [nil, #to_s] value the new attribute value
349
+ #
350
+ def sad=(value)
351
+ @sad = value && value.to_s.strip
352
+ end
353
+
354
+ # Sets the ap_separation attribute.
355
+ #
356
+ # @param [nil, #to_s] value the new attribute value
357
+ #
358
+ def ap_separation=(value)
359
+ @ap_separation = value && value.to_s
360
+ end
361
+
362
+ # Sets the pa_separation attribute.
363
+ #
364
+ # @param [nil, #to_s] value the new attribute value
365
+ #
366
+ def pa_separation=(value)
367
+ @pa_separation = value && value.to_s.strip
368
+ end
369
+
370
+ # Sets the lateral_separation attribute.
371
+ #
372
+ # @param [nil, #to_s] value the new attribute value
373
+ #
374
+ def lateral_separation=(value)
375
+ @lateral_separation = value && value.to_s.strip
376
+ end
377
+
378
+ # Sets the tangential_separation attribute.
379
+ #
380
+ # @param [nil, #to_s] value the new attribute value
381
+ #
382
+ def tangential_separation=(value)
383
+ @tangential_separation = value && value.to_s.strip
384
+ end
385
+
386
+ # Sets the other_label_1 attribute.
387
+ #
388
+ # @param [nil, #to_s] value the new attribute value
389
+ #
390
+ def other_label_1=(value)
391
+ @other_label_1 = value && value.to_s
392
+ end
393
+
394
+ # Sets the ssd_1 attribute.
395
+ #
396
+ # @param [nil, #to_s] value the new attribute value
397
+ #
398
+ def ssd_1=(value)
399
+ @ssd_1 = value && value.to_s
400
+ end
401
+
402
+ # Sets the sfd_1 attribute.
403
+ #
404
+ # @param [nil, #to_s] value the new attribute value
405
+ #
406
+ def sfd_1=(value)
407
+ @sfd_1 = value && value.to_s
408
+ end
409
+
410
+ # Sets the other_label_2 attribute.
411
+ #
412
+ # @param [nil, #to_s] value the new attribute value
413
+ #
414
+ def other_label_2=(value)
415
+ @other_label_2 = value && value.to_s
416
+ end
417
+
418
+ # Sets the other_measurement_1 attribute.
419
+ #
420
+ # @param [nil, #to_s] value the new attribute value
421
+ #
422
+ def other_measurement_1=(value)
423
+ @other_measurement_1 = value && value.to_s
424
+ end
425
+
426
+ # Sets the other_measurement_2 attribute.
427
+ #
428
+ # @param [nil, #to_s] value the new attribute value
429
+ #
430
+ def other_measurement_2=(value)
431
+ @other_measurement_2 = value && value.to_s
432
+ end
433
+
434
+ # Sets the other_label_3 attribute.
435
+ #
436
+ # @param [nil, #to_s] value the new attribute value
437
+ #
438
+ def other_label_3=(value)
439
+ @other_label_3 = value && value.to_s
440
+ end
441
+
442
+ # Sets the other_measurement_3 attribute.
443
+ #
444
+ # @param [nil, #to_s] value the new attribute value
445
+ #
446
+ def other_measurement_3=(value)
447
+ @other_measurement_3 = value && value.to_s
448
+ end
449
+
450
+ # Sets the other_measurement_4 attribute.
451
+ #
452
+ # @param [nil, #to_s] value the new attribute value
453
+ #
454
+ def other_measurement_4=(value)
455
+ @other_measurement_4 = value && value.to_s
456
+ end
457
+
458
+ # Sets the other_label_4 attribute.
459
+ #
460
+ # @param [nil, #to_s] value the new attribute value
461
+ #
462
+ def other_label_4=(value)
463
+ @other_label_4 = value && value.to_s
464
+ end
465
+
466
+ # Sets the other_measurement_5 attribute.
467
+ #
468
+ # @param [nil, #to_s] value the new attribute value
469
+ #
470
+ def other_measurement_5=(value)
471
+ @other_measurement_5 = value && value.to_s
472
+ end
473
+
474
+ # Sets the other_measurement_6 attribute.
475
+ #
476
+ # @param [nil, #to_s] value the new attribute value
477
+ #
478
+ def other_measurement_6=(value)
479
+ @other_measurement_6 = value && value.to_s
480
+ end
481
+
482
+ # Sets the blade_x_mode attribute.
483
+ #
484
+ # @param [nil, #to_s] value the new attribute value
485
+ #
486
+ def blade_x_mode=(value)
487
+ @blade_x_mode = value && value.to_s
488
+ end
489
+
490
+ # Sets the blade_x attribute.
491
+ #
492
+ # @param [nil, #to_s] value the new attribute value
493
+ #
494
+ def blade_x=(value)
495
+ @blade_x = value && value.to_s
496
+ end
497
+
498
+ # Sets the blade_x1 attribute.
499
+ #
500
+ # @param [nil, #to_s] value the new attribute value
501
+ #
502
+ def blade_x1=(value)
503
+ @blade_x1 = value && value.to_s
504
+ end
505
+
506
+ # Sets the blade_x2 attribute.
507
+ #
508
+ # @param [nil, #to_s] value the new attribute value
509
+ #
510
+ def blade_x2=(value)
511
+ @blade_x2 = value && value.to_s
512
+ end
513
+
514
+ # Sets the blade_y_mode attribute.
515
+ #
516
+ # @param [nil, #to_s] value the new attribute value
517
+ #
518
+ def blade_y_mode=(value)
519
+ @blade_y_mode = value && value.to_s
520
+ end
521
+
522
+ # Sets the blade_y attribute.
523
+ #
524
+ # @param [nil, #to_s] value the new attribute value
525
+ #
526
+ def blade_y=(value)
527
+ @blade_y = value && value.to_s
528
+ end
529
+
530
+ # Sets the blade_y1 attribute.
531
+ #
532
+ # @param [nil, #to_s] value the new attribute value
533
+ #
534
+ def blade_y1=(value)
535
+ @blade_y1 = value && value.to_s
536
+ end
537
+
538
+ # Sets the blade_y2 attribute.
539
+ #
540
+ # @param [nil, #to_s] value the new attribute value
541
+ #
542
+ def blade_y2=(value)
543
+ @blade_y2 = value && value.to_s
544
+ end
545
+
546
+ # Sets the ii_lateral attribute.
547
+ #
548
+ # @param [nil, #to_s] value the new attribute value
549
+ #
550
+ def ii_lateral=(value)
551
+ @ii_lateral = value && value.to_s
552
+ end
553
+
554
+ # Sets the ii_longitudinal attribute.
555
+ #
556
+ # @param [nil, #to_s] value the new attribute value
557
+ #
558
+ def ii_longitudinal=(value)
559
+ @ii_longitudinal = value && value.to_s
560
+ end
561
+
562
+ # Sets the ii_vertical attribute.
563
+ #
564
+ # @param [nil, #to_s] value the new attribute value
565
+ #
566
+ def ii_vertical=(value)
567
+ @ii_vertical = value && value.to_s
568
+ end
569
+
570
+ # Sets the kvp attribute.
571
+ #
572
+ # @param [nil, #to_s] value the new attribute value
573
+ #
574
+ def kvp=(value)
575
+ @kvp = value && value.to_s
576
+ end
577
+
578
+ # Sets the ma attribute.
579
+ #
580
+ # @param [nil, #to_s] value the new attribute value
581
+ #
582
+ def ma=(value)
583
+ @ma = value && value.to_s
584
+ end
585
+
586
+ # Sets the seconds attribute.
587
+ #
588
+ # @param [nil, #to_s] value the new attribute value
589
+ #
590
+ def seconds=(value)
591
+ @seconds = value && value.to_s
592
+ end
593
+
594
+
595
+ private
596
+
597
+
598
+ # Collects the attributes of this instance.
599
+ #
600
+ # @note The CRC is not considered part of the attributes of interest and is excluded
601
+ # @return [Array<String>] an array of attributes
602
+ #
603
+ alias_method :state, :values
604
+
605
+ end
606
+
626
607
  end