Class: ActiveFacts::CQL::Compiler::Quantifier

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

Overview

REVISIT: This needs to handle annotations for some/that/which, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(min, max, enforcement = nil, context_note = nil, pragmas = nil) ⇒ Quantifier

Returns a new instance of Quantifier.



1152
1153
1154
1155
1156
1157
1158
# File 'lib/activefacts/cql/compiler/clause.rb', line 1152

def initialize min, max, enforcement = nil, context_note = nil, pragmas = nil
  @min = min
  @max = max
  @enforcement = enforcement
  @context_note = context_note
  @pragmas = pragmas
end

Instance Attribute Details

#context_noteObject

Returns the value of attribute context_note.



1148
1149
1150
# File 'lib/activefacts/cql/compiler/clause.rb', line 1148

def context_note
  @context_note
end

#enforcementObject

Returns the value of attribute enforcement.



1147
1148
1149
# File 'lib/activefacts/cql/compiler/clause.rb', line 1147

def enforcement
  @enforcement
end

#maxObject

Returns the value of attribute max.



1150
1151
1152
# File 'lib/activefacts/cql/compiler/clause.rb', line 1150

def max
  @max
end

#minObject

Returns the value of attribute min.



1150
1151
1152
# File 'lib/activefacts/cql/compiler/clause.rb', line 1150

def min
  @min
end

#pragmasObject

Returns the value of attribute pragmas.



1149
1150
1151
# File 'lib/activefacts/cql/compiler/clause.rb', line 1149

def pragmas
  @pragmas
end

Instance Method Details

#inspectObject



1172
1173
1174
1175
1176
# File 'lib/activefacts/cql/compiler/clause.rb', line 1172

def inspect
  "[#{@min}..#{@max}]#{
    @context_note && ' ' + @context_note.inspect
  }"
end

#is_mandatoryObject



1164
1165
1166
# File 'lib/activefacts/cql/compiler/clause.rb', line 1164

def is_mandatory
  @min and @min >= 1
end

#is_uniqueObject



1160
1161
1162
# File 'lib/activefacts/cql/compiler/clause.rb', line 1160

def is_unique
  @max and @max == 1
end

#is_zeroObject



1168
1169
1170
# File 'lib/activefacts/cql/compiler/clause.rb', line 1168

def is_zero
  @min == 0 and @max == 0
end