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

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

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.



1049
1050
1051
1052
1053
1054
# File 'lib/activefacts/cql/compiler/clause.rb', line 1049

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.



1046
1047
1048
# File 'lib/activefacts/cql/compiler/clause.rb', line 1046

def context_note
  @context_note
end

#enforcementObject

Returns the value of attribute enforcement.



1045
1046
1047
# File 'lib/activefacts/cql/compiler/clause.rb', line 1045

def enforcement
  @enforcement
end

#maxObject (readonly)

Returns the value of attribute max.



1047
1048
1049
# File 'lib/activefacts/cql/compiler/clause.rb', line 1047

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



1047
1048
1049
# File 'lib/activefacts/cql/compiler/clause.rb', line 1047

def min
  @min
end

Instance Method Details

#inspectObject



1068
1069
1070
1071
1072
# File 'lib/activefacts/cql/compiler/clause.rb', line 1068

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

#is_mandatoryObject



1060
1061
1062
# File 'lib/activefacts/cql/compiler/clause.rb', line 1060

def is_mandatory
  @min and @min >= 1
end

#is_uniqueObject



1056
1057
1058
# File 'lib/activefacts/cql/compiler/clause.rb', line 1056

def is_unique
  @max and @max == 1
end

#is_zeroObject



1064
1065
1066
# File 'lib/activefacts/cql/compiler/clause.rb', line 1064

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