ClamAV 0.96.5 > >> How does tiles know which definition to use? Is there a precedence > >> order? Is it based on the order in which the tile*.xml files are > >> registered/loaded? > > > > Without double-checking the code my memory from experience tells me that > > the first definition found (as files are loaded and as found in the > > file) is the definition that is used. > > [snip], but I would have loved to have a feature that uses "closest > match" algorithm as opposed to a "first-defn found".
One way to solve this is to have a custom PrefixedPatternDefinitionResolver overriding AbstractPatternDefinitionResolver.addDefinitionsAsPatternMatchers(..) so that the loop over the defsMap happens in the order you want. And return this custom PrefixedPatternDefinitionResolver from your TilesContainerFactory.createPatternDefinitionResolver(..) I guess the closest match strategy could be done using StringUtils.getLevenshteinDistance(..) > I'm surprised that no-one has seen the need for something like this > before. I guess just adjusting the order of the definitions in the tiles xml has been good enough for everyone. But something like described above, a la an EditDistanceOrderedPrefixedPatternDefinitionResolver, has value and i'd vote for accepting it into the tiles. ~mck -- Nature does not hurry, yet everything is accomplished. - Lao Tzu | http://github.com/finn-no | http://tech.finn.no |