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

Returns a new instance of Quantifier.



1102
1103
1104
1105
1106
1107
# File 'lib/activefacts/cql/compiler/clause.rb', line 1102

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

Instance Attribute Details

#context_noteObject

Returns the value of attribute context_note.



1099
1100
1101
# File 'lib/activefacts/cql/compiler/clause.rb', line 1099

def context_note
  @context_note
end

#enforcementObject

Returns the value of attribute enforcement.



1098
1099
1100
# File 'lib/activefacts/cql/compiler/clause.rb', line 1098

def enforcement
  @enforcement
end

#maxObject (readonly)

Returns the value of attribute max.



1100
1101
1102
# File 'lib/activefacts/cql/compiler/clause.rb', line 1100

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



1100
1101
1102
# File 'lib/activefacts/cql/compiler/clause.rb', line 1100

def min
  @min
end

Instance Method Details

#inspectObject



1121
1122
1123
1124
1125
# File 'lib/activefacts/cql/compiler/clause.rb', line 1121

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

#is_mandatoryObject



1113
1114
1115
# File 'lib/activefacts/cql/compiler/clause.rb', line 1113

def is_mandatory
  @min and @min >= 1
end

#is_uniqueObject



1109
1110
1111
# File 'lib/activefacts/cql/compiler/clause.rb', line 1109

def is_unique
  @max and @max == 1
end

#is_zeroObject



1117
1118
1119
# File 'lib/activefacts/cql/compiler/clause.rb', line 1117

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