Class: TorQML::DataSources::LinearDataSource_rb
- Inherits:
-
DataSource_rb
- Object
- DataSource_rb
- TorQML::DataSources::LinearDataSource_rb
- Includes:
- QML::Access
- Defined in:
- lib/torqml/datasources/lineardatasource.rb
Overview
Data source class to provide simple linear data. This class is useful when testing some models without preparing time-series data files.
Instance Method Summary collapse
-
#dataSize ⇒ Integer
The size of data.
-
#dataStep ⇒ Float
The value step against index.
-
#prepare_data ⇒ Object
Prepare data to provide.
-
#rows ⇒ Integer
Returns the number of rows.
-
#value_at(index) ⇒ Float
Returns the current frame value.
Methods inherited from DataSource_rb
Instance Method Details
#dataSize ⇒ Integer
Returns the size of data.
16 |
# File 'lib/torqml/datasources/lineardatasource.rb', line 16 property(:dataSize) { 0 } |
#dataStep ⇒ Float
Returns the value step against index.
18 |
# File 'lib/torqml/datasources/lineardatasource.rb', line 18 property(:dataStep) { 0 } |
#prepare_data ⇒ Object
Prepare data to provide.
21 22 23 24 25 |
# File 'lib/torqml/datasources/lineardatasource.rb', line 21 def prepare_data @data = Array.new(self.dataSize) do |i| i * self.dataStep end end |
#rows ⇒ Integer
Returns the number of rows.
39 40 41 |
# File 'lib/torqml/datasources/lineardatasource.rb', line 39 def rows @data.length end |
#value_at(index) ⇒ Float
Returns the current frame value. Return value is not dependent on index argument.
32 33 34 |
# File 'lib/torqml/datasources/lineardatasource.rb', line 32 def value_at(index) @data[currentFrame.to_i - 1] end |