japi-cvs Mailing List for JAPI (Page 26)
Status: Beta
Brought to you by:
christianhujer
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(115) |
May
(11) |
Jun
(5) |
Jul
(2) |
Aug
(10) |
Sep
(35) |
Oct
(14) |
Nov
(49) |
Dec
(27) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(57) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(25) |
Jun
(134) |
Jul
(76) |
Aug
(34) |
Sep
(27) |
Oct
(5) |
Nov
|
Dec
(1) |
| 2008 |
Jan
(3) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(63) |
Nov
(30) |
Dec
(43) |
| 2009 |
Jan
(10) |
Feb
(420) |
Mar
(67) |
Apr
(3) |
May
(61) |
Jun
(21) |
Jul
(19) |
Aug
|
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
(7) |
May
(3) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|
From: <chr...@us...> - 2009-02-01 16:28:47
|
Revision: 785
http://japi.svn.sourceforge.net/japi/?rev=785&view=rev
Author: christianhujer
Date: 2009-02-01 16:28:43 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
Improved logging mechanisms. They can now be less verbose and more identical to the output of compiler error messages.
Modified Paths:
--------------
tools/archStat/trunk/src/prj/net/sf/japi/archstat/ArchStat.java
tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java
tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/ArchStat.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/ArchStat.java 2009-02-01 16:27:10 UTC (rev 784)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/ArchStat.java 2009-02-01 16:28:43 UTC (rev 785)
@@ -46,6 +46,9 @@
/** Whether or not to output memory statistics. */
private boolean memoryStatistics;
+ /** Whether or not to print summaries. */
+ private boolean printSummaries;
+
/** {@inheritDoc} */
@SuppressWarnings({"InstanceMethodNamingConvention"})
public int run(@NotNull final List<String> args) throws Exception {
@@ -61,7 +64,7 @@
readDefaultCheckers();
final FileStat fileStat = new FileStat(checkers);
for (final String arg : args) {
- fileStat.addChild(arg);
+ fileStat.addChild(arg, printSummaries);
}
fileStat.printStatistic(System.out, depth);
if (memoryStatistics) {
@@ -73,7 +76,7 @@
}
/** The default depth. */
- private static final int DEFAULT_DEPTH = Integer.MAX_VALUE;
+ private static final int DEFAULT_DEPTH = 0; //Integer.MAX_VALUE;
/** The depth up to which statistics are printed.
*/
@@ -95,6 +98,14 @@
this.depth = depth;
}
+ /** Sets whether or not to print summaries.
+ * @param printSummaries <code>true</code> to print summaries, otherwise <code>false</code>.
+ */
+ @Option({"s", "summary"})
+ public void setPrintSummary(@NotNull final Boolean printSummaries) {
+ this.printSummaries = printSummaries;
+ }
+
/** Returns the depth up to which statistics are printed.
* @return The depth up to which statistics are printed.
*/
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java 2009-02-01 16:27:10 UTC (rev 784)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java 2009-02-01 16:28:43 UTC (rev 785)
@@ -53,7 +53,7 @@
}
@SuppressWarnings({"AssignmentToCollectionOrArrayFieldFromParameter"})
- FileStat(final List<LineCheck> checkers, @NotNull final File file) {
+ FileStat(final List<LineCheck> checkers, @NotNull final File file, final boolean printSummaries) {
this.checkers = checkers;
this.file = file;
title = file.toString();
@@ -79,16 +79,18 @@
}
if (file.isDirectory()) {
for (final File member : file.listFiles()) {
- addChild(member);
+ addChild(member, printSummaries);
}
}
- treeWarnings();
+ if (printSummaries) {
+ treeWarnings();
+ }
}
void treeWarnings() {
for (final LineCheck lineCheck : checkers) {
final Integer i = checkWarnings.get(lineCheck);
if (i != null && i > 0) {
- System.err.println(file + ": " + lineCheck.getType() + ": " + i + " " + lineCheck.getPlural());
+ System.err.println(file + ": " + lineCheck.getMessageType() + ": " + i + " " + lineCheck.getPlural());
}
}
if (warnings > 0) {
@@ -111,17 +113,29 @@
/** Adds a child with the specified filename.
* @param filename Filename of the child to add.
*/
- public void addChild(final String filename) {
- addChild(new File(filename));
+ public void addChild(final String filename, final boolean printSummaries) {
+ addChild(new File(filename), printSummaries);
}
/** Adds a child with the specified file.
* @param file File of the child to add.
*/
- public void addChild(final File file) {
- addChild(new FileStat(checkers, file));
+ public void addChild(final File file, final boolean printSummaries) {
+ if (!isIgnored(file)) {
+ addChild(new FileStat(checkers, file, printSummaries));
+ }
}
+ /** Returns whether or not a file is ignored.
+ * @param file File that might be ignored.
+ * @return <code>true</code> if <var>file</var> is ignored, otherwise <code>false</code>.
+ */
+ public boolean isIgnored(@NotNull final File file) {
+ final String filename = file.getName();
+ // TODO:christianhujer:This should be configurable.
+ return ".svn".equals(filename);
+ }
+
/** Adds a child with the specified statistics.
* @param child Child to add.
*/
@@ -153,8 +167,10 @@
* @throws IOException In case of I/O problems.
*/
public void printStatistic(@NotNull final Appendable out, final int level) throws IOException {
- out.append("Title;Errors;Raw lines;Lines w/o comments;Comment lines;Sloc\n");
- print(out, level);
+ if (level > 0) {
+ out.append("Title;Errors;Raw lines;Lines w/o comments;Comment lines;Sloc\n");
+ print(out, level);
+ }
}
/** Prints recursive statistics to the specified appendable.
@@ -165,7 +181,7 @@
public void print(final Appendable out, final int level) throws IOException {
out.append(toString());
out.append("\n");
- if (level > 0) {
+ if (level > 1) {
for (final File file : new TreeSet<File>(children.keySet())) {
children.get(file).print(out, level - 1);
}
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java 2009-02-01 16:27:10 UTC (rev 784)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java 2009-02-01 16:28:43 UTC (rev 785)
@@ -13,7 +13,7 @@
public class LineCheck {
/** The message type to emit if this check found something. */
- @NotNull private final MessageType type;
+ @NotNull private final MessageType messageType;
/** The name of this check. */
@NotNull private final String name;
@@ -30,17 +30,17 @@
* @param elem XML Element with the check information.
*/
public LineCheck(@NotNull final Element elem) {
- this(Enum.valueOf(MessageType.class, elem.getAttribute("type")), elem.getAttribute("name"), Pattern.compile(elem.getAttribute("regex")), elem.getAttribute("message"));
+ this(Enum.valueOf(MessageType.class, elem.getAttribute("messageType")), elem.getAttribute("name"), Pattern.compile(elem.getAttribute("regex")), elem.getAttribute("message"));
}
/** Create a line check.
- * @param type The message type to emit if this check found something.
+ * @param messageType The message type to emit if this check found something.
* @param name The name of this check.
* @param regex The regular expression for this check.
* @param message The message to emit if this check found something.
*/
- public LineCheck(@NotNull final MessageType type, @NotNull final String name, @NotNull final Pattern regex, @NotNull final String message) {
- this.type = type;
+ public LineCheck(@NotNull final MessageType messageType, @NotNull final String name, @NotNull final Pattern regex, @NotNull final String message) {
+ this.messageType = messageType;
this.name = name;
this.regex = regex;
this.message = message;
@@ -58,7 +58,7 @@
if (m.find()) {
final int column = m.start();
ret = true;
- LogSystem.log(new LogEntry(file, line, lineNumber, column + 1, type, name, message));
+ LogSystem.log(new LogEntry(file, line, lineNumber, column + 1, messageType, name, message));
}
return ret;
}
@@ -70,14 +70,14 @@
return name;
}
- /** Returns the type of this check.
- * @return The type of this check.
+ /** Returns the message type of this check.
+ * @return The message type of this check.
*/
- @NotNull public MessageType getType() {
- return type;
+ @NotNull public MessageType getMessageType() {
+ return messageType;
}
- /** returns the plural name of this check.
+ /** Returns the plural name of this check.
* @return The plural name of this check.
*/
@NotNull public String getPlural() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-02-01 16:27:15
|
Revision: 784
http://japi.svn.sourceforge.net/japi/?rev=784&view=rev
Author: christianhujer
Date: 2009-02-01 16:27:10 +0000 (Sun, 01 Feb 2009)
Log Message:
-----------
Improved example checker configuration.
Modified Paths:
--------------
tools/archStat/trunk/src/prj/net/sf/japi/archstat/Checker.xml
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/Checker.xml
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/Checker.xml 2009-01-24 22:43:02 UTC (rev 783)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/Checker.xml 2009-02-01 16:27:10 UTC (rev 784)
@@ -8,65 +8,138 @@
<filetype id="Asm" groups="AsmSource AsmHeader" description="Assembly Language (Source and Header)"/>
<filetype id="Java" match="^.+\.(java)$" description="Java Source"/>
<filetype id="Jpp" match="^.+\.(jpp)$" description="Jpp Source"/>
- <filetype id="Curly" groups="C Asm Java Jpp" description="Java and Jpp Source"/>
+ <filetype id="Curly" groups="C Java Jpp" description="Curly brace language source"/>
<filetype id="Makefile" match="^(Makefile|.+\.mak)$" description="Makefile" />
+ <filetype id="All" groups="Curly Asm Makefile" description="All files" />
</filetypes>
<patterns>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="bogusLintSuppression"
- regex="/[/*] lint"
- message="Bogus lint suppression."
- />
+ regex="/[/*] +lint"
+ message="Bogus lint suppression - lint suppression with no effect."
+ filetypes="C"
+ >
+ The way the lint suppression is written causes the lint suppression to have no effect.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="trailingWhitespace"
regex="[\p{javaWhitespace}&&[^\p{Zl}]]+?(\r\n|\r|\n)$"
message="Trailing whitespace."
- />
+ filetypes="All"
+ >
+ Trailing whitespace is redundant, hinders searching and can be a cause of merge problems.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="unixLine"
regex="[^\r]\n$"
message="Unix line."
- />
+ filetypes="All"
+ >
+ Use DOS line endings only to make sure the files are editable with stanard windows editors.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
+ name="platformIntegerType"
+ regex="\b(char|short|int|long)\b"
+ message="Platform integer type."
+ filetypes="C"
+ >
+ You used a type of which the sign (char) or size may vary depending on the platform.
+ Instead use an ISO/IEC 9899:1999 integer type.
+ </pattern>
+ <pattern
+ match="line"
+ messageType="WARNING"
name="oldIntegerType"
regex="\b[US](08|16|32)_(EXACT|FAST)\b"
message="Old integer type."
- />
+ filetypes="C"
+ >
+ You used an old integer type.
+ Use ISO/IEC 9899:1999 integer types like uint8_t or int_fast32_t instead.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="oldBooleanType"
regex="\bBOOL(_FAST)?\b"
message="Old boolean type."
- />
+ filetypes="C"
+ >
+ You used an old boolean type.
+ Use the ISO/IEC 9899:1999 type bool instead.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
+ name="internalBooleanType"
+ regex="\b_Bool\b"
+ message="Internal boolean type."
+ filetypes="C"
+ >
+ You used the internal boolean type.
+ Use the ISO/IEC 9899:1999 external type bool instead.
+ </pattern>
+ <pattern
+ match="line"
+ messageType="WARNING"
name="tab"
regex="\t"
message="Tab character."
- />
+ filetypes="Curly"
+ >
+ Do not use tab for indention.
+ Use spaces instead.
+ Hint: most editors can be configured to insert spaces instead of tabs.
+ The optimum configuration for an editor is:
+ indent 4 spaces if a user uses tab,
+ align to 8 if a tab is found in a file.
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="commentStart"
regex="/\*\*\s*?[\r\n]"
message="Documentation comment text doesn't start in first line of documentation comment."
- />
+ filetypes="Curly"
+ >
+ If you start a documentation comment, the text should start in the first line, not later, e.g.
+ /** Flushes the cache.
+ * ...
+ */
+ </pattern>
<pattern
match="line"
- type="WARNING"
+ messageType="WARNING"
name="oldStyleComment"
regex="(\*{3,}|/{3,})"
message="Old style comment."
+ filetypes="Curly"
/>
+ <pattern
+ match="line"
+ messageType="WARNING"
+ name="krbraces"
+ regex="^[\p{javaWhitespace}&&[^\p{Zl}]]+?(\{|else|catch|finally)"
+ message="Bogus brace style found. Use K&R brace style."
+ filetypes="Curly"
+ >
+ </pattern>
+ <!--pattern
+ match="line"
+ messageType="WARNING"
+ name="spaces"
+ regex="^ "
+ message="Bogus indention in Makefile - use tabs, not spaces."
+ filetypes="Makefile"
+ >
+ </pattern-->
</patterns>
</config>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-24 22:43:09
|
Revision: 783
http://japi.svn.sourceforge.net/japi/?rev=783&view=rev
Author: christianhujer
Date: 2009-01-24 22:43:02 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
Split SuperClassIterable from SuperClassIterator.
Modified Paths:
--------------
libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterator.java
libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java
libs/swing-action/trunk/src/prj/net/sf/japi/swing/ReflectionAction.java
Added Paths:
-----------
libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterable.java
Added: libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterable.java
===================================================================
--- libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterable.java (rev 0)
+++ libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterable.java 2009-01-24 22:43:02 UTC (rev 783)
@@ -0,0 +1,25 @@
+package net.sf.japi.lang;
+
+import java.util.Iterator;
+
+/**
+ * Iterable for iterating all superclasses of a class (including the class itself).
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class SuperClassIterable implements Iterable<Class<?>> {
+
+ /** The class to iterate. */
+ private final Class<?> clazz;
+
+ /** Creates a SuperClassIterable.
+ * @param clazz Class to iterate.
+ */
+ public SuperClassIterable(final Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ /** {@inheritDoc} */
+ public Iterator<Class<?>> iterator() {
+ return new SuperClassIterator(clazz);
+ }
+}
Property changes on: libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterable.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Modified: libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterator.java
===================================================================
--- libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterator.java 2009-01-24 22:41:52 UTC (rev 782)
+++ libs/lang/trunk/src/prj/net/sf/japi/lang/SuperClassIterator.java 2009-01-24 22:43:02 UTC (rev 783)
@@ -29,7 +29,7 @@
* Note: The supplied class is included in iteration. If you want to omit it, you'll have to invoke getSuperclass() once, e.g. use <code>new SuperClassIterator(clazz.getSuperClass())</code> instead of <code>new SuperClassIterator(clazz)</code>.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
-public class SuperClassIterator implements Iterator<Class<?>>, Iterable<Class<?>> {
+public class SuperClassIterator implements Iterator<Class<?>> {
/** The current class. */
@Nullable private Class<?> nextClass;
@@ -64,9 +64,4 @@
throw new UnsupportedOperationException();
}
- /** {@inheritDoc} */
- @NotNull public Iterator<Class<?>> iterator() {
- return this;
- }
-
} // class ClassIterator
Modified: libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java
===================================================================
--- libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java 2009-01-24 22:41:52 UTC (rev 782)
+++ libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java 2009-01-24 22:43:02 UTC (rev 783)
@@ -20,12 +20,12 @@
package test.net.sf.japi.lang;
import java.util.NoSuchElementException;
+import net.sf.japi.lang.SuperClassIterable;
import net.sf.japi.lang.SuperClassIterator;
import org.junit.Assert;
import org.junit.Test;
/** Test for {@link SuperClassIterator}.
- * Created by IntelliJ IDEA.
*
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
@@ -66,10 +66,10 @@
it.remove();
}
- /** Tests that using {@link SuperClassIterator} as Iterable works. */
+ /** Tests that using {@link SuperClassIterable} as Iterable works. */
@Test
public void testIterable() {
- for (final Class c : new SuperClassIterator(String.class)) {
+ for (final Class c : new SuperClassIterable(String.class)) {
if (!c.equals(String.class) && !c.equals(Object.class)) {
Assert.assertTrue("Expected String.class or Object.class.", false);
}
Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/ReflectionAction.java
===================================================================
--- libs/swing-action/trunk/src/prj/net/sf/japi/swing/ReflectionAction.java 2009-01-24 22:41:52 UTC (rev 782)
+++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/ReflectionAction.java 2009-01-24 22:43:02 UTC (rev 783)
@@ -25,7 +25,7 @@
import java.lang.reflect.Method;
import javax.swing.AbstractAction;
import javax.swing.Icon;
-import net.sf.japi.lang.SuperClassIterator;
+import net.sf.japi.lang.SuperClassIterable;
import static net.sf.japi.swing.ActionBuilder.ACTION_ID;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -182,7 +182,7 @@
final ActionBuilder actionBuilder = (ActionBuilder) getValue(REFLECTION_MESSAGE_PROVIDER);
final Throwable cause = ex.getCause();
if (actionBuilder != null) {
- for (final Class<?> c : new SuperClassIterator(cause.getClass())) {
+ for (final Class<?> c : new SuperClassIterable(cause.getClass())) {
final String dialogKey = getValue(ACTION_ID) + ".exception." + c.getName();
final String title = actionBuilder.getString(dialogKey + ".title");
if (title != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-24 22:41:57
|
Revision: 782
http://japi.svn.sourceforge.net/japi/?rev=782&view=rev
Author: christianhujer
Date: 2009-01-24 22:41:52 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
i18n/l10n for the name of a new unnamed file.
Modified Paths:
--------------
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/action.properties
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2009-01-24 22:15:07 UTC (rev 781)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2009-01-24 22:41:52 UTC (rev 782)
@@ -188,7 +188,7 @@
if (currentUri != null) {
fileChooser.setSelectedFile(new File(new URI(currentUri)));
} else {
- fileChooser.setSelectedFile(new File("Unnamed")); // TODO:christianhujer:I18N/L10N of file name
+ fileChooser.setSelectedFile(new File(actionBuilder.getString("unnamedFile.name")));
}
if (fileChooser.showSaveDialog(appFrame) == JFileChooser.APPROVE_OPTION) {
final File file = fileChooser.getSelectedFile();
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/action.properties
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/action.properties 2009-01-24 22:15:07 UTC (rev 781)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/action.properties 2009-01-24 22:41:52 UTC (rev 782)
@@ -82,3 +82,5 @@
documentNotSaved.message={0} contains unsaved changes.\nSave before closing?
documentNotSaved.title=Not saved.
+
+unnamedFile.name=Unnamed
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-24 22:29:02
|
Revision: 781
http://japi.svn.sourceforge.net/japi/?rev=781&view=rev
Author: christianhujer
Date: 2009-01-24 22:15:07 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
Finished handling of arguments that start with '@', '@' is escaped with '@@'.
Modified Paths:
--------------
libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-01-12 06:45:57 UTC (rev 780)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-01-24 22:15:07 UTC (rev 781)
@@ -43,11 +43,11 @@
* @todo better handling of boolean arguments
* @todo Handling of - for STDIN as input argument filestream
* @todo automatic printout of default values if property getter available.
- * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor). If long options with one dash are supported, short option concatenation should be disabled.
+ * @todo Let the programmer choose whether long options with one dash should be supported (for Ragnor).
+ * If long options with one dash are supported, short option concatenation should be disabled.
* @todo Abbreviation of long options as long as the abbreviation is unique
* @todo Alternative way of getting arguments by a callback mechanism which processes single arguments.
* @todo Move option names into a / the properties file.
- * @todo Handling of arguments that start with '@'. Escape with '@@'?
*/
public final class ArgParser {
@@ -117,10 +117,14 @@
}
if (arg.startsWith("@")) {
iterator.remove();
- final String filename = arg.substring(1);
- final File file = new File(context.getParentFile(), filename);
- for (final String insertArg : getAllArguments(file, readFromFile(file))) {
- iterator.add(insertArg);
+ if (arg.startsWith("@@")) {
+ iterator.add(arg.substring(1));
+ } else {
+ final String filename = arg.substring(1);
+ final File file = new File(context.getParentFile(), filename);
+ for (final String insertArg : getAllArguments(file, readFromFile(file))) {
+ iterator.add(insertArg);
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 06:46:00
|
Revision: 780
http://japi.svn.sourceforge.net/japi/?rev=780&view=rev
Author: christianhujer
Date: 2009-01-12 06:45:57 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Fixed minor checkstyle issue.
Modified Paths:
--------------
libs/argparser/branches/0.2/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
libs/argparser/tags/0.2.0/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
Modified: libs/argparser/branches/0.2/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
===================================================================
--- libs/argparser/branches/0.2/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:42:45 UTC (rev 779)
+++ libs/argparser/branches/0.2/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:45:57 UTC (rev 780)
@@ -23,6 +23,7 @@
import java.util.Locale;
/** Generic converter for Enum classes.
+ * @param <T> target type to convert to.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
public class EnumConverter<T extends Enum> extends AbstractConverter<T> {
Modified: libs/argparser/tags/0.2.0/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
===================================================================
--- libs/argparser/tags/0.2.0/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:42:45 UTC (rev 779)
+++ libs/argparser/tags/0.2.0/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:45:57 UTC (rev 780)
@@ -23,6 +23,7 @@
import java.util.Locale;
/** Generic converter for Enum classes.
+ * @param <T> target type to convert to.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
public class EnumConverter<T extends Enum> extends AbstractConverter<T> {
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:42:45 UTC (rev 779)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:45:57 UTC (rev 780)
@@ -23,6 +23,7 @@
import java.util.Locale;
/** Generic converter for Enum classes.
+ * @param <T> target type to convert to.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
public class EnumConverter<T extends Enum> extends AbstractConverter<T> {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 06:42:51
|
Revision: 779
http://japi.svn.sourceforge.net/japi/?rev=779&view=rev
Author: christianhujer
Date: 2009-01-12 06:42:45 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Updated svn:externals for branch 0.2 and tag 0.2.0 to be to a fixed revision.
Property Changed:
----------------
libs/argparser/branches/0.2/
libs/argparser/tags/0.2.0/
Property changes on: libs/argparser/branches/0.2
___________________________________________________________________
Modified: svn:externals
- common https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
+ common -r778 https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
Property changes on: libs/argparser/tags/0.2.0
___________________________________________________________________
Modified: svn:externals
- common https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
+ common -r778 https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 06:38:47
|
Revision: 778
http://japi.svn.sourceforge.net/japi/?rev=778&view=rev
Author: christianhujer
Date: 2009-01-12 06:38:46 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Creating release tag 0.2.0 for branch 0.2.
Added Paths:
-----------
libs/argparser/tags/0.2.0/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 06:37:47
|
Revision: 777
http://japi.svn.sourceforge.net/japi/?rev=777&view=rev
Author: christianhujer
Date: 2009-01-12 06:37:43 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Creating branch for 0.2.
Added Paths:
-----------
libs/argparser/branches/0.2/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 06:25:56
|
Revision: 776
http://japi.svn.sourceforge.net/japi/?rev=776&view=rev
Author: christianhujer
Date: 2009-01-12 06:25:53 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
[2500637] Converter for Enum.class missing
Modified Paths:
--------------
libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java
Added Paths:
-----------
libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/converter/EnumConverterTest.java
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java 2009-01-12 05:54:49 UTC (rev 775)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java 2009-01-12 06:25:53 UTC (rev 776)
@@ -79,10 +79,13 @@
@Nullable Converter<T> converter = (Converter<T>) converters.get(clazz);
if (converter == null) {
converter = getConstructorConverter(clazz);
- if (converter != null) {
- register(converter);
- }
}
+ if (converter == null && Enum.class.isAssignableFrom(clazz)) {
+ converter = (Converter<T>) getEnumConverter((Class<? extends Enum>) clazz);
+ }
+ if (converter != null) {
+ register(converter);
+ }
return converter;
}
@@ -150,4 +153,16 @@
}
}
+ /** Returns an enum converter for the target type.
+ * @param targetType target type to convert to.
+ * @return EnumConverter for the target type.
+ */
+ @Nullable public static <T extends Enum> EnumConverter<T> getEnumConverter(@NotNull final Class<T> targetType) {
+ try {
+ return new EnumConverter<T>(targetType);
+ } catch (final Exception ignore) {
+ return null;
+ }
+ }
+
} // class ConverterRegistry
Added: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java (rev 0)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java 2009-01-12 06:25:53 UTC (rev 776)
@@ -0,0 +1,42 @@
+/*
+ * JAPI libs-argparser is a library for parsing command line arguments.
+ * Copyright (C) 2009 Christian Hujer.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package net.sf.japi.io.args.converter;
+
+import org.jetbrains.annotations.NotNull;
+import java.util.Locale;
+
+/** Generic converter for Enum classes.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class EnumConverter<T extends Enum> extends AbstractConverter<T> {
+
+ /** Create an AbstractConverter.
+ * @param targetClass Enum class to convert to.
+ */
+ public EnumConverter(@NotNull final Class<T> targetClass) {
+ super(targetClass);
+ }
+
+ /** {@inheritDoc} */
+ @NotNull
+ public T convert(@NotNull final Locale locale, @NotNull final String arg) throws Exception {
+ return (T) Enum.valueOf(getTargetClass(), arg);
+ }
+}
Property changes on: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/EnumConverter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Added: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/converter/EnumConverterTest.java
===================================================================
--- libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/converter/EnumConverterTest.java (rev 0)
+++ libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/converter/EnumConverterTest.java 2009-01-12 06:25:53 UTC (rev 776)
@@ -0,0 +1,54 @@
+/*
+ * JAPI libs-argparser is a library for parsing command line arguments.
+ * Copyright (C) 2009 Christian Hujer.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package test.net.sf.japi.io.args.converter;
+
+import net.sf.japi.io.args.converter.ConverterRegistry;
+import net.sf.japi.io.args.converter.EnumConverter;
+import org.junit.Assert;
+import org.junit.Test;
+
+/** Test for {@link EnumConverter}.
+ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>
+ */
+public class EnumConverterTest {
+
+ /** Tests that existing enum constants are found by the EnumConverter.
+ * @throws Exception (unexpected).
+ */
+ @Test
+ public void testGetEnumConverter() throws Exception {
+ TestEnum v;
+
+ v = ConverterRegistry.convert(TestEnum.class, "EC1");
+ Assert.assertSame("Expecting \"EC1\" for TestEnum.class to be converted to TestEnum.EC1.", v, TestEnum.EC1);
+
+ v = ConverterRegistry.convert(TestEnum.class, "EC2");
+ Assert.assertSame("Expecting \"EC2\" for TestEnum.class to be converted to TestEnum.EC2.", v, TestEnum.EC2);
+ }
+
+ /** Test enum. */
+ enum TestEnum {
+ /** Test enum constant 1. */
+ EC1,
+
+ /** Test enum constant 2. */
+ EC2
+ }
+}
Property changes on: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/converter/EnumConverterTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2009-01-12 05:55:00
|
Revision: 775
http://japi.svn.sourceforge.net/japi/?rev=775&view=rev
Author: christianhujer
Date: 2009-01-12 05:54:49 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
[2500630] Print stacktrace if run() throws exception
Modified Paths:
--------------
libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-01-09 20:33:00 UTC (rev 774)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-01-12 05:54:49 UTC (rev 775)
@@ -93,6 +93,7 @@
returnCode = command.run(argList);
} catch (final Exception e) {
System.err.println(e);
+ e.printStackTrace();
returnCode = 1;
}
if (command.isExiting()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aki...@us...> - 2009-01-09 20:33:10
|
Revision: 774
http://japi.svn.sourceforge.net/japi/?rev=774&view=rev
Author: akirschbaum
Date: 2009-01-09 20:33:00 +0000 (Fri, 09 Jan 2009)
Log Message:
-----------
Allow copying text from about tab.
Modified Paths:
--------------
libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
Modified: libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java
===================================================================
--- libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2008-12-30 04:38:38 UTC (rev 773)
+++ libs/swing-about/trunk/src/prj/net/sf/japi/swing/about/AboutDialog.java 2009-01-09 20:33:00 UTC (rev 774)
@@ -22,6 +22,8 @@
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -34,6 +36,7 @@
import java.util.ResourceBundle;
import java.util.TreeSet;
import javax.swing.ImageIcon;
+import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -41,6 +44,7 @@
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
+import javax.swing.UIManager;
import net.sf.japi.swing.ActionBuilder;
import net.sf.japi.swing.ActionBuilderFactory;
import org.jetbrains.annotations.NotNull;
@@ -264,7 +268,16 @@
} catch (final MissingResourceException ignore) {
/* ignore */
}
- final Component aboutTab = new JLabel(actionBuilder.format("about", System.getProperty("java.version"), buildNumber, buildDeveloper, buildTstamp), SwingConstants.CENTER);
+ // use a JEditorPane which looks like a JLabel to allow copying its content
+ final JEditorPane editorPane = new JEditorPane("text/html", actionBuilder.format("about", System.getProperty("java.version"), buildNumber, buildDeveloper, buildTstamp));
+ editorPane.setEditable(false);
+ editorPane.setBorder(null);
+ editorPane.setForeground(UIManager.getColor("Label.foreground"));
+ editorPane.setFont(UIManager.getFont("Label.font"));
+ editorPane.setOpaque(false);
+ final JPanel aboutTab = new JPanel(new GridBagLayout());
+ final GridBagConstraints gbc = new GridBagConstraints();
+ aboutTab.add(editorPane, gbc);
aboutTab.setName(ACTION_BUILDER.getString("aboutTab.title"));
return aboutTab;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-30 04:38:43
|
Revision: 773
http://japi.svn.sourceforge.net/japi/?rev=773&view=rev
Author: christianhujer
Date: 2008-12-30 04:38:38 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
Fixed warnings.
Modified Paths:
--------------
libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
Modified: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
===================================================================
--- libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-30 03:12:18 UTC (rev 772)
+++ libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-30 04:38:38 UTC (rev 773)
@@ -20,7 +20,6 @@
package test.net.sf.japi.io.args;
import java.io.File;
-import java.io.IOException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
@@ -48,11 +47,9 @@
/** The path that needs to be used for the test to find its files. */
private static String pathPrefix;
- /** Finds the {@link #pathPrefix}.
- * @throws IOException if a canonical file resolution required for determining {@link #pathPrefix} failed.
- */
+ /** Finds the {@link #pathPrefix}. */
@BeforeClass
- public static void initPathPrefix() throws IOException {
+ public static void initPathPrefix() {
final String testPathname = "src/tst/test/net/sf/japi/io/args/ArgParserTest_OptionsFileSingleLine";
final File f = new File(testPathname);
if (f.exists()) {
@@ -69,34 +66,25 @@
}
}
- /**
- * Tests that {@link ArgParser#getOptionMethods(Command)} works.
- * @throws Exception (unexpected)
- */
+ /** Tests that {@link ArgParser#getOptionMethods(Command)} works. */
@Test
- public void testGetOptionMethodsCommand() throws Exception {
+ public void testGetOptionMethodsCommand() {
final Command commandDummy = new CommandDummy();
final Set<Method> optionMethods = ArgParser.getOptionMethods(commandDummy);
Assert.assertFalse("There are some option methods in CommandDummy.", optionMethods.isEmpty());
}
- /**
- * Tests that {@link ArgParser#getOptionMethods(Class)} works.
- * @throws Exception (unexpected)
- */
+ /** Tests that {@link ArgParser#getOptionMethods(Class)} works. */
@Test
- public void testGetOptionMethodsClass() throws Exception {
+ public void testGetOptionMethodsClass() {
final Set<Method> optionMethods = ArgParser.getOptionMethods(CommandDummy.class);
Assert.assertFalse("There are some option methods in CommandDummy.", optionMethods.isEmpty());
}
- /**
- * Tests that {@link ArgParser#simpleParseAndRun(Command, String[])} works.
- * @throws Exception (unexpected)
- */
+ /** Tests that {@link ArgParser#simpleParseAndRun(Command, String[])} works. */
@SuppressWarnings({"JUnitTestMethodWithNoAssertions"})
@Test
- public void testSimpleParseAndRun() throws Exception {
+ public void testSimpleParseAndRun() {
final Command commandDummy = new CommandDummy();
ArgParser.simpleParseAndRun(commandDummy);
// No assertions. It's an implicite check that no exception is thrown.
@@ -104,11 +92,15 @@
/**
* Tests that {@link ArgParser#parseAndRun(Command, String[])} works.
- * @throws Exception (unexpected)
+ * @throws ArgumentFileNotFoundException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
*/
@SuppressWarnings({"JUnitTestMethodWithNoAssertions"})
@Test
- public void testParseAndRun() throws Exception {
+ public void testParseAndRun() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
final Command commandDummy = new CommandDummy();
ArgParser.parseAndRun(commandDummy);
// No assertions. It's an implicite check that no exception is thrown.
@@ -116,11 +108,11 @@
/**
* Tests that supplying a required option with argument in short form works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testCommandWithShortOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -133,11 +125,11 @@
/**
* Tests that supplying a required option with argument in long form with separate argument works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testCommandWithLongOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -150,11 +142,11 @@
/**
* Tests that supplying a required option with argument in long form with integrated argument works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testCommandWithLongOptEq() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -167,11 +159,11 @@
/**
* Tests that it's detected that a required option is missing.
- * @throws RequiredOptionsMissingException (expected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (expected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = RequiredOptionsMissingException.class)
public void testCommandRequiredOptionMissing() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException {
@@ -185,11 +177,11 @@
/**
* Tests that it's not detected that a required option is missing if the command doesn't want it.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
* @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1751332&group_id=149894&atid=776740">[ 1751332 ] Required options check should be optional / configurable</a>
*/
@SuppressWarnings({"JUnitTestMethodWithNoAssertions"})
@@ -202,11 +194,11 @@
/**
* Tests that it's detected that an unknown option was given.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (expected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (expected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = UnknownOptionException.class)
public void testCommandUnknownOption() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException {
@@ -220,11 +212,11 @@
/**
* Tests that it's detected that the argument of an option that requires an argument is missing.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (expected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (expected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = MissingArgumentException.class)
public void testCommandMissingArgument() throws RequiredOptionsMissingException, TerminalException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException {
@@ -238,11 +230,11 @@
/**
* Tests that specifying an option twice works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testCommandDuplicateOption() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -255,11 +247,11 @@
/**
* Tests that help works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (expected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (expected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = TerminalException.class)
public void testHelp() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -269,11 +261,11 @@
/**
* Tests that stopping option parsing with -- works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testStopOptionParsing() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -286,11 +278,11 @@
/**
* Tests that reading options from a file works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
* @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750193&group_id=149894&atid=776740">[ 1750193 ] Partial read of command line arguments from a file</a>
*/
@Test
@@ -307,11 +299,11 @@
/**
* Tests that including multiple command files from a command file works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
* @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1758846&group_id=149894&atid=776737">[ 1758846 ] Multiple command file inclusion fails</a>
*/
@Test
@@ -328,11 +320,11 @@
/**
* Tests that including multiple command files from a command file works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (expected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (expected).
*/
@Test(expected = ArgumentFileNotFoundException.class)
public void testOptionsFromFileNotFound() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -342,11 +334,11 @@
/**
* Tests that single dash options also work.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
* @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750198&group_id=149894&atid=776740">[ 1750198 ] Allow single dash instead of double dash</a>
*/
@Test
@@ -360,11 +352,11 @@
/**
* Tests that single dash options also work.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
* @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1750198&group_id=149894&atid=776740">[ 1750198 ] Allow single dash instead of double dash</a>
*/
@Test
@@ -378,11 +370,11 @@
/**
* Tests that GNU style options with -W are accepted and processed properly.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testPosixStyleLong() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
@@ -396,11 +388,11 @@
/**
* Tests that -W is not allowed.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = IllegalArgumentException.class)
public void testNoWOption() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -412,11 +404,11 @@
/**
* Tests that option names do not start with '-'.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = IllegalArgumentException.class)
public void testNoMinusStart() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -428,11 +420,11 @@
/**
* Tests that an option without text is detected.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = IllegalArgumentException.class)
public void testEmptyOption() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -444,11 +436,11 @@
/**
* Tests that an option with empty name is detected.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = IllegalArgumentException.class)
public void testEmptyStringOption() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -460,11 +452,11 @@
/**
* Tests that a single dash is not treated as option.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testSingleDash() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -477,7 +469,7 @@
/**
* Tests that reading an argument file that doesn't exist throws an ArgumentFileNotFoundexception.
- * @throws ArgumentFileNotFoundException (expected)
+ * @throws ArgumentFileNotFoundException (expected).
*/
@Test(expected = ArgumentFileNotFoundException.class)
public void testArgumentFileNotFound() throws ArgumentFileNotFoundException {
@@ -486,11 +478,11 @@
/**
* Tests that declaring an option twice is detected.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = IllegalArgumentException.class)
public void testDoubleOptionDetected() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -511,11 +503,11 @@
/**
* Tests that putting short options together works.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (unexpected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (unexpected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test
public void testShortOptionsInOneOption() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -529,11 +521,11 @@
/**
* Tests that a missing argument is detected.
- * @throws RequiredOptionsMissingException (unexpected)
- * @throws TerminalException (unexpected)
- * @throws UnknownOptionException (unexpected)
- * @throws MissingArgumentException (expected)
- * @throws ArgumentFileNotFoundException (unexpected)
+ * @throws RequiredOptionsMissingException (unexpected).
+ * @throws TerminalException (unexpected).
+ * @throws UnknownOptionException (unexpected).
+ * @throws MissingArgumentException (expected).
+ * @throws ArgumentFileNotFoundException (unexpected).
*/
@Test(expected = MissingArgumentException.class)
public void testMissingArgument() throws ArgumentFileNotFoundException, UnknownOptionException, MissingArgumentException, RequiredOptionsMissingException, TerminalException {
@@ -545,6 +537,7 @@
* This MockCommand serves as a command for performing simple tests.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
+ @SuppressWarnings({"InstanceVariableMayNotBeInitialized"})
public static class MockCommand extends BasicCommand {
/** The input option value. */
@@ -607,6 +600,7 @@
* Get the value of the input option.
* @return Value of the input option.
*/
+ @SuppressWarnings({"TypeMayBeWeakened"})
private String getInput() {
return input;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-30 03:12:22
|
Revision: 772
http://japi.svn.sourceforge.net/japi/?rev=772&view=rev
Author: christianhujer
Date: 2008-12-30 03:12:18 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
Made test run from Ant and from IntelliJ IDEA by finding paths itself.
Modified Paths:
--------------
libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
Modified: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
===================================================================
--- libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-29 20:42:03 UTC (rev 771)
+++ libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-30 03:12:18 UTC (rev 772)
@@ -20,6 +20,7 @@
package test.net.sf.japi.io.args;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
@@ -35,6 +36,7 @@
import net.sf.japi.io.args.UnknownOptionException;
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -43,6 +45,30 @@
*/
public class ArgParserTest {
+ /** The path that needs to be used for the test to find its files. */
+ private static String pathPrefix;
+
+ /** Finds the {@link #pathPrefix}.
+ * @throws IOException if a canonical file resolution required for determining {@link #pathPrefix} failed.
+ */
+ @BeforeClass
+ public static void initPathPrefix() throws IOException {
+ final String testPathname = "src/tst/test/net/sf/japi/io/args/ArgParserTest_OptionsFileSingleLine";
+ final File f = new File(testPathname);
+ if (f.exists()) {
+ // We already are at a location where the test files can be found.
+ // That's the case if run from Ant.
+ // No pathPrefix needed.
+ pathPrefix = "";
+ } else {
+ // The test pathname was not found.
+ // That's the case if run from IntelliJ IDEA with japi.ipr.
+ // That means the cwd is japi and paths need to be prefixed with the module directory path.
+ pathPrefix = "libs/argparser/trunk/";
+ assert new File(pathPrefix, testPathname).exists();
+ }
+ }
+
/**
* Tests that {@link ArgParser#getOptionMethods(Command)} works.
* @throws Exception (unexpected)
@@ -270,7 +296,7 @@
@Test
public void testOptionsFromFileSingleLine() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
final MockCommand command = new MockCommand();
- ArgParser.parseAndRun(command, "@src/tst/test/net/sf/japi/io/args/ArgParserTest_OptionsFileSingleLine");
+ ArgParser.parseAndRun(command, "@" + pathPrefix + "src/tst/test/net/sf/japi/io/args/ArgParserTest_OptionsFileSingleLine");
final List<String> args = command.getArgs();
Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput());
Assert.assertTrue("Run must be called even with zero arguments.", command.isRunCalled());
@@ -291,7 +317,7 @@
@Test
public void testOptionsFromFileMultiple() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException, ArgumentFileNotFoundException {
final MockCommand command = new MockCommand();
- ArgParser.parseAndRun(command, "@src/tst/test/net/sf/japi/io/args/ArgParserTest_MultipleOptionsFileMaster");
+ ArgParser.parseAndRun(command, "@" + pathPrefix + "src/tst/test/net/sf/japi/io/args/ArgParserTest_MultipleOptionsFileMaster");
final List<String> args = command.getArgs();
Assert.assertEquals("Option value must be stored.", "fooInput", command.getInput());
Assert.assertTrue("Run must be called even with zero arguments.", command.isRunCalled());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 20:42:06
|
Revision: 771
http://japi.svn.sourceforge.net/japi/?rev=771&view=rev
Author: christianhujer
Date: 2008-12-29 20:42:03 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Added pffhtrain module.
Added Paths:
-----------
progs/pffhtrain/trunk/pffhtrain.iml
Added: progs/pffhtrain/trunk/pffhtrain.iml
===================================================================
--- progs/pffhtrain/trunk/pffhtrain.iml (rev 0)
+++ progs/pffhtrain/trunk/pffhtrain.iml 2008-12-29 20:42:03 UTC (rev 771)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/doc" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/prj" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/tst" isTestSource="true" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/common/lib/annotations.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/common/lib/junit.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ </component>
+</module>
+
Property changes on: progs/pffhtrain/trunk/pffhtrain.iml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:eol-style
+ LF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 20:32:46
|
Revision: 770
http://japi.svn.sourceforge.net/japi/?rev=770&view=rev
Author: christianhujer
Date: 2008-12-29 20:32:45 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Added src directory structure.
Added Paths:
-----------
progs/pffhtrain/trunk/src/
progs/pffhtrain/trunk/src/doc/
progs/pffhtrain/trunk/src/prj/
progs/pffhtrain/trunk/src/tst/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 20:31:07
|
Revision: 769
http://japi.svn.sourceforge.net/japi/?rev=769&view=rev
Author: christianhujer
Date: 2008-12-29 20:31:04 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Add structure for prog pffhtrain.
Added Paths:
-----------
progs/pffhtrain/
progs/pffhtrain/branches/
progs/pffhtrain/tags/
progs/pffhtrain/trunk/
Property changes on: progs/pffhtrain/trunk
___________________________________________________________________
Added: svn:externals
+ common https://japi.svn.sourceforge.net/svnroot/japi/common/trunk
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:56:04
|
Revision: 768
http://japi.svn.sourceforge.net/japi/?rev=768&view=rev
Author: christianhujer
Date: 2008-12-29 04:56:02 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Unit Tests: Replaced mixture of JUnit 3 and JUnit 4 by pure JUnit 4 usage.
Modified Paths:
--------------
libs/util/trunk/src/tst/test/net/sf/japi/util/Arrays2Test.java
Modified: libs/util/trunk/src/tst/test/net/sf/japi/util/Arrays2Test.java
===================================================================
--- libs/util/trunk/src/tst/test/net/sf/japi/util/Arrays2Test.java 2008-12-29 04:53:42 UTC (rev 767)
+++ libs/util/trunk/src/tst/test/net/sf/japi/util/Arrays2Test.java 2008-12-29 04:56:02 UTC (rev 768)
@@ -21,15 +21,15 @@
package test.net.sf.japi.util;
import java.util.Arrays;
-import junit.framework.TestCase;
import net.sf.japi.util.Arrays2;
import net.sf.japi.util.filter.Filter;
+import org.junit.Assert;
import org.junit.Test;
/** Test for {@link Arrays2}.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
-public class Arrays2Test extends TestCase {
+public class Arrays2Test {
/** Test case for {@link Arrays2#concat(byte[]...)}. */
@Test
@@ -40,9 +40,9 @@
final byte[] data2Copy = data2Orig.clone();
final byte[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final byte[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(short[]...)}. */
@@ -54,9 +54,9 @@
final short[] data2Copy = data2Orig.clone();
final short[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final short[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(int[]...)}. */
@@ -68,9 +68,9 @@
final int[] data2Copy = data2Orig.clone();
final int[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final int[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(long[]...)}. */
@@ -82,9 +82,9 @@
final long[] data2Copy = data2Orig.clone();
final long[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final long[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(float[]...)}. */
@@ -96,9 +96,9 @@
final float[] data2Copy = data2Orig.clone();
final float[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final float[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(double[]...)}. */
@@ -110,9 +110,9 @@
final double[] data2Copy = data2Orig.clone();
final double[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final double[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(char[]...)}. */
@@ -124,9 +124,9 @@
final char[] data2Copy = data2Orig.clone();
final char[] concatExpected = {1, 2, 3, 4, 5, 6, 7};
final char[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(boolean[]...)}. */
@@ -138,9 +138,9 @@
final boolean[] data2Copy = data2Orig.clone();
final boolean[] concatExpected = {true, false, true, false, true, false, false};
final boolean[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#concat(Object[][])}. */
@@ -152,9 +152,9 @@
final String[] data2Copy = data2Orig.clone();
final String[] concatExpected = {"1", "2", "3", "4", "5", "6", "7"};
final String[] concatResult = Arrays2.concat(data1Copy, data2Copy);
- assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
- assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
- assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data1Orig, data1Copy));
+ Assert.assertTrue("Original arrays must be unmodified", Arrays.equals(data2Orig, data2Copy));
+ Assert.assertTrue("Concatenation must correctly concatenate", Arrays.equals(concatExpected, concatResult));
}
/** Test case for {@link Arrays2#filter(Filter, Object[])}. */
@@ -169,8 +169,8 @@
};
final String[] expected = {"foo1", "foo2", "foo3"};
final String[] actual = Arrays2.filter(filter, dataCopy);
- assertTrue("Original array must be unmodified", Arrays.equals(dataOrig, dataCopy));
- assertTrue("Filter must filter correctly.", Arrays.equals(expected, actual));
+ Assert.assertTrue("Original array must be unmodified", Arrays.equals(dataOrig, dataCopy));
+ Assert.assertTrue("Filter must filter correctly.", Arrays.equals(expected, actual));
}
/** Test case for {@link Arrays2#count(Filter, Object[])}. */
@@ -185,20 +185,20 @@
};
final int expected = 3;
final int actual = Arrays2.count(filter, dataCopy);
- assertTrue("Original array must be unmodified", Arrays.equals(dataOrig, dataCopy));
- assertEquals("Count must count correctly.", expected, actual);
+ Assert.assertTrue("Original array must be unmodified", Arrays.equals(dataOrig, dataCopy));
+ Assert.assertEquals("Count must count correctly.", expected, actual);
}
/** Test case for {@link Arrays2#linearSearch(int, int[])}. */
@Test
public void testLinearSearch() {
final int[] data = { 0, 1, 2, 3 };
- assertEquals(-1, Arrays2.linearSearch(-1, data));
- assertEquals(0, Arrays2.linearSearch(0, data));
- assertEquals(1, Arrays2.linearSearch(1, data));
- assertEquals(2, Arrays2.linearSearch(2, data));
- assertEquals(3, Arrays2.linearSearch(3, data));
- assertEquals(-1, Arrays2.linearSearch(4, data));
+ Assert.assertEquals(-1, Arrays2.linearSearch(-1, data));
+ Assert.assertEquals(0, Arrays2.linearSearch(0, data));
+ Assert.assertEquals(1, Arrays2.linearSearch(1, data));
+ Assert.assertEquals(2, Arrays2.linearSearch(2, data));
+ Assert.assertEquals(3, Arrays2.linearSearch(3, data));
+ Assert.assertEquals(-1, Arrays2.linearSearch(4, data));
}
} // class Arrays2Test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:53:46
|
Revision: 767
http://japi.svn.sourceforge.net/japi/?rev=767&view=rev
Author: christianhujer
Date: 2008-12-29 04:53:42 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Unit Tests: Replaced assertEquals() with assertSame() where assertSame() makes more sense.
Modified Paths:
--------------
libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java
Modified: libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java
===================================================================
--- libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java 2008-12-29 04:52:27 UTC (rev 766)
+++ libs/lang/trunk/src/tst/test/net/sf/japi/lang/SuperClassIteratorTest.java 2008-12-29 04:53:42 UTC (rev 767)
@@ -36,9 +36,9 @@
public void testIteration() {
final SuperClassIterator it = new SuperClassIterator(String.class);
Assert.assertTrue("Must have next.", it.hasNext());
- Assert.assertEquals("First class must be String.class.", String.class, it.next());
+ Assert.assertSame("First class must be String.class.", String.class, it.next());
Assert.assertTrue("Must have next.", it.hasNext());
- Assert.assertEquals("Second class must be Object.class.", Object.class, it.next());
+ Assert.assertSame("Second class must be Object.class.", Object.class, it.next());
Assert.assertFalse("Must not have next now.", it.hasNext());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:52:28
|
Revision: 766
http://japi.svn.sourceforge.net/japi/?rev=766&view=rev
Author: christianhujer
Date: 2008-12-29 04:52:27 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Declared constructors in abstract classes protected instead of public.
Modified Paths:
--------------
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java 2008-12-29 04:51:39 UTC (rev 765)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Document.java 2008-12-29 04:52:27 UTC (rev 766)
@@ -44,7 +44,7 @@
* @param title Title.
* @param data Data for this document.
*/
- public Document(@Nullable final String uri, final String title, @NotNull final D data) {
+ protected Document(@Nullable final String uri, final String title, @NotNull final D data) {
this.uri = uri;
this.title = title;
this.data = data;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:51:44
|
Revision: 765
http://japi.svn.sourceforge.net/japi/?rev=765&view=rev
Author: christianhujer
Date: 2008-12-29 04:51:39 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Renamed unused catch parameter to "ignore".
Modified Paths:
--------------
historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
Modified: historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:48:11 UTC (rev 764)
+++ historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:51:39 UTC (rev 765)
@@ -101,7 +101,7 @@
public Object clone() {
try {
return super.clone();
- } catch ( CloneNotSupportedException e ) {
+ } catch ( CloneNotSupportedException ignore ) {
throw new InternalError();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:48:14
|
Revision: 764
http://japi.svn.sourceforge.net/japi/?rev=764&view=rev
Author: christianhujer
Date: 2008-12-29 04:48:11 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Added missing final modifiers.
Modified Paths:
--------------
historic/trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java
libs/swing-list/trunk/src/prj/net/sf/japi/swing/list/ArrayListModel.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java
libs/swing-recent/trunk/src/prj/net/sf/japi/swing/recent/RecentURLsMenu.java
libs/util/trunk/src/prj/net/sf/japi/util/filter/file/Factory.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/QuestionCollectionInfoGUI.java
tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java
Modified: historic/trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java
===================================================================
--- historic/trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java 2008-12-29 04:44:02 UTC (rev 763)
+++ historic/trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -29,7 +29,7 @@
*/
public class SimpleCapitalCalculatorTest extends TestCase {
- SimpleCapitalCalculator ic = new SimpleCapitalCalculator(100, 15);
+ final SimpleCapitalCalculator ic = new SimpleCapitalCalculator(100, 15);
public void testSimpleCapitalCalculator() throws Exception {
//ic = new SimpleCapitalCalculator(100, 15);
Modified: libs/swing-list/trunk/src/prj/net/sf/japi/swing/list/ArrayListModel.java
===================================================================
--- libs/swing-list/trunk/src/prj/net/sf/japi/swing/list/ArrayListModel.java 2008-12-29 04:44:02 UTC (rev 763)
+++ libs/swing-list/trunk/src/prj/net/sf/japi/swing/list/ArrayListModel.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -184,7 +184,7 @@
private class IteratorWrapper implements Iterator<E> {
/** Iterator that's wrapped. */
- private Iterator<E> iterator;
+ private final Iterator<E> iterator;
/** The current element, needed in {@link #remove()}. */
private E currentElement = null;
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java 2008-12-29 04:44:02 UTC (rev 763)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JFileChooserButton.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -40,12 +40,12 @@
/** The JTextField to read/write the file path to.
* @serial include
*/
- private JTextField textField;
+ private final JTextField textField;
/** The file selection mode.
* @serial include
*/
- private int fileSelectionMode;
+ private final int fileSelectionMode;
/** The base directory for choosing files.
* @serial include
Modified: libs/swing-recent/trunk/src/prj/net/sf/japi/swing/recent/RecentURLsMenu.java
===================================================================
--- libs/swing-recent/trunk/src/prj/net/sf/japi/swing/recent/RecentURLsMenu.java 2008-12-29 04:44:02 UTC (rev 763)
+++ libs/swing-recent/trunk/src/prj/net/sf/japi/swing/recent/RecentURLsMenu.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -96,7 +96,7 @@
private static final long serialVersionUID = 1L;
/** The URL to be opened. */
- private String url;
+ private final String url;
/** Create a URLAction.
* @param url URL to use for this action.
Modified: libs/util/trunk/src/prj/net/sf/japi/util/filter/file/Factory.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/filter/file/Factory.java 2008-12-29 04:44:02 UTC (rev 763)
+++ libs/util/trunk/src/prj/net/sf/japi/util/filter/file/Factory.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -46,7 +46,7 @@
private static class NotFileFilter extends AbstractFileFilter {
/** Filter to invert. */
- private FileFilter filter;
+ private final FileFilter filter;
/** Create a NotFileFilter.
* @param filter Filter to invert
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/QuestionCollectionInfoGUI.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/QuestionCollectionInfoGUI.java 2008-12-29 04:44:02 UTC (rev 763)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/QuestionCollectionInfoGUI.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -38,7 +38,7 @@
/** The Label.
* @serial include
*/
- private JLabel label;
+ private final JLabel label;
/** Create a new QuestionCollectionInfoGUI.
*/
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java 2008-12-29 04:44:02 UTC (rev 763)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/LineCheck.java 2008-12-29 04:48:11 UTC (rev 764)
@@ -13,7 +13,7 @@
public class LineCheck {
/** The message type to emit if this check found something. */
- @NotNull private MessageType type;
+ @NotNull private final MessageType type;
/** The name of this check. */
@NotNull private final String name;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:44:06
|
Revision: 763
http://japi.svn.sourceforge.net/japi/?rev=763&view=rev
Author: christianhujer
Date: 2008-12-29 04:44:02 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Removed unnecessary parenthesis.
Modified Paths:
--------------
historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java
tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java
tools/keystrokes/trunk/src/prj/net/sf/japi/tools/keystrokes/KeyStrokes.java
tools/mail/trunk/src/prj/net/sf/japi/tools/mail/PingPongSession.java
tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
Modified: historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:42:24 UTC (rev 762)
+++ historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -48,7 +48,7 @@
if ( numberOfPeriods == 0 ) {
return initialCapital;
}
- currentCapital = numberOfPeriods == 1 ? initialCapital * (1 + interestRate / 100) : initialCapital * Math.pow((1 + interestRate / 100), numberOfPeriods);
+ currentCapital = numberOfPeriods == 1 ? initialCapital * (1 + interestRate / 100) : initialCapital * Math.pow(1 + interestRate / 100, numberOfPeriods);
return currentCapital;
}
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2008-12-29 04:42:24 UTC (rev 762)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -396,7 +396,7 @@
}
public void internalFrameActivated(final InternalFrameEvent e) {
- setActiveDocumentImpl(((DocumentFrame<D>) e.getInternalFrame()));
+ setActiveDocumentImpl((DocumentFrame<D>) e.getInternalFrame());
}
public void internalFrameDeactivated(final InternalFrameEvent e) {
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java 2008-12-29 04:42:24 UTC (rev 762)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestSer.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -78,7 +78,7 @@
private QuestionCollection load(final InputStream in) throws IOException {
try {
//noinspection IOResourceOpenedButNotSafelyClosed
- return (QuestionCollection) (new ObjectInputStream(in).readObject());
+ return (QuestionCollection) new ObjectInputStream(in).readObject();
} catch (final ClassNotFoundException e) {
throw new IOException("This isn't a serialized JTest file", e);
}
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java 2008-12-29 04:42:24 UTC (rev 762)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/util/StringToTextComparatorAdapter.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -69,7 +69,7 @@
/** {@inheritDoc} */
@Override public boolean equals(final Object obj) {
- if ((obj == null) || !(obj instanceof StringToTextComparatorAdapter)) {
+ if (obj == null || !(obj instanceof StringToTextComparatorAdapter)) {
return false;
}
final StringToTextComparatorAdapter a = (StringToTextComparatorAdapter) obj;
Modified: tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java
===================================================================
--- tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java 2008-12-29 04:42:24 UTC (rev 762)
+++ tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -87,7 +87,7 @@
for (int c; (c = gdbIn.read()) != -1;) {
stdOut.write(c);
collector.write(c);
- if ((c == text.charAt(match)) || (c == text.charAt(match = 0))) {
+ if (c == text.charAt(match) || c == text.charAt(match = 0)) {
match++;
if (match == text.length()) {
return collector.toString(encoding);
Modified: tools/keystrokes/trunk/src/prj/net/sf/japi/tools/keystrokes/KeyStrokes.java
===================================================================
--- tools/keystrokes/trunk/src/prj/net/sf/japi/tools/keystrokes/KeyStrokes.java 2008-12-29 04:42:24 UTC (rev 762)
+++ tools/keystrokes/trunk/src/prj/net/sf/japi/tools/keystrokes/KeyStrokes.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -166,7 +166,7 @@
history.append(format.format(new Date(event.getWhen())));
history.append(": ");
history.append(keyStrokeText);
- history.append("(" + ((int) event.getKeyChar()) + " " + event.getKeyCode() + " " + event.getKeyLocation() + ")");
+ history.append("(" + (int) event.getKeyChar() + " " + event.getKeyCode() + " " + event.getKeyLocation() + ")");
history.append("\n");
history.setEditable(false);
}
Modified: tools/mail/trunk/src/prj/net/sf/japi/tools/mail/PingPongSession.java
===================================================================
--- tools/mail/trunk/src/prj/net/sf/japi/tools/mail/PingPongSession.java 2008-12-29 04:42:24 UTC (rev 762)
+++ tools/mail/trunk/src/prj/net/sf/japi/tools/mail/PingPongSession.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -134,7 +134,7 @@
if (debug && line != null) {
err.println("< " + line);
}
- } while ((line != null) && (line.startsWith(returnCode + "-")));
+ } while (line != null && line.startsWith(returnCode + "-"));
if (line == null) {
if (debug) {
err.println("< <EOF>");
Modified: tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java
===================================================================
--- tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java 2008-12-29 04:42:24 UTC (rev 762)
+++ tools/replacer/trunk/src/prj/net/sf/japi/tools/replacer/LineIterator.java 2008-12-29 04:44:02 UTC (rev 763)
@@ -100,7 +100,7 @@
c == LINE_FEED ||
// CARRIAGE_RETURN only already terminates a line if it is standalone.
// If it is immediately followed by a LINE_FEED, that line feed will terminate the line in the next invocation.
- (c == CARRIAGE_RETURN && (end == text.length() || text.charAt(end) != LINE_FEED)) ||
+ c == CARRIAGE_RETURN && (end == text.length() || text.charAt(end) != LINE_FEED) ||
c == NEXT_LINE ||
c == LINE_SEPARATOR ||
c == PARAGRAPH_SEPARATOR;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:42:27
|
Revision: 762
http://japi.svn.sourceforge.net/japi/?rev=762&view=rev
Author: christianhujer
Date: 2008-12-29 04:42:24 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Removed unnecessary super().
Modified Paths:
--------------
libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/MockActionBuilder.java
Modified: libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/MockActionBuilder.java
===================================================================
--- libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/MockActionBuilder.java 2008-12-29 04:41:43 UTC (rev 761)
+++ libs/swing-prefs/trunk/src/tst/test/net/sf/japi/swing/prefs/MockActionBuilder.java 2008-12-29 04:42:24 UTC (rev 762)
@@ -33,7 +33,6 @@
* @see DefaultActionBuilder#DefaultActionBuilder()
*/
public MockActionBuilder() {
- super();
}
/** Create a MockActionBuilder with the specified key.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <chr...@us...> - 2008-12-29 04:41:47
|
Revision: 761
http://japi.svn.sourceforge.net/japi/?rev=761&view=rev
Author: christianhujer
Date: 2008-12-29 04:41:43 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Removed unnecessary qualified usage with imports.
Modified Paths:
--------------
historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
historic/trunk/src/app/net/sf/japi/util/Service.java
libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/StringJoinerTest.java
libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java
libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java
libs/util/trunk/src/prj/net/sf/japi/util/filter/file/AbstractFileFilter.java
libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java
tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java
Modified: historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:27:31 UTC (rev 760)
+++ historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -32,7 +32,7 @@
public SimpleCapitalCalculator(final double initialCapital, final double interestRate) {
this.initialCapital = initialCapital;
this.interestRate = interestRate;
- this.currentCapital = this.initialCapital;
+ currentCapital = this.initialCapital;
}
/** Calculates the overall capital after some periods beginnig with given initial capital and interest rate.
@@ -83,16 +83,16 @@
/** Resets the current capital to initial capital.
*/
public void resetCapital() {
- this.currentCapital = this.initialCapital;
+ currentCapital = initialCapital;
}
/** Overrides the toString method.
* @return String that represents the SimpleCapitalCalculator
*/
public String toString() {
- return "initial capital: " + this.initialCapital +
- "\ninterest rate: " + this.interestRate +
- "\ncurrent capital: " + this.currentCapital;
+ return "initial capital: " + initialCapital +
+ "\ninterest rate: " + interestRate +
+ "\ncurrent capital: " + currentCapital;
}
/** Clones the current SimpleCapitalCalculator.
Modified: historic/trunk/src/app/net/sf/japi/util/Service.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/util/Service.java 2008-12-29 04:27:31 UTC (rev 760)
+++ historic/trunk/src/app/net/sf/japi/util/Service.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -1,13 +1,15 @@
package net.sf.japi.util;
import java.lang.reflect.InvocationTargetException;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static sun.misc.Service.providers;
/**
- * Service serves as a Proxy for {@link java.util.ServiceLoader}, using {@link sun.misc.Service} as a fallback in case {@link java.util.ServiceLoader} is unavailable.
- * This allows programmers to write programs that use {@link java.util.ServiceLoader} features even on older Java VMs.
+ * Service serves as a Proxy for {@link ServiceLoader}, using {@link sun.misc.Service} as a fallback in case {@link ServiceLoader} is unavailable.
+ * This allows programmers to write programs that use {@link ServiceLoader} features even on older Java VMs.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
public class Service<T> {
@@ -16,7 +18,7 @@
* Lookup service class implementations using no specific class loader.
* @param service Service class to look up
* @return implementations found (lazy iterable)
- * @throws java.util.ServiceConfigurationError if running on Mustang and the service isn't configured properly
+ * @throws ServiceConfigurationError if running on Mustang and the service isn't configured properly
*/
@NotNull public static <T> Iterable<T> load(@NotNull final Class<T> service) {
try {
@@ -53,7 +55,7 @@
* @param service Service class to look up
* @param loader Class loader to use for look up
* @return implementations found (lazy iterable)
- * @throws java.util.ServiceConfigurationError if running on Mustang and the service isn't configured properly
+ * @throws ServiceConfigurationError if running on Mustang and the service isn't configured properly
*/
@NotNull public static <T> Iterable<T> load(@NotNull final Class<T> service, @NotNull final ClassLoader loader) {
try {
Modified: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java
===================================================================
--- libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/ArgParserTest.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -524,7 +524,7 @@
/** The input option value. */
private String input;
- /** Remembers whether {@link #run(java.util.List<java.lang.String>)} was called. */
+ /** Remembers whether {@link #run(List< String>)} was called. */
private boolean runCalled;
/** The command line arguments received from the parser. */
Modified: libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/StringJoinerTest.java
===================================================================
--- libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/StringJoinerTest.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/argparser/trunk/src/tst/test/net/sf/japi/io/args/StringJoinerTest.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -20,6 +20,7 @@
package test.net.sf.japi.io.args;
import java.util.Arrays;
+import java.util.Iterator;
import net.sf.japi.io.args.StringJoiner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -54,7 +55,7 @@
}
/**
- * Tests that {@link StringJoiner#join(CharSequence,Iterable<? extends java.lang.CharSequence>)} works.
+ * Tests that {@link StringJoiner#join(CharSequence,Iterable<? extends CharSequence>)} works.
*/
@Test
public void testJoinCSIe() {
@@ -65,7 +66,7 @@
}
/**
- * Tests that {@link StringJoiner#join(CharSequence,java.util.Iterator<? extends java.lang.CharSequence>)} works.
+ * Tests that {@link StringJoiner#join(CharSequence, Iterator<? extends CharSequence>)} works.
*/
@Test
public void testJoinCSIr() {
Modified: libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java
===================================================================
--- libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/logging/trunk/src/prj/net/sf/japi/log/LoggerFactory.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -24,6 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.LogManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +39,7 @@
/**
* The implementations.
- * Key: logger name, as with {@link java.util.logging.LogManager#getLogger(String)}.
+ * Key: logger name, as with {@link LogManager#getLogger(String)}.
* Value: Logger associated with the Key
*/
@NotNull private final Map<String, Logger> loggers = new HashMap<String, Logger>();
Modified: libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java
===================================================================
--- libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;
import javax.swing.JToolBar;
+import javax.swing.plaf.basic.BasicToolBarUI;
import org.jetbrains.annotations.Nullable;
/** A LayoutManager that manages a layout of a {@link Container} similar to {@link BorderLayout} but with an important difference, it is possible to
@@ -37,7 +38,7 @@
* toolbars. So this is a LayoutManager you always were looking for.
* <p />
* Technically, this class is not a 100% replacement for {@link BorderLayout}. {@link JToolBar}'s UI ({@link
- * javax.swing.plaf.basic.BasicToolBarUI}) directly looks for some features of the class {@link BorderLayout}, and if it is not {@link BorderLayout},
+ * BasicToolBarUI}) directly looks for some features of the class {@link BorderLayout}, and if it is not {@link BorderLayout},
* it uses some defaults.
* This class has been developed to make these defaults work as good as possible.
* Though this class doesn't technically replace {@link BorderLayout} - neither is this class a subclass of {@link BorderLayout} nor does it provide
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/CollectionsListModel.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -26,7 +26,7 @@
import javax.swing.AbstractListModel;
/**
- * A ListModel for {@link java.util.List}.
+ * A ListModel for {@link List}.
* @param <E> element type for the collection to be a list model for.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
Modified: libs/util/trunk/src/prj/net/sf/japi/util/filter/file/AbstractFileFilter.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/filter/file/AbstractFileFilter.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/util/trunk/src/prj/net/sf/japi/util/filter/file/AbstractFileFilter.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -19,7 +19,7 @@
package net.sf.japi.util.filter.file;
-/** The AbstractFileFilter is a combination of a normal {@link java.io.FileFilter}, {@link javax.swing.filechooser.FileFilter} and {@link net.sf.japi.util.filter.file.FileFilter}.
+/** The AbstractFileFilter is a combination of a normal {@link java.io.FileFilter}, {@link javax.swing.filechooser.FileFilter} and {@link FileFilter}.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
@SuppressWarnings({"EmptyClass"})
Modified: libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java
===================================================================
--- libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java 2008-12-29 04:27:31 UTC (rev 760)
+++ libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -58,7 +58,7 @@
testling = null;
}
- /** Test case for {@link net.sf.japi.xml.NodeListIterator#hasNext()}. */
+ /** Test case for {@link NodeListIterator#hasNext()}. */
@Test public void testHasNext() {
for (int i = 0; i < mockNodeList.getLength(); i++) {
Assert.assertTrue("Iterator must return as many elements as the underlying NodeList has.", testling.hasNext());
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java 2008-12-29 04:27:31 UTC (rev 760)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -59,9 +59,9 @@
* <p />
* Most common implementations are:
* <ul>
- * <li>{@link net.sf.japi.progs.jeduca.swing.InternalFrameManager} which manages the visibility of {@link JInternalFrame}s</li>
- * <li>{@link net.sf.japi.progs.jeduca.swing.MenuManager} which manages the visibility of {@link JMenu}s</li>
- * <li>{@link net.sf.japi.progs.jeduca.swing.ToolBarManager} which manages the visibility of {@link JToolBar}s</li>
+ * <li>{@link InternalFrameManager} which manages the visibility of {@link JInternalFrame}s</li>
+ * <li>{@link MenuManager} which manages the visibility of {@link JMenu}s</li>
+ * <li>{@link ToolBarManager} which manages the visibility of {@link JToolBar}s</li>
* </ul>
* You may add and remove components to a Manager as you want.
* All menus you created will automatically be uptodate.
@@ -210,8 +210,8 @@
/** Class for component visibility management actions.
* It implements {@link ComponentListener} so it can keep the Action state uptodate with the real visibility of the component.
- * This means that visibility handling works both ways round: When a component is made (in)visible using its {@link
- * java.awt.Component#setVisible(boolean)} method, the Action is updated, which updates all {@link JCheckBoxMenuItem}s created from it.
+ * This means that visibility handling works both ways round:
+ * When a component is made (in)visible using its {@link Component#setVisible(boolean)} method, the Action is updated, which updates all {@link JCheckBoxMenuItem}s created from it.
* When a {@link JCheckBoxMenuItem} is (de)selected, the Action is updated, which updates the Component's visibility state.
* @todo find a better name for this class
* @todo eventually provide <code>public</code> or at least <code>protected</code> access to createCheckBoxMenuItem
Modified: tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java
===================================================================
--- tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java 2008-12-29 04:27:31 UTC (rev 760)
+++ tools/replacer/trunk/src/tst/test/net/sf/japi/tools/replacer/SubstitutionTest.java 2008-12-29 04:41:43 UTC (rev 761)
@@ -7,13 +7,13 @@
import net.sf.japi.tools.replacer.Substitution;
-/** Tests that {@link net.sf.japi.tools.replacer.Substitution}.
+/** Tests that {@link Substitution}.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
@SuppressWarnings({"InstanceMethodNamingConvention"})
public class SubstitutionTest {
- /** Tests that {@link net.sf.japi.tools.replacer.Substitution (String, String)} works. */
+ /** Tests that {@link Substitution (String, String)} works. */
@Test
public void testSimpleSubstitution() {
final Substitution testling = new Substitution("foo", "bar");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|