Class: ActiveFacts::CQL::Compiler::Negation

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/cql/compiler/expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(term) ⇒ Negation

Returns a new instance of Negation.



411
412
413
# File 'lib/activefacts/cql/compiler/expression.rb', line 411

def initialize term
  @term = term
end

Instance Attribute Details

#termObject

Returns the value of attribute term.



410
411
412
# File 'lib/activefacts/cql/compiler/expression.rb', line 410

def term
  @term
end

Instance Method Details

#compile(context) ⇒ Object



433
434
435
436
437
438
439
# File 'lib/activefacts/cql/compiler/expression.rb', line 433

def compile(context)
  op1 = @term.compile(context)
  context.vocabulary.constellation.Expression(
      :new, :expression_type => 'Unary', :operator => operator,
      :first_operand_expression => op1
  )
end

#identify_player(context) ⇒ Object



419
420
421
422
423
424
425
# File 'lib/activefacts/cql/compiler/expression.rb', line 419

def identify_player context
  @player || begin
    # The player in @term have already been identified
    v = context.vocabulary
    @player = @term.player
  end
end

#inspectObject



427
# File 'lib/activefacts/cql/compiler/expression.rb', line 427

def inspect; to_s; end

#operatorObject



415
416
417
# File 'lib/activefacts/cql/compiler/expression.rb', line 415

def operator
  'not'
end

#to_sObject



429
430
431
# File 'lib/activefacts/cql/compiler/expression.rb', line 429

def to_s
  "NEGATION(#{term.to_s})"
end