Class: RTP::ExtendedField

Inherits:
Record
  • Object
show all
Defined in:
lib/rtp-connect/extended_field.rb

Overview

Note:

Relations:

  • Parent: Field

  • Children: none

The ExtendedField class.

Constant Summary

Constants inherited from Record

Record::NR_SURPLUS_ATTRIBUTES

Instance Attribute Summary collapse

Attributes inherited from Record

#attributes, #crc, #keyword

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Record

#encode, #get_parent, #load, #to_record, #to_s, #values

Constructor Details

#initialize(parent) ⇒ ExtendedField

Creates a new (treatment) ExtendedField.

Parameters:

  • parent (Record)

    a record which is used to determine the proper parent of this instance



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rtp-connect/extended_field.rb', line 40

def initialize(parent)
  super('EXTENDED_FIELD_DEF', 4, 12)
  # Parent relation (may get more than one type of record here):
  @parent = get_parent(parent.to_record, Field)
  @parent.add_extended_field(self)
  @attributes = [
    # Required:
    :keyword,
    :field_id,
    :original_plan_uid,
    # Optional:
    :original_beam_number,
    :original_beam_name,
    :is_fff,
    :accessory_code,
    :accessory_type,
    :high_dose_authorization,
    :referenced_rt_plan_uid,
    :referenced_rt_plan_relationship
  ]
end

Instance Attribute Details

#accessory_codeObject

Returns the value of attribute accessory_code.



18
19
20
# File 'lib/rtp-connect/extended_field.rb', line 18

def accessory_code
  @accessory_code
end

#accessory_typeObject

Returns the value of attribute accessory_type.



19
20
21
# File 'lib/rtp-connect/extended_field.rb', line 19

def accessory_type
  @accessory_type
end

#field_idObject

Returns the value of attribute field_id.



13
14
15
# File 'lib/rtp-connect/extended_field.rb', line 13

def field_id
  @field_id
end

#high_dose_authorizationObject

Returns the value of attribute high_dose_authorization.



20
21
22
# File 'lib/rtp-connect/extended_field.rb', line 20

def high_dose_authorization
  @high_dose_authorization
end

#is_fffObject

Returns the value of attribute is_fff.



17
18
19
# File 'lib/rtp-connect/extended_field.rb', line 17

def is_fff
  @is_fff
end

#original_beam_nameObject

Returns the value of attribute original_beam_name.



16
17
18
# File 'lib/rtp-connect/extended_field.rb', line 16

def original_beam_name
  @original_beam_name
end

#original_beam_numberObject

Returns the value of attribute original_beam_number.



15
16
17
# File 'lib/rtp-connect/extended_field.rb', line 15

def original_beam_number
  @original_beam_number
end

#original_plan_uidObject

Returns the value of attribute original_plan_uid.



14
15
16
# File 'lib/rtp-connect/extended_field.rb', line 14

def original_plan_uid
  @original_plan_uid
end

#parentObject

The Record which this instance belongs to.



12
13
14
# File 'lib/rtp-connect/extended_field.rb', line 12

def parent
  @parent
end

#referenced_rt_plan_relationshipObject

Returns the value of attribute referenced_rt_plan_relationship.



22
23
24
# File 'lib/rtp-connect/extended_field.rb', line 22

def referenced_rt_plan_relationship
  @referenced_rt_plan_relationship
end

#referenced_rt_plan_uidObject

Returns the value of attribute referenced_rt_plan_uid.



21
22
23
# File 'lib/rtp-connect/extended_field.rb', line 21

def referenced_rt_plan_uid
  @referenced_rt_plan_uid
end

Class Method Details

.load(string, parent) ⇒ ExtendedField

Creates a new (treatment) ExtendedField by parsing a RTPConnect string line.

Parameters:

  • string (#to_s)

    the extended treatment field definition record string line

  • parent (Record)

    a record which is used to determine the proper parent of this instance

Returns:

Raises:

  • (ArgumentError)

    if given a string containing an invalid number of elements



31
32
33
34
# File 'lib/rtp-connect/extended_field.rb', line 31

def self.load(string, parent)
  ef = self.new(parent)
  ef.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.

Parameters:

  • other

    an object to be compared with self.

Returns:

  • (Boolean)

    true if self and other are considered equivalent



70
71
72
73
74
# File 'lib/rtp-connect/extended_field.rb', line 70

def ==(other)
  if other.respond_to?(:to_extended_field)
    other.send(:state) == state
  end
end

#childrenArray

Gives an empty array, as these instances are child-less by definition.

Returns:

  • (Array)

    an emtpy array



82
83
84
# File 'lib/rtp-connect/extended_field.rb', line 82

def children
  return Array.new
end

#hashFixnum

Note:

Two objects with the same attributes will have the same hash code.

Computes a hash code for this object.

Returns:

  • (Fixnum)

    the object’s hash code



92
93
94
# File 'lib/rtp-connect/extended_field.rb', line 92

def hash
  state.hash
end

#to_extended_fieldExtendedField

Returns self.

Returns:



100
101
102
# File 'lib/rtp-connect/extended_field.rb', line 100

def to_extended_field
  self
end