class Bmg::Operator::NotMatching

NotMatching operator.

Filters tuples of left operand to those matching no tuple in right operand.

Attributes

on[R]

Public Class Methods

new(type, left, right, on) click to toggle source
# File lib/bmg/operator/not_matching.rb, line 12
def initialize(type, left, right, on)
  @type = type
  @left = left
  @right = right
  @on = on
end

Public Instance Methods

each() { |tuple| ... } click to toggle source
# File lib/bmg/operator/not_matching.rb, line 25
def each
  return to_enum unless block_given?
  index = Hash.new
  right.each_with_object(index) do |t, index|
    key = tuple_project(t, on)
    index[key] = true
  end
  left.each do |tuple|
    key = tuple_project(tuple, on)
    yield tuple unless index.has_key?(key)
  end
end
to_ast() click to toggle source
# File lib/bmg/operator/not_matching.rb, line 38
def to_ast
  [ :not_matching, left.to_ast, right.to_ast, on ]
end