Class: MetaData::VisMetaData

Inherits:
RubyUtils::MetaData
  • Object
show all
Defined in:
lib/data/meta_data.rb

Overview

class to store the meta information of a data series

Raises:

  • (IndexError)

    if the number of provided parameters has not the correct size

See Also:

  • meta information format

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#domain_xDataDomain (readonly)

Returns informations of the x-dimension.

Returns:

  • (DataDomain)

    informations of the x-dimension



20
21
22
# File 'lib/data/meta_data.rb', line 20

def domain_x
  @domain_x
end

#domain_yDataDomain (readonly)

Returns informations of the y-dimension.

Returns:

  • (DataDomain)

    informations of the y-dimension



22
23
24
# File 'lib/data/meta_data.rb', line 22

def domain_y
  @domain_y
end

#domain_zDataDomain (readonly)

Returns informations of the y-dimension.

Returns:

  • (DataDomain)

    informations of the y-dimension



24
25
26
# File 'lib/data/meta_data.rb', line 24

def domain_z
  @domain_z
end

#nameString (readonly)

Returns the name of the data.

Returns:

  • (String)

    the name of the data



18
19
20
# File 'lib/data/meta_data.rb', line 18

def name
  @name
end

Instance Method Details

#check_and_create_third_domain(metadata) ⇒ Object (private)

method to check if the meta data array contains information for a third dimension and read these data if available

Parameters:

  • metadata (Array)

    the array with the meta data information



58
59
60
61
62
63
64
65
# File 'lib/data/meta_data.rb', line 58

def check_and_create_third_domain()
  if (.length == 13)
    @domain_z = DataDomain.new([9], [10], \
                   [11], [12])
  else
    @domain_z = nil
  end
end

#check_element_size(size) ⇒ Object (private)

method to check the correct number of parameters for the meta data

Parameters:

  • size (Integer)

    the size of the metadata array

Raises:

  • (IndexError)

    if the number of provided parameters has not the correct size



48
49
50
51
52
53
# File 'lib/data/meta_data.rb', line 48

def check_element_size(size)
  if !(size == 13 || size == 9)
    raise IndexError, " Error in meta data: incorrect number of" \
              " arguments: #{size}.".red
  end
end

#parse_header(header_line) ⇒ Object (private)

method which parses the required meta information from the head line relevant meta information

Parameters:

  • header_line (Object)

    the head line of a data set holding the



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/data/meta_data.rb', line 32

def parse_header(header_line)
  check_element_size(header_line.length)

  @name = header_line[0]
  @domain_x = DataDomain.new(header_line[1], header_line[2], \
                 header_line[3], header_line[4])
  @domain_y = DataDomain.new(header_line[5], header_line[6], \
                 header_line[7], header_line[8])

  check_and_create_third_domain(header_line)
end