You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/09/30 06:27:43 UTC

svn commit: r292625 [2/2] - in /maven/jxr/trunk: ./ src/main/java/org/apache/maven/jxr/ src/main/java/org/apache/maven/jxr/ant/ src/main/java/org/apache/maven/jxr/pacman/ src/main/java/org/apache/maven/jxr/util/ src/test/java/org/apache/maven/jxr/

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JxrBean.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JxrBean.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JxrBean.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JxrBean.java Thu Sep 29 21:27:12 2005
@@ -17,23 +17,17 @@
  * ====================================================================
  */
 
-import org.apache.maven.jxr.JXR;
-import org.apache.maven.jxr.DirectoryIndexer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.maven.jxr.pacman.FileManager;
 import org.apache.maven.jxr.pacman.PackageManager;
-import org.apache.maven.jxr.pacman.PackageType;
-import org.apache.maven.jxr.pacman.ClassType;
-import java.util.Enumeration;
 
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
 import java.io.File;
-import java.io.IOException;
 import java.io.FileNotFoundException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * Creates an html-based, cross referenced  version of Java source code
@@ -46,21 +40,32 @@
  */
 public class JxrBean
 {
-    /** Log. */
-    private static final Log log = LogFactory.getLog(JxrBean.class);
+    /**
+     * Log.
+     */
+    private static final Log log = LogFactory.getLog( JxrBean.class );
 
     /*
      * See the doc comments for the corresponding getter/setter methods
      */
     private List sourceDirs;
+
     private String destDir;
+
     private String lang;
+
     private String inputEncoding;
+
     private String outputEncoding;
+
     private String javadocDir;
+
     private String windowTitle;
+
     private String docTitle;
+
     private String bottom;
+
     private String templateDir;
 
     /**
@@ -81,52 +86,52 @@
     {
         // get a relative link to the javadocs
         String javadocLinkDir = null;
-        if (javadocDir != null) {
-            javadocLinkDir = getRelativeLink(destDir, javadocDir);
+        if ( javadocDir != null )
+        {
+            javadocLinkDir = getRelativeLink( destDir, javadocDir );
         }
-        
+
         // first collect package and class info
         PackageManager pkgmgr = new PackageManager();
 
-        FileManager.getInstance().setEncoding(inputEncoding);
-        
+        FileManager.getInstance().setEncoding( inputEncoding );
+
         // go through each source directory and xref the java files
-        for (Iterator i = sourceDirs.iterator(); i.hasNext();)
+        for ( Iterator i = sourceDirs.iterator(); i.hasNext(); )
         {
             String path = (String) i.next();
-            path = new File(path).getCanonicalPath();
-            
-            pkgmgr.process(path);
-            
-            new JXR(pkgmgr, path, destDir, lang, inputEncoding, outputEncoding, javadocLinkDir, "HEAD");
+            path = new File( path ).getCanonicalPath();
+
+            pkgmgr.process( path );
+
+            new JXR( pkgmgr, path, destDir, lang, inputEncoding, outputEncoding, javadocLinkDir, "HEAD" );
         }
-        
+
         // once we have all the source files xref'd, create the index pages
-        DirectoryIndexer indexer = new DirectoryIndexer(pkgmgr, destDir);
-        indexer.setOutputEncoding(outputEncoding);
-        indexer.setTemplateDir(getTemplateDir());
-        indexer.setWindowTitle(getWindowTitle());
-        indexer.setDocTitle(getDocTitle());
-        indexer.setBottom(getBottom());
+        DirectoryIndexer indexer = new DirectoryIndexer( pkgmgr, destDir );
+        indexer.setOutputEncoding( outputEncoding );
+        indexer.setTemplateDir( getTemplateDir() );
+        indexer.setWindowTitle( getWindowTitle() );
+        indexer.setDocTitle( getDocTitle() );
+        indexer.setBottom( getBottom() );
         indexer.process();
     }
-    
+
     /**
      * Creates a relative link from one directory to another.
      *
      * Example:
-     *   given /foo/bar/baz/oink
-     *     and /foo/bar/schmoo
+     * given /foo/bar/baz/oink
+     * and /foo/bar/schmoo
      *
      * this method will return a string of "../../schmoo/"
      *
      * @param fromDir The directory from which the link is relative.
-     * @param toDir   The directory into which the link points.
-     * @throws IOException
-     *    If a problem is encountered while navigating through the directories.
+     * @param toDir The directory into which the link points.
      * @return a string of format "../../schmoo/"
+     * @throws IOException If a problem is encountered while navigating through the directories.
      */
-    private String getRelativeLink(String fromDir, String toDir)
+    private String getRelativeLink( String fromDir, String toDir )
         throws IOException
     {
         StringBuffer toLink = new StringBuffer();   // up from fromDir
@@ -134,48 +139,47 @@
 
         // create a List of toDir's parent directories
         LinkedList parents = new LinkedList();
-        File f = new File(toDir);
+        File f = new File( toDir );
         f = f.getCanonicalFile();
-        while (f != null)
+        while ( f != null )
         {
-            parents.add(f);
+            parents.add( f );
             f = f.getParentFile();
         }
-            
+
         // walk up fromDir to find the common parent
-        f = new File(fromDir);
+        f = new File( fromDir );
         f = f.getCanonicalFile();
         f = f.getParentFile();
         boolean found = false;
-        while (f != null && !found)
+        while ( f != null && !found )
         {
-            for (int i = 0; i < parents.size(); ++i)
+            for ( int i = 0; i < parents.size(); ++i )
             {
-                File parent = (File) parents.get(i);
-                if (f.equals(parent))
+                File parent = (File) parents.get( i );
+                if ( f.equals( parent ) )
                 {
                     // when we find the common parent, add the subdirectories 
                     // down to toDir itself
-                    for (int j = 0; j < i; ++j)
+                    for ( int j = 0; j < i; ++j )
                     {
-                        File p = (File) parents.get(j);
-                        toLink.insert(0, p.getName() + "/");
+                        File p = (File) parents.get( j );
+                        toLink.insert( 0, p.getName() + "/" );
                     }
                     found = true;
                     break;
                 }
             }
             f = f.getParentFile();
-            fromLink.append("../");
+            fromLink.append( "../" );
         }
 
-        if (!found)
+        if ( !found )
         {
-            throw new FileNotFoundException(fromDir + " and " + toDir +
-                                            " have no common parent.");
+            throw new FileNotFoundException( fromDir + " and " + toDir + " have no common parent." );
         }
 
-        return fromLink.append(toLink.toString()).toString();
+        return fromLink.append( toLink.toString() ).toString();
     }
 
     /**
@@ -183,13 +187,13 @@
      *
      * @param sourceDir The source directory to be cross-referenced.
      */
-    public void setSourceDir(String sourceDir)
+    public void setSourceDir( String sourceDir )
     {
-        if (!sourceDirs.isEmpty())
+        if ( !sourceDirs.isEmpty() )
         {
             sourceDirs.clear();
         }
-        addSourceDir(sourceDir);
+        addSourceDir( sourceDir );
     }
 
     /**
@@ -197,9 +201,9 @@
      *
      * @param sourceDir The source directory to be cross-referenced.
      */
-    public void addSourceDir(String sourceDir)
+    public void addSourceDir( String sourceDir )
     {
-        sourceDirs.add(sourceDir);
+        sourceDirs.add( sourceDir );
     }
 
 
@@ -208,7 +212,7 @@
      *
      * @param destDir the destination directory for jxr output
      */
-    public void setDestDir(String destDir)
+    public void setDestDir( String destDir )
     {
         this.destDir = destDir;
     }
@@ -229,7 +233,7 @@
      *
      * @param lang lang attribute of output files.
      */
-    public void setLang(String lang)
+    public void setLang( String lang )
     {
         this.lang = lang;
     }
@@ -250,7 +254,7 @@
      *
      * @param inputEncoding encoding of source files
      */
-    public void setInputEncoding(String inputEncoding)
+    public void setInputEncoding( String inputEncoding )
     {
         this.inputEncoding = inputEncoding;
     }
@@ -271,7 +275,7 @@
      *
      * @param outputEncoding encoding of output files
      */
-    public void setOutputEncoding(String outputEncoding)
+    public void setOutputEncoding( String outputEncoding )
     {
         this.outputEncoding = outputEncoding;
     }
@@ -290,12 +294,12 @@
     /**
      * JavadocDir is used to cross-reference the source code with
      * the appropriate javadoc pages.
-     * 
+     *
      * If <code>null</code>, no javadoc link will be added.
      *
      * @param javadocDir The root directory containing javadocs
      */
-    public void setJavadocDir(String javadocDir)
+    public void setJavadocDir( String javadocDir )
     {
         this.javadocDir = javadocDir;
     }
@@ -316,7 +320,7 @@
      * @param windowTitle used by DirectoryIndexer
      * @see DirectoryIndexer#setWindowTitle(String) setWindowTitle(String)
      */
-    public void setWindowTitle(String windowTitle)
+    public void setWindowTitle( String windowTitle )
     {
         this.windowTitle = windowTitle;
     }
@@ -337,7 +341,7 @@
      * @param docTitle used by DirectoryIndexer
      * @see DirectoryIndexer#setDocTitle(String) setDocTitle(String)
      */
-    public void setDocTitle(String docTitle)
+    public void setDocTitle( String docTitle )
     {
         this.docTitle = docTitle;
     }
@@ -358,7 +362,7 @@
      * @param bottom used by DirectoryIndexer
      * @see DirectoryIndexer#setBottom(String) setBottom(String)
      */
-    public void setBottom(String bottom)
+    public void setBottom( String bottom )
     {
         this.bottom = bottom;
     }
@@ -378,7 +382,7 @@
      *
      * @param templateDir the template directory
      */
-    public void setTemplateDir(String templateDir)
+    public void setTemplateDir( String templateDir )
     {
         this.templateDir = templateDir;
     }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/ant/DirectoryScanner.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/ant/DirectoryScanner.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/ant/DirectoryScanner.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/ant/DirectoryScanner.java Thu Sep 29 21:27:12 2005
@@ -4,21 +4,24 @@
 
 /**
  * Workaround to ignore package-info.java files.
- * 
+ *
  * @author Carlos Sanchez
  */
-public class DirectoryScanner extends org.apache.tools.ant.DirectoryScanner {
+public class DirectoryScanner
+    extends org.apache.tools.ant.DirectoryScanner
+{
 
-    public void addDefaultExcludes() {
+    public void addDefaultExcludes()
+    {
         super.addDefaultExcludes();
         int excludesLength = excludes == null ? 0 : excludes.length;
         String[] newExcludes;
         newExcludes = new String[excludesLength + 1];
-        if (excludesLength > 0) {
-            System.arraycopy(excludes, 0, newExcludes, 0, excludesLength);
+        if ( excludesLength > 0 )
+        {
+            System.arraycopy( excludes, 0, newExcludes, 0, excludesLength );
         }
-        newExcludes[excludesLength] = "**" + File.separatorChar
-                + "package-info.java";
+        newExcludes[excludesLength] = "**" + File.separatorChar + "package-info.java";
         excludes = newExcludes;
     }
 

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/BaseType.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/BaseType.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/BaseType.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/BaseType.java Thu Sep 29 21:27:12 2005
@@ -35,7 +35,7 @@
      */
     public String getName()
     {
-        if (name == null)
+        if ( name == null )
         {
             return "";
         }
@@ -48,7 +48,7 @@
      *
      * @param name The new name value
      */
-    public void setName(String name)
+    public void setName( String name )
     {
         this.name = name;
     }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ClassType.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ClassType.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ClassType.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ClassType.java Thu Sep 29 21:27:12 2005
@@ -17,8 +17,11 @@
  * ====================================================================
  */
 
-/** Represents a Java class or interface  */
-public class ClassType extends BaseType
+/**
+ * Represents a Java class or interface
+ */
+public class ClassType
+    extends BaseType
 {
 
     /**
@@ -26,9 +29,9 @@
      *
      * @param name
      */
-    public ClassType(String name)
+    public ClassType( String name )
     {
-        this.setName(name);
+        this.setName( name );
     }
 
 }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/FileManager.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/FileManager.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/FileManager.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/FileManager.java Thu Sep 29 21:27:12 2005
@@ -17,8 +17,8 @@
  * ====================================================================
  */
 
-import java.util.*;
 import java.io.IOException;
+import java.util.Hashtable;
 
 /**
  * <p>
@@ -34,13 +34,18 @@
 public class FileManager
 {
 
-    /** The Singleton instance of this FileManager  */
+    /**
+     * The Singleton instance of this FileManager
+     */
     private static FileManager instance = new FileManager();
 
     private Hashtable files = new Hashtable();
+
     private String encoding = null;
 
-    /** Get an instance of the FileManager  */
+    /**
+     * Get an instance of the FileManager
+     */
     public static FileManager getInstance()
     {
         return instance;
@@ -50,25 +55,27 @@
      * Get a file from it's name. If the file does not exist within the
      * FileManager, create a new one and return it.
      */
-    public JavaFile getFile(String name)
+    public JavaFile getFile( String name )
         throws IOException
     {
 
-        JavaFile real = (JavaFile) this.files.get(name);
+        JavaFile real = (JavaFile) this.files.get( name );
 
-        if (real == null)
+        if ( real == null )
         {
-            real = new JavaFileImpl(name, this.getEncoding());
-            this.addFile(real);
+            real = new JavaFileImpl( name, this.getEncoding() );
+            this.addFile( real );
         }
 
         return real;
     }
 
-    /** Add a file to this filemanager.  */
-    public void addFile(JavaFile file)
+    /**
+     * Add a file to this filemanager.
+     */
+    public void addFile( JavaFile file )
     {
-        this.files.put(file.getFilename(), file);
+        this.files.put( file.getFilename(), file );
     }
 
     /**
@@ -76,7 +83,7 @@
      *
      * @param encoding encoding of source files
      */
-    public void setEncoding(String encoding)
+    public void setEncoding( String encoding )
     {
         this.encoding = encoding;
     }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ImportType.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ImportType.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ImportType.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/ImportType.java Thu Sep 29 21:27:12 2005
@@ -17,12 +17,17 @@
  * ====================================================================
  */
 
-/** Represents an entry in a java "import" statement  */
-public class ImportType extends BaseType
+/**
+ * Represents an entry in a java "import" statement
+ */
+public class ImportType
+    extends BaseType
 {
 
     private boolean isclass = false;
+
     private boolean ispackage = false;
+
     private String packagename = null;
 
     /**
@@ -30,31 +35,35 @@
      *
      * @param name
      */
-    public ImportType(String name)
+    public ImportType( String name )
     {
-        this.setName(name);
+        this.setName( name );
 
         //compute member variables
 
-        this.isclass = this.getName().indexOf("*") == -1;
+        this.isclass = this.getName().indexOf( "*" ) == -1;
 
-        this.ispackage = this.getName().indexOf("*") != -1;
+        this.ispackage = this.getName().indexOf( "*" ) != -1;
 
-        int end = this.getName().lastIndexOf(".");
-        if (end != -1)
+        int end = this.getName().lastIndexOf( "." );
+        if ( end != -1 )
         {
-            this.packagename = this.getName().substring(0, end);
+            this.packagename = this.getName().substring( 0, end );
         }
 
     }
 
-    /** Return true if this is a class import. Ex: test.Test  */
+    /**
+     * Return true if this is a class import. Ex: test.Test
+     */
     public boolean isClass()
     {
         return this.isclass;
     }
 
-    /** Return true if this is a package import. Ex: test.*  */
+    /**
+     * Return true if this is a package import. Ex: test.*
+     */
     public boolean isPackage()
     {
         return this.ispackage;

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFile.java Thu Sep 29 21:27:12 2005
@@ -17,7 +17,7 @@
  * ====================================================================
  */
 
-import java.util.*;
+import java.util.Vector;
 
 /**
  * Interface for objects which wish to provide metainfo about a JavaFile.
@@ -31,73 +31,95 @@
     private Vector imports = new Vector();
 
     private ClassType classType = null;
+
     private PackageType packageType = new PackageType();
 
     private String filename = null;
+
     private String encoding = null;
 
-    /** Get the imported packages/files that this package has.  */
+    /**
+     * Get the imported packages/files that this package has.
+     */
     public ImportType[] getImportTypes()
     {
 
         ImportType[] it = new ImportType[this.imports.size()];
-        this.imports.copyInto(it);
+        this.imports.copyInto( it );
         return it;
     }
 
-    /** Get the name of this class.  */
+    /**
+     * Get the name of this class.
+     */
     public ClassType getClassType()
     {
         return this.classType;
     }
 
-    /** Get the package of this class.  */
+    /**
+     * Get the package of this class.
+     */
     public PackageType getPackageType()
     {
         return this.packageType;
     }
 
 
-    /** Add an ImportType to the current imports  */
-    public void addImportType(ImportType importType)
-    {
-        this.imports.addElement(importType);
+    /**
+     * Add an ImportType to the current imports
+     */
+    public void addImportType( ImportType importType )
+    {
+        this.imports.addElement( importType );
     }
 
-    /** Set the name of this class.  */
-    public void setClassType(ClassType classType)
+    /**
+     * Set the name of this class.
+     */
+    public void setClassType( ClassType classType )
     {
         this.classType = classType;
     }
 
-    /** Set the PackageType of this class.  */
-    public void setPackageType(PackageType packageType)
+    /**
+     * Set the PackageType of this class.
+     */
+    public void setPackageType( PackageType packageType )
     {
         this.packageType = packageType;
     }
 
 
-    /** Gets the filename attribute of the JavaFile object */
+    /**
+     * Gets the filename attribute of the JavaFile object
+     */
     public String getFilename()
     {
         return this.filename;
     }
 
-    /** Sets the filename attribute of the JavaFile object */
-    public void setFilename(String filename)
+    /**
+     * Sets the filename attribute of the JavaFile object
+     */
+    public void setFilename( String filename )
     {
         this.filename = filename;
     }
 
 
-    /** Gets the encoding attribute of the JavaFile object */
+    /**
+     * Gets the encoding attribute of the JavaFile object
+     */
     public String getEncoding()
     {
         return this.encoding;
     }
 
-    /** Sets the encoding attribute of the JavaFile object */
-    public void setEncoding(String encoding)
+    /**
+     * Sets the encoding attribute of the JavaFile object
+     */
+    public void setEncoding( String encoding )
     {
         this.encoding = encoding;
     }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/JavaFileImpl.java Thu Sep 29 21:27:12 2005
@@ -17,8 +17,13 @@
  * ====================================================================
  */
 
-import java.util.*;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StreamTokenizer;
 
 /**
  * PacMan implementation of a JavaFile. This will parse out the file and
@@ -27,7 +32,8 @@
  * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  * @version $Id$
  */
-public class JavaFileImpl extends JavaFile
+public class JavaFileImpl
+    extends JavaFile
 {
     private Reader reader;
 
@@ -35,19 +41,19 @@
      * Create a new JavaFileImpl that points to a given file...
      *
      * @param filename
-     * @exception IOException
+     * @throws IOException
      */
-    public JavaFileImpl(String filename, String encoding)
+    public JavaFileImpl( String filename, String encoding )
         throws IOException
     {
-        this.setFilename(filename);
-        this.setEncoding(encoding);
+        this.setFilename( filename );
+        this.setEncoding( encoding );
 
         //always add java.lang.* to the package imports because the JVM always
         //does this implicitly.  Unless we add this to the ImportTypes JXR
         //won't pick up on this.
 
-        this.addImportType(new ImportType("java.lang.*"));
+        this.addImportType( new ImportType( "java.lang.*" ) );
 
         //now parse out this file.
 
@@ -65,29 +71,29 @@
         try
         {
             stok = this.getTokenizer();
-    
-            while (stok.nextToken() != StreamTokenizer.TT_EOF)
+
+            while ( stok.nextToken() != StreamTokenizer.TT_EOF )
             {
-    
-                if (stok.sval == null)
+
+                if ( stok.sval == null )
                 {
                     continue;
                 }
-    
+
                 //set the package
-                if (stok.sval.equals("package"))
+                if ( stok.sval.equals( "package" ) )
                 {
                     stok.nextToken();
-                    this.setPackageType(new PackageType(stok.sval));
+                    this.setPackageType( new PackageType( stok.sval ) );
                 }
-    
+
                 //set the imports
-                if (stok.sval.equals("import"))
+                if ( stok.sval.equals( "import" ) )
                 {
                     stok.nextToken();
-    
+
                     String name = stok.sval;
-    
+
                     /*
                     WARNING: this is a bug/non-feature in the current
                     StreamTokenizer.  We needed to set the comment char as "*"
@@ -95,65 +101,66 @@
                     stripped( and become "test." ).  Here we need to test for this
                     and if necessary re-add the char.
                     */
-                    if (name.charAt(name.length() - 1) == '.')
+                    if ( name.charAt( name.length() - 1 ) == '.' )
                     {
                         name = name + "*";
                     }
-    
-                    this.addImportType(new ImportType(name));
+
+                    this.addImportType( new ImportType( name ) );
                 }
-    
+
                 //set the Class... if the class is found no more information is
                 //valid so just break out of the while loop at this point.
                 //set the imports
-                if (stok.sval.equals("class") ||
-                    stok.sval.equals("interface") ||
-                    stok.sval.equals("enum"))
+                if ( stok.sval.equals( "class" ) || stok.sval.equals( "interface" ) || stok.sval.equals( "enum" ) )
                 {
                     stok.nextToken();
-                    this.setClassType(new ClassType(stok.sval));
+                    this.setClassType( new ClassType( stok.sval ) );
                     break;
                 }
-    
+
             }
         }
         finally
         {
             stok = null;
-            if (this.reader != null) {
+            if ( this.reader != null )
+            {
                 this.reader.close();
             }
         }
     }
 
-    /** Get a StreamTokenizer for this file.  */
+    /**
+     * Get a StreamTokenizer for this file.
+     */
     private StreamTokenizer getTokenizer()
         throws IOException
     {
 
-        if (!new File(this.getFilename()).exists())
+        if ( !new File( this.getFilename() ).exists() )
         {
-            throw new IOException(this.getFilename() + " does not exist!");
+            throw new IOException( this.getFilename() + " does not exist!" );
         }
 
-        if (this.getEncoding() != null)
+        if ( this.getEncoding() != null )
         {
-            this.reader = new InputStreamReader(new FileInputStream(this.getFilename()), this.getEncoding());
+            this.reader = new InputStreamReader( new FileInputStream( this.getFilename() ), this.getEncoding() );
         }
         else
         {
-            this.reader = new FileReader(this.getFilename());
+            this.reader = new FileReader( this.getFilename() );
         }
 
-        StreamTokenizer stok = new StreamTokenizer(reader);
+        StreamTokenizer stok = new StreamTokenizer( reader );
         //int tok;
 
-        stok.commentChar('*');
-        stok.wordChars('_', '_'); 
+        stok.commentChar( '*' );
+        stok.wordChars( '_', '_' );
 
         // set tokenizer to skip comments
-        stok.slashStarComments(true);
-        stok.slashSlashComments(true);
+        stok.slashStarComments( true );
+        stok.slashSlashComments( true );
 
         return stok;
     }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageManager.java Thu Sep 29 21:27:12 2005
@@ -17,15 +17,15 @@
  * ====================================================================
  */
 
-import java.util.*;
-import java.io.*;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.maven.jxr.util.*;
 import org.apache.tools.ant.DirectoryScanner;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
 
 /**
  * Given a list of directories, parse them out and store them as rendered
@@ -33,8 +33,10 @@
  */
 public class PackageManager
 {
-    /** Log */
-    private static final Log LOG = LogFactory.getLog(PackageManager.class);
+    /**
+     * Log
+     */
+    private static final Log LOG = LogFactory.getLog( PackageManager.class );
 
     private Hashtable directories = new Hashtable();
 
@@ -52,24 +54,24 @@
      * Given the name of a package (Ex: org.apache.maven.util) obtain it from
      * the PackageManager
      */
-    public PackageType getPackageType(String name)
+    public PackageType getPackageType( String name )
     {
 
         //return the default package if the name is null.
-        if (name == null)
+        if ( name == null )
         {
             return defaultPackage;
         }
 
-        return (PackageType) this.packages.get(name);
+        return (PackageType) this.packages.get( name );
     }
 
     /**
      * Add a package to the PackageManager
      */
-    public void addPackageType(PackageType packageType)
+    public void addPackageType( PackageType packageType )
     {
-        this.packages.put(packageType.getName(), packageType);
+        this.packages.put( packageType.getName(), packageType );
     }
 
     /**
@@ -77,54 +79,53 @@
      */
     public Enumeration getPackageTypes()
     {
-       return packages.elements();
+        return packages.elements();
     }
 
     /**
      * Parse out all the directories on which this depends.
      */
-    private void parse(String directory)
+    private void parse( String directory )
     {
         // Go through each directory and get the java source 
         // files for this dir.
-        LOG.info("Scanning " + directory);
+        LOG.info( "Scanning " + directory );
         DirectoryScanner directoryScanner = new DirectoryScanner();
-        File baseDir = new File(directory);
-        directoryScanner.setBasedir(baseDir);
-        String[] includes = { "**/*.java" };
-        directoryScanner.setIncludes(includes);
+        File baseDir = new File( directory );
+        directoryScanner.setBasedir( baseDir );
+        String[] includes = {"**/*.java"};
+        directoryScanner.setIncludes( includes );
         directoryScanner.scan();
         String[] files = directoryScanner.getIncludedFiles();
 
-        for (int j = 0; j < files.length; ++j)
+        for ( int j = 0; j < files.length; ++j )
         {
-            LOG.debug("parsing... " + files[j]);
+            LOG.debug( "parsing... " + files[j] );
 
             //now parse out this file to get the packages/classname/etc
             try
             {
-                String fileName = new File(baseDir,files[j]).getAbsolutePath();
-                JavaFile jfi = FileManager.getInstance().getFile(fileName);
+                String fileName = new File( baseDir, files[j] ).getAbsolutePath();
+                JavaFile jfi = FileManager.getInstance().getFile( fileName );
 
                 // now that we have this parsed out blend its information
                 // with the current package structure
-                PackageType jp = this.getPackageType(jfi.getPackageType().getName());
+                PackageType jp = this.getPackageType( jfi.getPackageType().getName() );
 
-                if (jp == null)
+                if ( jp == null )
                 {
-                    this.addPackageType(jfi.getPackageType());
+                    this.addPackageType( jfi.getPackageType() );
                     jp = jfi.getPackageType();
                 }
 
                 //add the current class to this global package.
-                if (jfi.getClassType() != null &&
-                    jfi.getClassType().getName() != null)
+                if ( jfi.getClassType() != null && jfi.getClassType().getName() != null )
                 {
-                    jp.addClassType(jfi.getClassType());
+                    jp.addClassType( jfi.getClassType() );
                 }
 
             }
-            catch (IOException e)
+            catch ( IOException e )
             {
                 e.printStackTrace();
             }
@@ -136,24 +137,24 @@
     /**
      * Description of the Method
      */
-    public void process(String directory)
+    public void process( String directory )
     {
-        if (this.directories.get(directory) == null)
+        if ( this.directories.get( directory ) == null )
         {
-            this.parse(directory);
-            this.directories.put(directory, directory);
+            this.parse( directory );
+            this.directories.put( directory, directory );
         }
     }
 
     /**
      * Description of the Method
      */
-    public void process(String[] directories)
+    public void process( String[] directories )
     {
 
-        for (int i = 0; i < directories.length; ++i)
+        for ( int i = 0; i < directories.length; ++i )
         {
-            this.process(directories[i]);
+            this.process( directories[i] );
         }
 
     }
@@ -161,9 +162,9 @@
     /**
      * Simple logging facility
      */
-    public final static void log(String message)
+    public final static void log( String message )
     {
-        System.out.println(" PackageManager -> " + message);
+        System.out.println( " PackageManager -> " + message );
     }
 
     /**
@@ -172,27 +173,27 @@
     public void dump()
     {
 
-        LOG.debug("Dumping out PackageManager structure");
+        LOG.debug( "Dumping out PackageManager structure" );
 
         Enumeration pts = this.getPackageTypes();
 
-        while (pts.hasMoreElements())
+        while ( pts.hasMoreElements() )
         {
 
             //get the current package and print it.
-            PackageType current = (PackageType)pts.nextElement();
+            PackageType current = (PackageType) pts.nextElement();
 
-            LOG.debug(current.getName());
+            LOG.debug( current.getName() );
 
             //get the classes under the package and print those too.
             Enumeration classes = current.getClassTypes();
 
-            while (classes.hasMoreElements())
+            while ( classes.hasMoreElements() )
             {
 
                 ClassType currentClass = (ClassType) classes.nextElement();
 
-                LOG.debug("\t" + currentClass.getName());
+                LOG.debug( "\t" + currentClass.getName() );
 
             }
         }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageType.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageType.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageType.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/pacman/PackageType.java Thu Sep 29 21:27:12 2005
@@ -17,10 +17,14 @@
  * ====================================================================
  */
 
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Hashtable;
 
-/** Represents a Java package and its subclasses.  */
-public class PackageType extends BaseType
+/**
+ * Represents a Java package and its subclasses.
+ */
+public class PackageType
+    extends BaseType
 {
 
     private Hashtable classes = new Hashtable();
@@ -30,27 +34,35 @@
      *
      * @param name
      */
-    public PackageType(String name)
+    public PackageType( String name )
     {
-        this.setName(name);
+        this.setName( name );
     }
 
-    /** Create a Java package with no name IE the default Java package.  */
-    public PackageType() { }
+    /**
+     * Create a Java package with no name IE the default Java package.
+     */
+    public PackageType()
+    {
+    }
 
 
-    /** Get all the known classes  */
+    /**
+     * Get all the known classes
+     */
     public Enumeration getClassTypes()
     {
 
         return classes.elements();
     }
 
-    /** Add a class to this package.  */
-    public void addClassType(ClassType classType)
+    /**
+     * Add a class to this package.
+     */
+    public void addClassType( ClassType classType )
     {
 
-        this.classes.put(classType.getName(), classType);
+        this.classes.put( classType.getName(), classType );
 
     }
 
@@ -58,10 +70,10 @@
      * Given the name of a class, get it from this package or null if it does
      * not exist
      */
-    public ClassType getClassType(String classType)
+    public ClassType getClassType( String classType )
     {
 
-        return (ClassType) this.classes.get(classType);
+        return (ClassType) this.classes.get( classType );
     }
 
 }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/SimpleWordTokenizer.java Thu Sep 29 21:27:12 2005
@@ -17,7 +17,8 @@
  * ====================================================================
  */
 
-import java.util.*;
+import java.util.Collections;
+import java.util.Vector;
 
 /**
  * This is a small and fast word tokenizer. It has different characteristics
@@ -28,29 +29,31 @@
 public class SimpleWordTokenizer
 {
 
-    /** Description of the Field */
+    /**
+     * Description of the Field
+     */
     public final static char[] BREAKERS = {'(', ')', '[', ' ', '{', '}'};
 
-    /** Break the given line into multiple StringUtils  */
-    public static StringEntry[] tokenize(String line)
+    /**
+     * Break the given line into multiple StringUtils
+     */
+    public static StringEntry[] tokenize( String line )
     {
 
         /*
         determine where to start processing this String... this could
         either be the start of the line or just keep going until the first
         */
-        int start = getStart(line);
+        int start = getStart( line );
 
         //find the first non-BREAKER char and assume that is where you want to start
 
-        if (line == null ||
-            line.length() == 0 ||
-            start == -1)
+        if ( line == null || line.length() == 0 || start == -1 )
         {
             return new StringEntry[0];
         }
 
-        return tokenize(line, start);
+        return tokenize( line, start );
     }
 
 
@@ -61,31 +64,33 @@
      * @param line String to search in
      * @param find String to match.
      */
-    public static StringEntry[] tokenize(String line, String find)
+    public static StringEntry[] tokenize( String line, String find )
     {
 
         Vector v = new Vector();
 
-        StringEntry[] se = tokenize(line);
+        StringEntry[] se = tokenize( line );
 
-        for (int i = 0; i < se.length; ++i)
+        for ( int i = 0; i < se.length; ++i )
         {
 
-            if (se[i].toString().equals(find))
+            if ( se[i].toString().equals( find ) )
             {
-                v.addElement(se[i]);
+                v.addElement( se[i] );
             }
 
         }
 
         StringEntry[] found = new StringEntry[v.size()];
-        Collections.sort(v);
-        v.copyInto(found);
+        Collections.sort( v );
+        v.copyInto( found );
         return found;
     }
 
-    /** Internal impl. Specify the start and end.  */
-    private static StringEntry[] tokenize(String line, int start)
+    /**
+     * Internal impl. Specify the start and end.
+     */
+    private static StringEntry[] tokenize( String line, int start )
     {
 
         Vector words = new Vector();
@@ -93,29 +98,28 @@
         //algorithm works like this... break the line out into segments
         //that are separated by spaces, and if the entire String doesn't contain
         //a non-Alpha char then assume it is a word.
-        while (true)
+        while ( true )
         {
 
-            int next = getNextBreak(line, start);
+            int next = getNextBreak( line, start );
 
-            if (next < 0 ||
-                next <= start)
+            if ( next < 0 || next <= start )
             {
                 break;
             }
 
-            String word = line.substring(start, next);
+            String word = line.substring( start, next );
 
-            if (isWord(word))
+            if ( isWord( word ) )
             {
-                words.addElement(new StringEntry(word, start));
+                words.addElement( new StringEntry( word, start ) );
             }
 
             start = next + 1;
         }
 
         StringEntry[] found = new StringEntry[words.size()];
-        words.copyInto(found);
+        words.copyInto( found );
         return found;
     }
 
@@ -124,23 +128,21 @@
      * Go through the entire String and if any character is not a Letter( a, b,
      * c, d, etc) then return false.
      */
-    private static boolean isWord(String string)
+    private static boolean isWord( String string )
     {
 
-        if (string == null ||
-            string.length() == 0)
+        if ( string == null || string.length() == 0 )
         {
 
             return false;
         }
 
-        for (int i = 0; i < string.length(); ++i)
+        for ( int i = 0; i < string.length(); ++i )
         {
 
-            char c = string.charAt(i);
+            char c = string.charAt( i );
 
-            if (Character.isLetter(c) == false &&
-                c != '.')
+            if ( Character.isLetter( c ) == false && c != '.' )
             {
                 return false;
             }
@@ -150,20 +152,20 @@
         return true;
     }
 
-    /** Go through the list of BREAKERS and find the closes one.  */
-    private static int getNextBreak(String string, int start)
+    /**
+     * Go through the list of BREAKERS and find the closes one.
+     */
+    private static int getNextBreak( String string, int start )
     {
 
         int breakPoint = -1;
 
-        for (int i = 0; i < BREAKERS.length; ++i)
+        for ( int i = 0; i < BREAKERS.length; ++i )
         {
 
-            int next = string.indexOf(BREAKERS[i], start);
+            int next = string.indexOf( BREAKERS[i], start );
 
-            if (breakPoint == -1 ||
-                next < breakPoint &&
-                next != -1)
+            if ( breakPoint == -1 || next < breakPoint && next != -1 )
             {
 
                 breakPoint = next;
@@ -173,7 +175,7 @@
         }
 
         //if the breakPoint is still -1 go to the end of the string
-        if (breakPoint == -1)
+        if ( breakPoint == -1 )
         {
             breakPoint = string.length();
         }
@@ -181,14 +183,16 @@
         return breakPoint;
     }
 
-    /** Go through the list of BREAKERS and find the closes one.  */
-    private static int getStart(String string)
+    /**
+     * Go through the list of BREAKERS and find the closes one.
+     */
+    private static int getStart( String string )
     {
 
-        for (int i = 0; i < string.length(); ++i)
+        for ( int i = 0; i < string.length(); ++i )
         {
 
-            if (isBreaker(string.charAt(i)) == false)
+            if ( isBreaker( string.charAt( i ) ) == false )
             {
                 return i;
             }
@@ -199,14 +203,16 @@
     }
 
 
-    /** Return true if the given char is considered a breaker.  */
-    private static boolean isBreaker(char c)
+    /**
+     * Return true if the given char is considered a breaker.
+     */
+    private static boolean isBreaker( char c )
     {
 
-        for (int i = 0; i < BREAKERS.length; ++i)
+        for ( int i = 0; i < BREAKERS.length; ++i )
         {
 
-            if (BREAKERS[i] == c)
+            if ( BREAKERS[i] == c )
             {
                 return true;
             }

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/StringEntry.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/StringEntry.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/StringEntry.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/util/StringEntry.java Thu Sep 29 21:27:12 2005
@@ -21,10 +21,12 @@
  * A StringEntry represents a value found by the tokenizer. The index is where
  * this StringEntry was found in the source string
  */
-public class StringEntry implements Comparable
+public class StringEntry
+    implements Comparable
 {
 
     private String value = null;
+
     private int index = 0;
 
     /**
@@ -33,44 +35,49 @@
      * @param value
      * @param index
      */
-    public StringEntry(String value,
-                       int index)
+    public StringEntry( String value, int index )
     {
 
         this.value = value;
         this.index = index;
     }
 
-    /** Gets the index attribute of the StringEntry object */
+    /**
+     * Gets the index attribute of the StringEntry object
+     */
     public int getIndex()
     {
         return this.index;
     }
 
-    /** Description of the Method */
+    /**
+     * Description of the Method
+     */
     public String toString()
     {
         return this.value;
     }
 
-    /** Compare two objects for equality.  */
-    public int compareTo(Object obj)
+    /**
+     * Compare two objects for equality.
+     */
+    public int compareTo( Object obj )
     {
         //right now only sort by the index.
 
-        if (obj instanceof StringEntry == false)
+        if ( obj instanceof StringEntry == false )
         {
 
-            throw new IllegalArgumentException("object must be a StringEntry");
+            throw new IllegalArgumentException( "object must be a StringEntry" );
         }
 
         StringEntry se = (StringEntry) obj;
 
-        if (se.getIndex() < this.getIndex())
+        if ( se.getIndex() < this.getIndex() )
         {
             return -1;
         }
-        else if (se.getIndex() == this.getIndex())
+        else if ( se.getIndex() == this.getIndex() )
         {
             return 0;
         }

Modified: maven/jxr/trunk/src/test/java/org/apache/maven/jxr/CodeTransformTest.java
URL: http://svn.apache.org/viewcvs/maven/jxr/trunk/src/test/java/org/apache/maven/jxr/CodeTransformTest.java?rev=292625&r1=292624&r2=292625&view=diff
==============================================================================
--- maven/jxr/trunk/src/test/java/org/apache/maven/jxr/CodeTransformTest.java (original)
+++ maven/jxr/trunk/src/test/java/org/apache/maven/jxr/CodeTransformTest.java Thu Sep 29 21:27:12 2005
@@ -1,11 +1,10 @@
 package org.apache.maven.jxr;
 
-import java.io.File;
-
 import junit.framework.TestCase;
-
 import org.apache.maven.jxr.pacman.PackageManager;
 
+import java.io.File;
+
 public class CodeTransformTest
     extends TestCase
 {
@@ -25,11 +24,12 @@
     public void testTransform()
         throws Exception
     {
-        File sourceFile = new File( System.getProperty( "basedir" )
-            + "/src/test/org/apache/maven/jxr/CodeTransformTest.java" );
+        File sourceFile = new File(
+            System.getProperty( "basedir" ) + "/src/test/org/apache/maven/jxr/CodeTransformTest.java" );
         assertTrue( sourceFile.exists() );
-        codeTransform.transform( sourceFile.getAbsolutePath(), System.getProperty( "basedir" )
-            + "/target/CodeTransformTest.html", "en", "ISO-8859-1", "ISO-8859-1", "", "" );
+        codeTransform.transform( sourceFile.getAbsolutePath(),
+                                 System.getProperty( "basedir" ) + "/target/CodeTransformTest.html", "en", "ISO-8859-1",
+                                 "ISO-8859-1", "", "" );
         //        sourceFile = new File("src/test/org/apache/maven/jxr/package-info.java");
         //        assertTrue(sourceFile.exists());
         //        codeTransform.transform(sourceFile.getAbsolutePath(),



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org