Changeset 2809:a567cce7c9ba in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/25/07 13:55:04 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Optimize use of multiple and or or combinators.

Chaining multiple OrCombinators? (or AndCombinators?) now generates only a single
OrCombinator? (or AndCombinator?) with multiple subselector instead of nested
binary OrCombinators? (or AndCombinators?).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/xfind.py

    r2808 r2809  
    10591059    reprsymbol = " | " 
    10601060 
     1061    def __or__(self, other): 
     1062        return OrCombinator(*(self.selectors + (xsc.makewalkfilter(other),))) 
     1063 
    10611064    def __str__(self): 
    10621065        return ", ".join(str(selector) for selector in self.selectors) 
     
    10881091    def match(self, path): 
    10891092        return all(selector.match(path) for selector in self.selectors) 
     1093 
     1094    def __and__(self, other): 
     1095        return AndCombinator(*(self.selectors + (xsc.makewalkfilter(other),))) 
    10901096 
    10911097    reprsymbol = " & "