[Japi-cvs] SF.net SVN: japi: [473] tools/findLongestPath/trunk/src/net/sf/japi/ findLongestPath/Fi
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-06-30 11:52:01
|
Revision: 473 http://svn.sourceforge.net/japi/?rev=473&view=rev Author: christianhujer Date: 2007-06-30 04:52:00 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Added missing @Nullable / @NotNull annotations. Added missing Javadoc comments. Added missing @Override annotation. Added missing final modifier. Modified Paths: -------------- tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java Modified: tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java =================================================================== --- tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java 2007-06-30 11:46:40 UTC (rev 472) +++ tools/findLongestPath/trunk/src/net/sf/japi/findLongestPath/FindLongestPath.java 2007-06-30 11:52:00 UTC (rev 473) @@ -38,16 +38,24 @@ ArgParser.simpleParseAndRun(new FindLongestPath(), args); } - private String maxPathname; + /** The longest path name found so far. */ + @NotNull private String maxPathname; + /** The length of the longest path name found so far. */ private int maxLength; + /** Whether to operate with absolute paths. + * <code>true</code> means paths are converted to absolute paths, even if they are relative. + * <code>false</code> means paths stay relative if they are relative. + */ private boolean absolute; + /** Create a FindLongestPath. */ public FindLongestPath() { reset(); } + /** Reset this FindLongestPath to its initial state. */ public void reset() { maxPathname = ""; maxLength = 0; @@ -55,7 +63,7 @@ /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) - public int run(@NotNull List<String> args) throws Exception { + public int run(@NotNull final List<String> args) throws Exception { if (args.size() == 0) { find("."); System.out.println(this); @@ -69,16 +77,25 @@ return 0; } + /** Sets whether to operate with absolute paths. + * @param absolute Whether to operate with absolute paths, <code>true</code> to convert paths to absolute paths, <code>false</code> to not perform any conversion. + */ @Option({"a", "absolute"}) public void setAbsolute(final boolean absolute) { this.absolute = absolute; } - private void find(final String pathname) { + /** Performs a search based on a pathname. + * @param pathname Pathname to search for the longest pathname. + */ + private void find(@NotNull final String pathname) { find(new File(pathname)); } - private void find(final File path) { + /** Performs a search based on a file. + * @param path File to search for the longest pathname. + */ + private void find(@NotNull final File path) { final String pathname = absolute ? path.getAbsolutePath() : path.getPath(); final int length = pathname.length(); if (length > maxLength) { @@ -88,7 +105,7 @@ } /** {@inheritDoc} */ - public String toString() { + @Override public String toString() { return maxPathname + ":" + maxLength; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |