Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Applied: [cdt-patch] Search: OrPattern

Doug Schaefer, Senior Software Developer
IBM Rational Software, Ottawa, Ontario, Canada



Andrew Niefer/Ottawa/IBM@IBMCA 
Sent by: cdt-patch-admin@xxxxxxxxxxx
08/06/2003 05:26 PM
Please respond to
cdt-patch@xxxxxxxxxxx


To
cdt-patch@xxxxxxxxxxx
cc

Subject
[cdt-patch] Search: OrPattern 






core:
- created new search pattern OrPattern, which returns a match if any of 
its constituent pattens return a match.

To use it, do something like:
OrPattern orPattern = new OrPattern();
orPattern.addPattern( SearchEngine.createSearchPattern( "::NS::B::e", 
ENUM, REFERENCES, true ) );
orPattern.addPattern( SearchEngine.createSearchPattern( "Hea*", CLASS, 
DECLARATIONS, true ) );

Searching for all occurences of something now uses the OrPattern. ie, 
SearchEngine.createSearchPattern( "A", TYPE, ALL_OCCURENCES, true );
is the same as
OrPattern orPattern = new OrPattern();
orPattern.addPattern( SearchEngine.createSearchPattern( "f", FUNCTION, 
DECLARATIONS, true ) );
orPattern.addPattern( SearchEngine.createSearchPattern( "f", FUNCTION, 
REFERENCES, true ) );
orPattern.addPattern( SearchEngine.createSearchPattern( "f", FUNCTION, 
DEFINITIONS, true ) );

For large projects this is much more efficient than the old method of 
finding all occurences

core.tests:
- added ClassDeclarationPatternTests.testAllOccurences
- added OtherPatternTests.testOrPattern

-Andrew

[attachment "patch_08.06.03(cdt.core).txt" deleted by Douglas 
Schaefer/Ottawa/IBM] [attachment "patch_08.06.03(cdt.core.tests).txt" 
deleted by Douglas Schaefer/Ottawa/IBM] 



Back to the top