Class: ActiveFacts::CQL::Compiler::Negate

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) ⇒ Negate

Returns a new instance of Negate.



378
379
380
# File 'lib/activefacts/cql/compiler/expression.rb', line 378

def initialize term
  @term = term
end

Instance Attribute Details

#termObject

Returns the value of attribute term.



377
378
379
# File 'lib/activefacts/cql/compiler/expression.rb', line 377

def term
  @term
end

Instance Method Details

#compile(context) ⇒ Object



400
401
402
403
404
405
406
# File 'lib/activefacts/cql/compiler/expression.rb', line 400

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



386
387
388
389
390
391
392
# File 'lib/activefacts/cql/compiler/expression.rb', line 386

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

#inspectObject



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

def inspect; to_s; end

#operatorObject



382
383
384
# File 'lib/activefacts/cql/compiler/expression.rb', line 382

def operator
  '0-'
end

#to_sObject



396
397
398
# File 'lib/activefacts/cql/compiler/expression.rb', line 396

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