Sha256: e242e68a67eb2b28be34e08ca3088b8942a1879841d887f5c4d16f36d089334e

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

module Alf
  module Engine
    module Cesure

      # (see Cog#each)
      def each(&receiver)
        dup._each(&receiver)
      end

      protected

      # (see Cog#each)
      def _each(&receiver)
        prev_key = nil
        operand.each do |tuple|
          cur_key = project(tuple)
          if cur_key != prev_key
            flush_cesure(prev_key, receiver) if prev_key
            start_cesure(cur_key, receiver)
            prev_key = cur_key
          end
          accumulate_cesure(tuple, receiver)
        end
        flush_cesure(prev_key, receiver) if prev_key
      end

      # Projects a given tuple and returns it's cesure projection
      def project(tuple)
      end
      
      # Callback fired every time a new block starts
      def start_cesure(key, receiver)
      end

      # Callback fired on each tuple of the current block 
      def accumulate_cesure(tuple, receiver)
      end

      # Callback fired at end of a block
      def flush_cesure(key, receiver)
      end

    end # module Cesure
  end # module Operator
end # module Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 lib/alf-engine/alf/engine/cesure.rb
alf-0.12.1 lib/alf-engine/alf/engine/cesure.rb
alf-0.12.0 lib/alf-engine/alf/engine/cesure.rb
alf-0.11.1 lib/alf-engine/alf/engine/cesure.rb
alf-0.11.0 lib/alf-engine/alf/engine/cesure.rb