org.umlgraph.doclet
Class ContextMatcher

Show UML class diagram
java.lang.Object
  extended by org.umlgraph.doclet.ContextMatcher
All Implemented Interfaces:
ClassMatcher

public class ContextMatcher
extends java.lang.Object
implements ClassMatcher

Matches classes that are directly connected to one of the classes matched by the regual expression specified. The context center is computed by regex lookup. Depending on the specified Options, inferred relations and dependencies will be used as well.

This class needs to perform quite a bit of computations in order to gather the network of class releationships, so you are allowed to reuse it should you


Nested Class Summary
private static class ContextMatcher.ClassGraphHack
          A quick hack to compute class dependencies reusing ClassGraph but without generating output.
private static class ContextMatcher.DevNullWriter
          Simple dev/null imitation
 
Field Summary
(package private)  ContextMatcher.ClassGraphHack cg
           
(package private)  boolean keepParentHide
           
(package private)  java.util.List<com.sun.javadoc.ClassDoc> matched
           
(package private)  Options opt
           
(package private)  java.util.regex.Pattern pattern
           
(package private)  com.sun.javadoc.RootDoc root
           
(package private)  java.util.Set<java.lang.String> visited
           
 
Constructor Summary
ContextMatcher(com.sun.javadoc.RootDoc root, java.util.regex.Pattern pattern, Options options, boolean keepParentHide)
          Builds the context matcher
 
Method Summary
private  void addToGraph(com.sun.javadoc.ClassDoc cd)
          Adds the specified class to the internal class graph along with its relations and depencies, eventually inferring them, according to the Options specified for this matcher
 boolean matches(com.sun.javadoc.ClassDoc cd)
          Returns the options for the specified class.
 boolean matches(java.lang.String name)
          Returns the options for the specified class.
 void setContextCenter(java.util.regex.Pattern pattern)
          Can be used to setup a different pattern for this context matcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cg

ContextMatcher.ClassGraphHack cg

pattern

java.util.regex.Pattern pattern

matched

java.util.List<com.sun.javadoc.ClassDoc> matched

visited

java.util.Set<java.lang.String> visited

opt

Options opt

root

com.sun.javadoc.RootDoc root

keepParentHide

boolean keepParentHide
Constructor Detail

ContextMatcher

public ContextMatcher(com.sun.javadoc.RootDoc root,
                      java.util.regex.Pattern pattern,
                      Options options,
                      boolean keepParentHide)
               throws java.io.IOException
Builds the context matcher

Parameters:
root - The root doc returned by JavaDoc
pattern - The pattern that will match the "center" of this context
opt - The options will be used to decide on inference
keepParentHide - If true, parent option hide patterns will be preserved, so that classes hidden by the options won't be shown in the context
fullContext - If true, all the classes related to the context center will be included, otherwise it will match only the classes referred with an outgoing relation from the context center
Throws:
java.io.IOException
Method Detail

setContextCenter

public void setContextCenter(java.util.regex.Pattern pattern)
Can be used to setup a different pattern for this context matcher.

This can be used to speed up subsequent matching with the same global options, since the class network informations will be reused.

Parameters:
pattern -

addToGraph

private void addToGraph(com.sun.javadoc.ClassDoc cd)
Adds the specified class to the internal class graph along with its relations and depencies, eventually inferring them, according to the Options specified for this matcher

Parameters:
cd -

matches

public boolean matches(com.sun.javadoc.ClassDoc cd)
Description copied from interface: ClassMatcher
Returns the options for the specified class.

Specified by:
matches in interface ClassMatcher
See Also:
ClassMatcher.matches(com.sun.javadoc.ClassDoc)

matches

public boolean matches(java.lang.String name)
Description copied from interface: ClassMatcher
Returns the options for the specified class.

Specified by:
matches in interface ClassMatcher
See Also:
ClassMatcher.matches(java.lang.String)