Class: BaseDataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/data/base_data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(startOffset = 0) ⇒ BaseDataSource



4
5
6
7
# File 'lib/data/base_data_source.rb', line 4

def initialize(startOffset = 0)
  @nextDataSource = nil
  @startOffset = startOffset
end

Instance Attribute Details

#startOffsetObject

Returns the value of attribute startOffset.



2
3
4
# File 'lib/data/base_data_source.rb', line 2

def startOffset
  @startOffset
end

Instance Method Details

#each_with_index(offset = 0) ⇒ Object



9
10
11
12
13
14
# File 'lib/data/base_data_source.rb', line 9

def each_with_index(offset = 0)
  while ((value = self.valueAt(offset)) != nil) do
    yield value, offset
    offset += 1
  end
end

#extendWith(dataSource, startOffset) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/data/base_data_source.rb', line 16

def extendWith(dataSource, startOffset)
  if (@nextDataSource == nil) then
    @nextDataSource = dataSource
    dataSource.startOffset = startOffset
  else
    @nextDataSource.extendWith(dataSource, startOffset)
  end
end

#has_terminator?Boolean



25
26
27
# File 'lib/data/base_data_source.rb', line 25

def has_terminator?
  false
end

#nextDataSourceValueAt(offset) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/data/base_data_source.rb', line 29

def nextDataSourceValueAt(offset)
  if (@nextDataSource != nil) then
    return @nextDataSource.valueAt(offset)
  else
    return nil
  end
end

#valueSequence(startOffset, endOffset) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/data/base_data_source.rb', line 37

def valueSequence(startOffset, endOffset)
  result = ""
  (startOffset..endOffset).each do |offset|
    result += self.valueAt(offset)
  end
  result
end