def self.mk_compound_filter(parts)
if !parts.respond_to?('each')
raise TypeError, "#{parts.inspect} is not iterable"
end
transformers = []
filters = []
parts.each { |subfilter|
if !subfilter.is_a?(Array)
if subfilter.respond_to?('get_service_endpoints')
filters << subfilter
elsif subfilter.respond_to?('from_basic_service_endpoint')
transformers << subfilter.method('from_basic_service_endpoint')
elsif subfilter.respond_to?('call')
transformers << subfilter
else
raise @@filter_type_error
end
else
filters << mk_compound_filter(subfilter)
end
}
if transformers.length > 0
filters << TransformFilterMaker.new(transformers)
end
if filters.length == 1
return filters[0]
else
return CompoundFilter.new(filters)
end
end