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.



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

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.



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

def context_note
  @context_note
end

#enforcementObject

Returns the value of attribute enforcement.



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

def enforcement
  @enforcement
end

#maxObject (readonly)

Returns the value of attribute max.



1106
1107
1108
# File 'lib/activefacts/cql/compiler/clause.rb', line 1106

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



1106
1107
1108
# File 'lib/activefacts/cql/compiler/clause.rb', line 1106

def min
  @min
end

#pragmasObject

Returns the value of attribute pragmas.



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

def pragmas
  @pragmas
end

Instance Method Details

#inspectObject



1128
1129
1130
1131
1132
# File 'lib/activefacts/cql/compiler/clause.rb', line 1128

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

#is_mandatoryObject



1120
1121
1122
# File 'lib/activefacts/cql/compiler/clause.rb', line 1120

def is_mandatory
  @min and @min >= 1
end

#is_uniqueObject



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

def is_unique
  @max and @max == 1
end

#is_zeroObject



1124
1125
1126
# File 'lib/activefacts/cql/compiler/clause.rb', line 1124

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