Class: TorQML::DataSources::MatrixDataSource_rb

Inherits:
DataSource_rb show all
Defined in:
lib/torqml/datasources/matrixdatasource.rb

Overview

Base class of matrix type data sources.

Direct Known Subclasses

CSVDataSource_rb

Instance Method Summary collapse

Methods inherited from DataSource_rb

#currentFrame

Instance Method Details

#rowsInteger

Returns the number of rows.

Returns:

  • (Integer)

    the number of rows



29
30
31
# File 'lib/torqml/datasources/matrixdatasource.rb', line 29

def rows
  @data.length
end

#value_at(index) ⇒ Float

Returns the current frame value at column index.

Parameters:

  • index (Integer)

    index

Returns:

  • (Float)

    the current frame value at column index



17
18
19
20
21
22
23
24
# File 'lib/torqml/datasources/matrixdatasource.rb', line 17

def value_at(index)
  if @data.nil?
    raise "data not initialized"
    0
  else
    @data[currentFrame.to_i - 1][index.to_i]
  end
end