Class: OpenEHR::AM::Archetype::ConstraintModel::Cardinality

Inherits:
Object
  • Object
show all
Defined in:
lib/open_ehr/am/archetype/constraint_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = { }) ⇒ Cardinality

Returns a new instance of Cardinality.



51
52
53
54
55
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 51

def initialize(args = { })
  @interval = args[:interval]
  @is_ordered = args[:is_ordered]
  @is_unique = args[:is_unique]
end

Instance Attribute Details

#intervalObject

Returns the value of attribute interval.



49
50
51
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 49

def interval
  @interval
end

#is_orderedObject

Returns the value of attribute is_ordered.



49
50
51
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 49

def is_ordered
  @is_ordered
end

#is_uniqueObject

Returns the value of attribute is_unique.



49
50
51
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 49

def is_unique
  @is_unique
end

Instance Method Details

#is_bag?Boolean Also known as: bag?

Returns:

  • (Boolean)


81
82
83
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 81

def is_bag?
  return !@is_ordered && !@is_unique
end

#is_list?Boolean Also known as: list?

Returns:

  • (Boolean)


75
76
77
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 75

def is_list?
  return @is_ordered && !@is_unique
end

#is_ordered?Boolean Also known as: ordered?

Returns:

  • (Boolean)


57
58
59
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 57

def is_ordered?
  return @is_ordered
end

#is_set?Boolean Also known as: set?

Returns:

  • (Boolean)


69
70
71
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 69

def is_set?
  return !@is_ordered && @is_unique
end

#is_unique?Boolean Also known as: unique?

Returns:

  • (Boolean)


63
64
65
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 63

def is_unique?
  return @is_unique
end