Class: RTP::DoseTracking
- Defined in:
- lib/rtp-connect/dose_tracking.rb
Overview
Relations:
-
Parent: Plan
-
Children: none
The DoseTracking class.
Constant Summary collapse
- NR_SURPLUS_ATTRIBUTES =
The number of attributes not having their own variable for this record (20 - 2).
18
Instance Attribute Summary collapse
-
#actual_dose ⇒ Object
Returns the value of attribute actual_dose.
-
#actual_fractions ⇒ Object
Returns the value of attribute actual_fractions.
-
#dose_actions ⇒ Object
readonly
The DoseAction records (if any) that belongs to this DoseTracking.
-
#field_ids ⇒ Object
Note: This attribute contains an array of all field_id values (1..10).
-
#parent ⇒ Object
The Record which this instance belongs to.
-
#region_coeffs ⇒ Object
Note: This attribute contains an array of all reg_coeff values (1..10).
-
#region_name ⇒ Object
Returns the value of attribute region_name.
-
#region_prior_dose ⇒ Object
Returns the value of attribute region_prior_dose.
Attributes inherited from Record
Class Method Summary collapse
-
.load(string, parent) ⇒ DoseTracking
Creates a new DoseTracking by parsing a RTPConnect string line.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Checks for equality.
-
#children ⇒ Array
As of now, gives an empty array.
-
#hash ⇒ Fixnum
Computes a hash code for this object.
-
#initialize(parent) ⇒ DoseTracking
constructor
Creates a new DoseTracking.
-
#to_dose_tracking ⇒ DoseTracking
Returns self.
-
#values ⇒ Array<String>
(also: #state)
Collects the values (attributes) of this instance.
Methods inherited from Record
#encode, #get_parent, #load, #to_record, #to_s
Constructor Details
#initialize(parent) ⇒ DoseTracking
Creates a new DoseTracking.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rtp-connect/dose_tracking.rb', line 43 def initialize(parent) super('DOSE_DEF', 24, 26) # Child records: @dose_actions = Array.new # Parent relation (may get more than one type of record here): @parent = get_parent(parent.to_record, Plan) @parent.add_dose_tracking(self) @field_ids = Array.new(10) @region_coeffs = Array.new(10) @attributes = [ # Required: :keyword, :region_name, :region_prior_dose, :field_ids, :region_coeffs, # Optional: :actual_dose, :actual_fractions ] end |
Instance Attribute Details
#actual_dose ⇒ Object
Returns the value of attribute actual_dose.
24 25 26 |
# File 'lib/rtp-connect/dose_tracking.rb', line 24 def actual_dose @actual_dose end |
#actual_fractions ⇒ Object
Returns the value of attribute actual_fractions.
25 26 27 |
# File 'lib/rtp-connect/dose_tracking.rb', line 25 def actual_fractions @actual_fractions end |
#dose_actions ⇒ Object (readonly)
The DoseAction records (if any) that belongs to this DoseTracking.
17 18 19 |
# File 'lib/rtp-connect/dose_tracking.rb', line 17 def dose_actions @dose_actions end |
#field_ids ⇒ Object
Note: This attribute contains an array of all field_id values (1..10).
21 22 23 |
# File 'lib/rtp-connect/dose_tracking.rb', line 21 def field_ids @field_ids end |
#parent ⇒ Object
The Record which this instance belongs to.
15 16 17 |
# File 'lib/rtp-connect/dose_tracking.rb', line 15 def parent @parent end |
#region_coeffs ⇒ Object
Note: This attribute contains an array of all reg_coeff values (1..10).
23 24 25 |
# File 'lib/rtp-connect/dose_tracking.rb', line 23 def region_coeffs @region_coeffs end |
#region_name ⇒ Object
Returns the value of attribute region_name.
18 19 20 |
# File 'lib/rtp-connect/dose_tracking.rb', line 18 def region_name @region_name end |
#region_prior_dose ⇒ Object
Returns the value of attribute region_prior_dose.
19 20 21 |
# File 'lib/rtp-connect/dose_tracking.rb', line 19 def region_prior_dose @region_prior_dose end |
Class Method Details
.load(string, parent) ⇒ DoseTracking
Creates a new DoseTracking by parsing a RTPConnect string line.
34 35 36 37 |
# File 'lib/rtp-connect/dose_tracking.rb', line 34 def self.load(string, parent) d = self.new(parent) d.load(string) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Checks for equality.
Other and self are considered equivalent if they are of compatible types and their attributes are equivalent.
73 74 75 76 77 |
# File 'lib/rtp-connect/dose_tracking.rb', line 73 def ==(other) if other.respond_to?(:to_dose_tracking) other.send(:state) == state end end |
#children ⇒ Array
As of now, gives an empty array. However, by definition, this record may have dose action (point) records as children, but this is not implemented yet.
86 87 88 89 |
# File 'lib/rtp-connect/dose_tracking.rb', line 86 def children #return @dose_actions return Array.new end |
#hash ⇒ Fixnum
Two objects with the same attributes will have the same hash code.
Computes a hash code for this object.
97 98 99 |
# File 'lib/rtp-connect/dose_tracking.rb', line 97 def hash state.hash end |
#to_dose_tracking ⇒ DoseTracking
Returns self.
122 123 124 |
# File 'lib/rtp-connect/dose_tracking.rb', line 122 def to_dose_tracking self end |
#values ⇒ Array<String> Also known as: state
The CRC is not considered part of the actual values and is excluded.
Collects the values (attributes) of this instance.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rtp-connect/dose_tracking.rb', line 106 def values [ @keyword, @region_name, @region_prior_dose, # Need to join every other two elements from these two arrays together: *@field_ids.zip(@region_coeffs).flatten, @actual_dose, @actual_fractions ] end |