def composed_validation( is_required, existential, universal, both )
list_existential = join_names(existential, 'or')
list_universal = join_names(universal, 'and')
list_both = join_names(both, 'and')
if is_required and universal.empty? and both.empty? then
prefix = 'exactly'
aux = 'must'
else
prefix = 'either'
aux = 'may'
end
msg = "#{prefix} "
unless existential.empty? then
msg << "one of #{list_existential} #{aux} be bound"
if (universal.empty? == false) or (both.empty? == false) then
msg << ', or '
end
end
unless both.empty? then
msg << "both of #{list_universal} #{aux} be bound"
if (both.empty? == false) then
msg << ', or '
end
end
unless both.empty? then
msg << "either or both of #{list_both} #{aux} be bound"
end
msg << '.'
if is_required then
Validation.new(msg, required_condition(existential, universal, both))
else
Validation.new(msg, any_condition(existential, universal, both))
end
end