01: /*
02: * Contibuted by Andrea Aime
03: * (C) Copyright 2005 Diomidis Spinellis
04: *
05: * Permission to use, copy, and distribute this software and its
06: * documentation for any purpose and without fee is hereby granted,
07: * provided that the above copyright notice appear in all copies and that
08: * both that copyright notice and this permission notice appear in
09: * supporting documentation.
10: *
11: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13: * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14: *
15: * $Id: PatternMatcher.java,v 1.3 2007/11/27 09:04:22 dds Exp $
16: *
17: */
18: package org.umlgraph.doclet;
19:
20: import java.util.regex.Matcher;
21: import java.util.regex.Pattern;
22:
23: import com.sun.javadoc.ClassDoc;
24:
25: /**
26: * Matches classes performing a regular expression match on the qualified class
27: * name
28: * @author wolf
29: */
30: public class PatternMatcher implements ClassMatcher {
31: Pattern pattern;
32:
33: public PatternMatcher(Pattern pattern) {
34: this .pattern = pattern;
35: }
36:
37: public boolean matches(ClassDoc cd) {
38: return matches(cd.toString());
39: }
40:
41: public boolean matches(String name) {
42: Matcher matcher = pattern.matcher(name);
43: return matcher.matches();
44: }
45:
46: }
|