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...> - 2006-07-11 00:24:21
|
Revision: 133 Author: christianhujer Date: 2006-07-10 17:24:09 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=133&view=rev Log Message: ----------- Turned Registry into Service. Added Paths: ----------- trunk/src/app/net/sf/japi/util/Service.java Removed Paths: ------------- trunk/src/app/net/sf/japi/util/Registry.java Deleted: trunk/src/app/net/sf/japi/util/Registry.java =================================================================== --- trunk/src/app/net/sf/japi/util/Registry.java 2006-07-09 11:42:07 UTC (rev 132) +++ trunk/src/app/net/sf/japi/util/Registry.java 2006-07-11 00:24:09 UTC (rev 133) @@ -1,92 +0,0 @@ -package net.sf.japi.util; - -import java.util.ArrayList; -import static java.util.Arrays.asList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.PropertyResourceBundle; -import java.net.URL; -import java.io.IOException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * A Registry is a class that allows registration of instances of classes that implement a certain interface. - * The Registry automatically scans classloaders, resource bundles, environment variables and system properties for looking up these classes. - * All that a Registry needs to know for that is a property key name. - * <p /> - * @note This has nothing to do with MS Windows Registry. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class Registry<T> { - - /** The registered instances of T. */ - private List<T> instances = new ArrayList<T>(); - - private String[] prefixes = { "", "META-INF/services/" }; - - /** - * Create a Registry. - * @param keyname Key name - * @param classLoadersToUse optional classloaders to use in the search - */ - public Registry(@NotNull final String keyname, @Nullable final Iterable<ClassLoader> classLoadersToUse) { - final List<String> stringsWithClassNames = new ArrayList<String>(); - stringsWithClassNames.add(System.getProperty(keyname)); - stringsWithClassNames.add(System.getenv(keyname)); - final Set<ClassLoader> classLoaders = new HashSet<ClassLoader>(); - for (final ClassLoader classLoader : classLoadersToUse) { - classLoaders.add(classLoader); - } - // Add own class loader, add context class loader - while (classLoaders.remove(null)); - for (final ClassLoader classLoader : classLoaders) { - for (final String prefix : prefixes) { - try { - for (final URL url : Collections.list(classLoader.getResources(prefix + keyname))) { - stringsWithClassNames.add(new PropertyResourceBundle(url.openStream()).getString(keyname)); - } - } catch (final IOException e) { - e.printStackTrace(); - } - } - } - while (stringsWithClassNames.remove(null)); // remove entries that eventually are null - final Set<String> classNames = new HashSet<String>(); - for (final String stringWithClassNames : stringsWithClassNames) { - classNames.addAll(asList(stringWithClassNames.split("[^.\\P{javaJavaIdentifierPart}]+"))); - } - for (final String className : classNames) { - try { - add(((Class<? extends T>) Class.forName(className)).newInstance()); - } catch (final ClassCastException e) { - e.printStackTrace(); - } catch (final InstantiationException e) { - e.printStackTrace(); - } catch (final IllegalAccessException e) { - e.printStackTrace(); - } catch (final ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - - /** - * Add an instance. - * @param t Instance to add - */ - protected void add(@NotNull final T t) { - instances.add(t); - } - - /** - * Get all registered instances. - * @return all registered instances - */ - public List<T> getInstances() { - return Collections.unmodifiableList(instances); - } - -} // class Registry Copied: trunk/src/app/net/sf/japi/util/Service.java (from rev 132, trunk/src/app/net/sf/japi/util/Registry.java) =================================================================== --- trunk/src/app/net/sf/japi/util/Service.java (rev 0) +++ trunk/src/app/net/sf/japi/util/Service.java 2006-07-11 00:24:09 UTC (rev 133) @@ -0,0 +1,81 @@ +package net.sf.japi.util; + +import static sun.misc.Service.providers; +import java.util.Iterator; +import java.lang.reflect.InvocationTargetException; + +/** + * Service serves as a Proxy for {@link java.util.Service}, using {@link sun.misc.Service} as a fallback in case {@link java.util.Service} is unavailable. + * This allows programmers to write programs that use {@link java.util.Service} features even on older Java VMs. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class Service<T> { + + private static class IteratorIterable<T> implements Iterable<T> { + private Iterator<T> iterator; + + public IteratorIterable(final Iterator<T> iterator) { + this.iterator = iterator; + } + public Iterator<T> iterator() { + return iterator; + } + } // class IteratorIterable + + public static <T> Iterable<T> lookup(final Class<T> service) { + try { + ////Not using this because the code should also copmile with pre-Mustang + // return java.util.Service.lookup(service); + //} catch (final NoClassDefFoundError e) { + return (Iterable<T>) getMustangServiceClass().getMethod("lookup", Class.class).invoke(null, service); + } catch (final ClassNotFoundException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final NoSuchMethodException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final IllegalAccessException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final InvocationTargetException e) { + final Throwable t = e.getCause(); + if (t instanceof RuntimeException) { + throw (RuntimeException) t; + } else if (t instanceof Error) { + throw (Error) t; + } else { + final Thread currentThread = Thread.currentThread(); + currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, t); + throw new Error(t); + } + } + } + + private static Class getMustangServiceClass() throws ClassNotFoundException { + return Class.forName("java.util.Service"); + } + + public static <T> Iterable<T> lookup(final Class<T> service, final ClassLoader loader) { + try { + ////Not using this because the code should also copmile with pre-Mustang + // return java.util.Service.lookup(service, loader); + //} catch (final NoClassDefFoundError e) { + return (Iterable<T>) getMustangServiceClass().getMethod("lookup", Class.class, ClassLoader.class).invoke(null, service, loader); + } catch (final ClassNotFoundException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final NoSuchMethodException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final IllegalAccessException e) { + return new IteratorIterable<T>(providers(service)); + } catch (final InvocationTargetException e) { + final Throwable t = e.getCause(); + if (t instanceof RuntimeException) { + throw (RuntimeException) t; + } else if (t instanceof Error) { + throw (Error) t; + } else { + final Thread currentThread = Thread.currentThread(); + currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, t); + throw new Error(t); + } + } + } + +} // class Registry Property changes on: trunk/src/app/net/sf/japi/util/Service.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-07-09 11:42:15
|
Revision: 132 Author: christianhujer Date: 2006-07-09 04:42:07 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=132&view=rev Log Message: ----------- Added Registry class. Added Paths: ----------- trunk/src/app/net/sf/japi/util/Registry.java Added: trunk/src/app/net/sf/japi/util/Registry.java =================================================================== --- trunk/src/app/net/sf/japi/util/Registry.java (rev 0) +++ trunk/src/app/net/sf/japi/util/Registry.java 2006-07-09 11:42:07 UTC (rev 132) @@ -0,0 +1,92 @@ +package net.sf.japi.util; + +import java.util.ArrayList; +import static java.util.Arrays.asList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.PropertyResourceBundle; +import java.net.URL; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A Registry is a class that allows registration of instances of classes that implement a certain interface. + * The Registry automatically scans classloaders, resource bundles, environment variables and system properties for looking up these classes. + * All that a Registry needs to know for that is a property key name. + * <p /> + * @note This has nothing to do with MS Windows Registry. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class Registry<T> { + + /** The registered instances of T. */ + private List<T> instances = new ArrayList<T>(); + + private String[] prefixes = { "", "META-INF/services/" }; + + /** + * Create a Registry. + * @param keyname Key name + * @param classLoadersToUse optional classloaders to use in the search + */ + public Registry(@NotNull final String keyname, @Nullable final Iterable<ClassLoader> classLoadersToUse) { + final List<String> stringsWithClassNames = new ArrayList<String>(); + stringsWithClassNames.add(System.getProperty(keyname)); + stringsWithClassNames.add(System.getenv(keyname)); + final Set<ClassLoader> classLoaders = new HashSet<ClassLoader>(); + for (final ClassLoader classLoader : classLoadersToUse) { + classLoaders.add(classLoader); + } + // Add own class loader, add context class loader + while (classLoaders.remove(null)); + for (final ClassLoader classLoader : classLoaders) { + for (final String prefix : prefixes) { + try { + for (final URL url : Collections.list(classLoader.getResources(prefix + keyname))) { + stringsWithClassNames.add(new PropertyResourceBundle(url.openStream()).getString(keyname)); + } + } catch (final IOException e) { + e.printStackTrace(); + } + } + } + while (stringsWithClassNames.remove(null)); // remove entries that eventually are null + final Set<String> classNames = new HashSet<String>(); + for (final String stringWithClassNames : stringsWithClassNames) { + classNames.addAll(asList(stringWithClassNames.split("[^.\\P{javaJavaIdentifierPart}]+"))); + } + for (final String className : classNames) { + try { + add(((Class<? extends T>) Class.forName(className)).newInstance()); + } catch (final ClassCastException e) { + e.printStackTrace(); + } catch (final InstantiationException e) { + e.printStackTrace(); + } catch (final IllegalAccessException e) { + e.printStackTrace(); + } catch (final ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + + /** + * Add an instance. + * @param t Instance to add + */ + protected void add(@NotNull final T t) { + instances.add(t); + } + + /** + * Get all registered instances. + * @return all registered instances + */ + public List<T> getInstances() { + return Collections.unmodifiableList(instances); + } + +} // class Registry Property changes on: trunk/src/app/net/sf/japi/util/Registry.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-06-25 00:00:41
|
Revision: 131 Author: christianhujer Date: 2006-06-24 17:00:30 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=131&view=rev Log Message: ----------- Replaced old bookmarks package with JAPI usage. Modified Paths: -------------- trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java Removed Paths: ------------- trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/bookmarks/ trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/io/CanLoad.java Modified: trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java =================================================================== --- trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2006-06-24 23:59:53 UTC (rev 130) +++ trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2006-06-25 00:00:30 UTC (rev 131) @@ -45,8 +45,6 @@ import javax.swing.JToolBar; import net.sf.japi.progs.jeduca.jtest.Program; import net.sf.japi.progs.jeduca.jtest.Settings; -import net.sf.japi.progs.jeduca.swing.bookmarks.BookmarkManager; -import net.sf.japi.progs.jeduca.swing.bookmarks.Bookmarkable; import net.sf.japi.progs.jeduca.swing.settings.SettingsModule; import net.sf.japi.progs.jeduca.swing.settings.SettingsPane; import net.sf.japi.progs.jeduca.swing.io.ImporterFileFilter; @@ -59,6 +57,8 @@ import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToolBarLayout; import net.sf.japi.swing.LookAndFeelManager; +import net.sf.japi.swing.bookmarks.BookmarkManager; +import net.sf.japi.swing.bookmarks.Bookmarkable; /** Programmfenster. * @author $Author: chris $ Deleted: trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/io/CanLoad.java =================================================================== --- trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/io/CanLoad.java 2006-06-24 23:59:53 UTC (rev 130) +++ trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/io/CanLoad.java 2006-06-25 00:00:30 UTC (rev 131) @@ -1,37 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.progs.jeduca.swing.io; - -/** Interface to be implemented by classes that are able to load a URL. - * @author $Author: chris $ - * @version $Id: CanLoad.java,v 1.1 2004/12/28 23:51:22 chris Exp $ - */ -public interface CanLoad { - - /** Load a document. - * This method does not declare any exceptions. - * The implementor of this method is responsible for handling any exceptional conditions which might occur during the load operation. - * @param url URL to load - * @return <code>true</code> if and only if loading the file was successful - */ - boolean load(final String url); - -} // interface CanLoad Modified: trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java =================================================================== --- trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java 2006-06-24 23:59:53 UTC (rev 130) +++ trunk/progs/jeduca/src/net/sf/japi/progs/jeduca/swing/recent/RecentURLsMenu.java 2006-06-25 00:00:30 UTC (rev 131) @@ -24,8 +24,8 @@ import javax.swing.AbstractAction; import javax.swing.JMenu; import javax.swing.JMenuItem; -import net.sf.japi.progs.jeduca.swing.io.CanLoad; import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.io.CanLoad; /** Class for a menu showing the recently used URLs. * @todo think about serialization of recent and program This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-25 00:00:03
|
Revision: 130 Author: christianhujer Date: 2006-06-24 16:59:53 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=130&view=rev Log Message: ----------- Updated megaxslt.jar. Modified Paths: -------------- trunk/lib/megaxslt.jar Modified: trunk/lib/megaxslt.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z0...@us...> - 2006-06-05 23:46:44
|
Revision: 129 Author: z0ra Date: 2006-06-04 14:35:55 -0700 (Sun, 04 Jun 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=129&view=rev Log Message: ----------- Change "calculateCapital" to iterative implementation. Modified Paths: -------------- trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java Modified: trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java =================================================================== --- trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2006-06-02 00:55:08 UTC (rev 128) +++ trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2006-06-04 21:35:55 UTC (rev 129) @@ -46,15 +46,14 @@ if ( numberOfPeriods == 0 ) return initialCapital; if( numberOfPeriods == 1 ) { - currentCapital = currentCapital *(1 + interestRate/100); + currentCapital = initialCapital * (1 + interestRate/100); } else { - currentCapital = calculateCapital( numberOfPeriods - 1 ); + currentCapital = initialCapital * Math.pow(( 1 + interestRate/100 ), numberOfPeriods); } return currentCapital; } /** Returns the current capital. - * * @return current capital */ public double getCurrentCapital() { @@ -62,7 +61,6 @@ } /** Sets new current capital. - * * @param currentCapital */ public void setCurrentCapital(double currentCapital) { @@ -70,7 +68,6 @@ } /** Sets new interest rate. - * * @param interestRate */ public void setInterestRate(double interestRate) { @@ -78,7 +75,6 @@ } /** Returns the current interest rate. - * * @return the current interest rate */ public double getInterestRate() { @@ -86,14 +82,12 @@ } /** Resets the current capital to initial capital. - * */ public void resetCapital() { this.currentCapital = this.initialCapital; } /** Overrides the toString method. - * * @return String that represents the SimpleCapitalCalculator */ public String toString() { @@ -103,7 +97,6 @@ } /** Clones the current SimpleCapitalCalculator. - * * @return Object SimpleCapitalCalculator */ public Object clone() { @@ -113,4 +106,5 @@ throw new InternalError(); } } + } // class SimpleCapitalCalculator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z0...@us...> - 2006-06-02 00:55:14
|
Revision: 128 Author: z0ra Date: 2006-06-01 17:55:08 -0700 (Thu, 01 Jun 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=128&view=rev Log Message: ----------- Added "|" as separator for menu items. Modified Paths: -------------- trunk/src/app/net/sf/japi/swing/ActionFactory.java Modified: trunk/src/app/net/sf/japi/swing/ActionFactory.java =================================================================== --- trunk/src/app/net/sf/japi/swing/ActionFactory.java 2006-06-01 00:15:16 UTC (rev 127) +++ trunk/src/app/net/sf/japi/swing/ActionFactory.java 2006-06-02 00:55:08 UTC (rev 128) @@ -566,7 +566,7 @@ for (final String key : keys) { if (key != null && key.length() == 0) { /* ignore this for empty menus */ - } else if (key == null || "-".equals(key)) { + } else if (key == null || "-".equals(key) || "|".equals(key)) { menu.addSeparator(); } else { final Action action = getAction(key); @@ -633,7 +633,7 @@ for (final String key : getString(popupKey + ".menu").split("\\s+")) { if (key != null && key.length() == 0) { /* ignore this for empty menus */ - } else if (key == null || "-".equals(key)) { + } else if (key == null || "-".equals(key) || "|".equals(key)) { menu.addSeparator(); } else if (getString(key + ".menu") != null) { menu.add(createMenu(store, key)); @@ -665,7 +665,7 @@ for (final String key : getString(menuKey + ".menu").split("\\s+")) { if (key != null && key.length() == 0) { /* ignore this for empty menus */ - } else if (key == null || "-".equals(key)) { + } else if (key == null || "-".equals(key) || "|".equals(key)) { menu.addSeparator(); } else if (getString(key + ".menu") != null) { menu.add(createMenu(store, key)); @@ -713,7 +713,7 @@ for (final String key : getString(popupKey + ".menu").split("\\s+")) { if (key != null && key.length() == 0) { /* ignore this for empty menus */ - } else if (key == null || "-".equals(key)) { + } else if (key == null || "-".equals(key) || "|".equals(key)) { menu.addSeparator(); } else if (getString(key + ".menu") != null) { menu.add(createMenu(store, key, target)); @@ -752,7 +752,7 @@ for (final String key : getString(menuKey + ".menu").split("\\s+")) { if (key != null && key.length() == 0) { /* ignore this for empty menus */ - } else if (key == null || "-".equals(key)) { + } else if (key == null || "-".equals(key) || "|".equals(key)) { menu.addSeparator(); } else if (getString(key + ".menu") != null) { menu.add(createMenu(store, key, target)); @@ -827,7 +827,7 @@ public JToolBar createToolBar(final String... keys) { final JToolBar toolBar = new JToolBar(); for (final String key : keys) { - if (key == null || "-".equals(key)) { + if (key == null || "-".equals(key) || "|".equals(key)) { toolBar.addSeparator(); } else { final Action action = getAction(key); @@ -856,7 +856,7 @@ public JToolBar createToolBar(final Object object, final String... keys) { final JToolBar toolBar = new JToolBar(); for (final String key : keys) { - if (key == null || "-".equals(key)) { + if (key == null || "-".equals(key) || "|".equals(key)) { toolBar.addSeparator(); } else { Action action = getAction(key); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-01 00:15:27
|
Revision: 127 Author: christianhujer Date: 2006-05-31 17:15:16 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=127&view=rev Log Message: ----------- Removed old email address. Modified Paths: -------------- trunk/src/doc/start.xhtml trunk/src/doc/transform.xslt Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-05-31 23:42:26 UTC (rev 126) +++ trunk/src/doc/start.xhtml 2006-06-01 00:15:16 UTC (rev 127) @@ -49,7 +49,7 @@ <h2>Contact the developers</h2> <ul> <li> - You may visit the <a href="http://sourceforge.net/projects/japi">JAPI Project Page at SourceForge</a> or send mail to <a href="mailto:ch...@ri...">ch...@ri...</a>. + You may visit the <a href="http://sourceforge.net/projects/japi">JAPI Project Page at SourceForge</a> or send mail to <a href="mailto:ch...@ri...">ch...@ri...</a>. </li> <li> You may as well join <a href="irc://irc.freenode.net:6667/%23japi">IRC Channel <code>#japi</code> at <code>irc.freenode.net</code></a> and look for Cher(istheus), z0ra or Zergus. Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-05-31 23:42:26 UTC (rev 126) +++ trunk/src/doc/transform.xslt 2006-06-01 00:15:16 UTC (rev 127) @@ -66,7 +66,7 @@ <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" class="now" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" /></a> <!--<a href="http://www.jetbrains.com/idea/"><img src="http://www.jetbrains.com/idea/opensource/img/banners/idea88x31_blue.gif" alt="The best Java IDE" width="88" height="31" /></a>--> - Feedback: <a href="mailto:ch...@ri...">webmaster</a> + Feedback: <a href="mailto:ch...@ri...">webmaster</a> <xsl:if test="/html:html/html:head/html:meta[@name='Date']"> <br /> <xsl:value-of select="/html:html/html:head/html:meta[@name='Date']/@content" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-31 23:42:36
|
Revision: 126 Author: christianhujer Date: 2006-05-31 16:42:26 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=126&view=rev Log Message: ----------- Improved CSS validity. Modified Paths: -------------- trunk/src/doc/sitestyle.css trunk/src/doc/transform.xslt Modified: trunk/src/doc/sitestyle.css =================================================================== --- trunk/src/doc/sitestyle.css 2006-05-30 19:49:47 UTC (rev 125) +++ trunk/src/doc/sitestyle.css 2006-05-31 23:42:26 UTC (rev 126) @@ -1,17 +1,16 @@ -html { +html, body { background-color: white; + color:#11111A; } body { margin: auto auto; padding-left: 6%; padding-right: 6%; - background-color: white; - /*background-image: url(http://www.w3.org/Icons/logo-WMVS.png);*/ + /*background-image: url(http://www.w3.org/Icons/logo-WMVS.png); background-attachment: fixed; background-position: 0 0; - background-repeat: no-repeat; - color: #11111A; + background-repeat: no-repeat;*/ font-family: Helvetica, "Trebuchet MS", Arial, sans-serif; font-size: 1em; /* setting base font to user's prefered size */ line-height: 130%; @@ -19,6 +18,7 @@ div.header { background-color: #eee; + color:inherit; height:45px; text-align:center; } @@ -30,6 +30,7 @@ div.content { background-color: white; + color:inherit; border-bottom: 0; border-left: 1px solid #eee; border-right: 1px solid #eee; @@ -43,6 +44,7 @@ background-repeat: no-repeat; background-attachment: scroll; background-position: right; + color:inherit; height:45px; padding-top: 10px; padding-bottom: 0; @@ -68,11 +70,13 @@ margin-left: 222px; font-family: "Bitstream Vera Sans Mono", monospace; color: #888; + background-color:inherit; line-height: 120%; } p.copyright a { color: #88f; + background-color:inherit; text-decoration: none; } @@ -92,6 +96,7 @@ fieldset.screenshot { padding: .5em; background: white; + color:inherit; border: 1px dotted #aaaa77; margin-left: 20px; margin-right: 20px; @@ -99,8 +104,8 @@ } fieldset.screenshot legend { + background-color: #aaaa77; color: #fff; - background-color: #aaaa77; font-size: smaller; padding: .1ex .5ex; border-right: 1px solid gray; @@ -116,21 +121,21 @@ td.java, td.java-ln {vertical-align:top;} tt.java, tt.java-ln, pre.java, pre.java-ln {line-height:1em; margin-bottom:0em;} td.java-ln { text-align:right; } -tt.java-ln, pre.java-ln { color:#888888 } -/* Background */ span.java0 { color:#ffffff; } -/* Line numbers */ span.java1 { color:#808080; } -/* Multi-line comments */ span.java2 { color:#3f7f5f; } -/* Single-line comments */ span.java3 { color:#3f7f5f; } -/* Keywords */ span.java4 { color:#7f0055; font-weight:bold; } -/* Strings */ span.java5 { color:#2a00ff; } -/* Character constants */ span.java6 { color:#990000; } -/* Numeric constants */ span.java7 { color:#990000; } -/* Parenthesis */ span.java8 { color:#000000; } -/* Primitive Types */ span.java9 { color:#7f0055; font-weight:bold; } -/* Others */ span.java10 { color:#000000; } -/* Javadoc keywords */ span.java11 { color:#7f9fbf; } -/* Javadoc HTML tags */ span.java12 { color:#7f7f9f; } -/* Javadoc links */ span.java13 { color:#3f3fbf; } -/* Javadoc others */ span.java14 { color:#3f5fbf; } -/* Undefined */ span.java15 { color:#ff6100; } -/* Annotation */ span.java16 { color:#646464; } + tt.java-ln, pre.java-ln { background-color:inherit; color:#888888; } +/* Background */ span.java0 { background-color:inherit; color:#ffffff; } +/* Line numbers */ span.java1 { background-color:inherit; color:#808080; } +/* Multi-line comments */ span.java2 { background-color:inherit; color:#3f7f5f; } +/* Single-line comments */ span.java3 { background-color:inherit; color:#3f7f5f; } +/* Keywords */ span.java4 { background-color:inherit; color:#7f0055; font-weight:bold; } +/* Strings */ span.java5 { background-color:inherit; color:#2a00ff; } +/* Character constants */ span.java6 { background-color:inherit; color:#990000; } +/* Numeric constants */ span.java7 { background-color:inherit; color:#990000; } +/* Parenthesis */ span.java8 { background-color:inherit; color:#000000; } +/* Primitive Types */ span.java9 { background-color:inherit; color:#7f0055; font-weight:bold; } +/* Others */ span.java10 { background-color:inherit; color:#000000; } +/* Javadoc keywords */ span.java11 { background-color:inherit; color:#7f9fbf; } +/* Javadoc HTML tags */ span.java12 { background-color:inherit; color:#7f7f9f; } +/* Javadoc links */ span.java13 { background-color:inherit; color:#3f3fbf; } +/* Javadoc others */ span.java14 { background-color:inherit; color:#3f5fbf; } +/* Undefined */ span.java15 { background-color:inherit; color:#ff6100; } +/* Annotation */ span.java16 { background-color:inherit; color:#646464; } Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-05-30 19:49:47 UTC (rev 125) +++ trunk/src/doc/transform.xslt 2006-05-31 23:42:26 UTC (rev 126) @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Id: transform.xslt,v 1.10 2006/02/15 00:32:35 christianhujer Exp $ --> <xsl:transform version="1.0" xmlns:html="http://www.w3.org/1999/xhtml" @@ -65,6 +64,8 @@ <a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=149894&type=1" alt="SourceForge.net Logo" width="88" height="31" class="now" /></a> <a href="http://sourceforge.net/donate/index.php?group_id=149894"><img src="http://sourceforge.net/images/project-support.jpg" width="88" height="32" alt="Support This Project" class="now" /></a> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" class="now" /></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" /></a> + <!--<a href="http://www.jetbrains.com/idea/"><img src="http://www.jetbrains.com/idea/opensource/img/banners/idea88x31_blue.gif" alt="The best Java IDE" width="88" height="31" /></a>--> Feedback: <a href="mailto:ch...@ri...">webmaster</a> <xsl:if test="/html:html/html:head/html:meta[@name='Date']"> <br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-30 19:49:54
|
Revision: 125 Author: christianhujer Date: 2006-05-30 12:49:47 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=125&view=rev Log Message: ----------- Added Gridarta. Modified Paths: -------------- trunk/src/doc/start.xhtml Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-05-27 22:23:40 UTC (rev 124) +++ trunk/src/doc/start.xhtml 2006-05-30 19:49:47 UTC (rev 125) @@ -53,7 +53,7 @@ </li> <li> You may as well join <a href="irc://irc.freenode.net:6667/%23japi">IRC Channel <code>#japi</code> at <code>irc.freenode.net</code></a> and look for Cher(istheus), z0ra or Zergus. - Currently, the map editor of the MMORPG <a href="http://www.daimonin.net/">Daimonin</a> is JAPI's main application. + Currently <a href="http://gridarta.sourceforge.net/">Gridarta</a>, the map editor of the MMORPGs <a href="http://crossfire.real-time.com/">Crossfire</a> and <a href="http://www.daimonin.net/">Daimonin</a> is JAPI's main application. </li> </ul> <h2>Links</h2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-27 22:23:46
|
Revision: 124 Author: christianhujer Date: 2006-05-27 15:23:40 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=124&view=rev Log Message: ----------- Fixed NPE bug with preferences being changed. Modified Paths: -------------- trunk/src/app/net/sf/japi/swing/prefs/action.properties trunk/src/app/net/sf/japi/swing/prefs/action_de.properties Modified: trunk/src/app/net/sf/japi/swing/prefs/action.properties =================================================================== --- trunk/src/app/net/sf/japi/swing/prefs/action.properties 2006-05-27 22:22:12 UTC (rev 123) +++ trunk/src/app/net/sf/japi/swing/prefs/action.properties 2006-05-27 22:23:40 UTC (rev 124) @@ -26,4 +26,4 @@ revert.text=Revert cancel.text=Cancel prefsChanged.title=Prefs changed -prefsChanged=You have made changes to\nyour preferences for {0}.\n\nApply (keep) your changes? +prefsChanged.message=You have made changes to\nyour preferences for {0}.\n\nApply (keep) your changes? Modified: trunk/src/app/net/sf/japi/swing/prefs/action_de.properties =================================================================== --- trunk/src/app/net/sf/japi/swing/prefs/action_de.properties 2006-05-27 22:22:12 UTC (rev 123) +++ trunk/src/app/net/sf/japi/swing/prefs/action_de.properties 2006-05-27 22:23:40 UTC (rev 124) @@ -26,4 +26,4 @@ revert.text=Zur\xFCcksetzen cancel.text=Abbrechen prefsChanged.title=Voreinstellungen ge\xE4ndert -prefsChanged=Sie haben Ihre Einstellungen\nzu {0} ge\xE4ndert.\n\n\xC4nderungen anwenden (behalten)? +prefsChanged.message=Sie haben Ihre Einstellungen\nzu {0} ge\xE4ndert.\n\n\xC4nderungen anwenden (behalten)? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-27 22:22:21
|
Revision: 123 Author: christianhujer Date: 2006-05-27 15:22:12 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=123&view=rev Log Message: ----------- Updated credits. Modified Paths: -------------- trunk/CREDITS Modified: trunk/CREDITS =================================================================== --- trunk/CREDITS 2006-05-27 22:21:32 UTC (rev 122) +++ trunk/CREDITS 2006-05-27 22:22:12 UTC (rev 123) @@ -1,4 +1,4 @@ -The following people have contributed to JAPI: +The following people have contributed directly to JAPI: * Christian Hujer <ch...@it...> Inventor, creator, maintainer @@ -6,3 +6,8 @@ * Daniel Viegas <der...@so...> Several contributions, suggestions for enhancements and feedback + +JAPI wouldn't exist without the following projects: + +* KEduca, which is part of the KDE EDU package and inspired of writing a clone of it in Java, which much of JAPI was derived from. +* Daimonin, an MMORPG, that has a Map Editor written in Java which became JAPI's second application and made JAPI much more mature. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-27 22:21:39
|
Revision: 122 Author: christianhujer Date: 2006-05-27 15:21:32 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=122&view=rev Log Message: ----------- Updated changes. Modified Paths: -------------- trunk/src/doc/changes.xhtml Modified: trunk/src/doc/changes.xhtml =================================================================== --- trunk/src/doc/changes.xhtml 2006-05-27 22:20:42 UTC (rev 121) +++ trunk/src/doc/changes.xhtml 2006-05-27 22:21:32 UTC (rev 122) @@ -8,6 +8,19 @@ <title>JAPI - Important Changes</title> </head> <body> + <h2>Release 0.10.0</h2> + <ul> + <li>ActionFactory can create popup menus now.</li> + <li>NotNullIterator and NotNullIterable added.</li> + </ul> + <h2>Release 0.9.1</h2> + <p>Bug fix release.</p> + <h2>Release 0.9.0 (2006-04-17)</h2> + <h3>New additions and features</h3> + <ul> + <li>Command Line Argument Parser added.</li> + <li>JEduca, a KEduca clone, added as an example application. (Subversion access only)</li> + </ul> <h2>JAPI migrated to Subversion (2006-04-03)</h2> <h2>Release 0.8.0 (2006-03-29)</h2> <h3>New additions and features</h3> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-27 22:20:48
|
Revision: 121 Author: christianhujer Date: 2006-05-27 15:20:42 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=121&view=rev Log Message: ----------- Improved Grep example. Modified Paths: -------------- trunk/src/doc/guide/io/src/GrepJAPI.java Modified: trunk/src/doc/guide/io/src/GrepJAPI.java =================================================================== --- trunk/src/doc/guide/io/src/GrepJAPI.java 2006-05-27 22:20:16 UTC (rev 120) +++ trunk/src/doc/guide/io/src/GrepJAPI.java 2006-05-27 22:20:42 UTC (rev 121) @@ -12,34 +12,51 @@ */ public class GrepJAPI implements Command { + /** Whether to display the total line number. */ + private boolean totalLine; + /** Main program. * @param args command line arguments */ public static void main(final String... args) { - final GrepJAPI grepJAPI = new GrepJAPI(); - ArgParser.parse(grepJAPI, args); + ArgParser.parse(new GrepJAPI(), args); } /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) public void run(final List<String> args) { + int totalLines = 0; final String regex = args.remove(0); final Pattern pattern = Pattern.compile(regex); final Matcher matcher = pattern.matcher(""); for (final String line : new ARGV(args.toArray(new String[args.size()]))) { + totalLines++; if (matcher.reset(line).find()) { - System.out.println(line); + if (totalLine) { + System.out.format("%d:%s%n", totalLines, line); + } else { + System.out.format("%s%n", line); + } } } } + /** Print help and quit. */ @StopOption @Option({"h", "help"}) public void help() { - System.out.println("help"); + System.out.println("Usage: java GrepJAPI regex [file...]"); } + /** Print version and quit. */ @StopOption @Option({"V", "version"}) public void version() { - System.out.println("The version."); + System.out.println("GrepJAPI V 0.1"); } + + /** Set displaying the total line number. */ + @Option({"l", "total-line"}) + public void totalLine() { + totalLine = true; + } + } // class GrepJAPI This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-27 22:20:32
|
Revision: 120 Author: christianhujer Date: 2006-05-27 15:20:16 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=120&view=rev Log Message: ----------- Improved I/O ARGV handling. Modified Paths: -------------- trunk/src/app/net/sf/japi/io/ARGV.java trunk/src/app/net/sf/japi/io/ARGVEnumeration.java trunk/src/app/net/sf/japi/io/ARGVInputStream.java trunk/src/app/net/sf/japi/io/ARGVReader.java Modified: trunk/src/app/net/sf/japi/io/ARGV.java =================================================================== --- trunk/src/app/net/sf/japi/io/ARGV.java 2006-05-26 00:56:01 UTC (rev 119) +++ trunk/src/app/net/sf/japi/io/ARGV.java 2006-05-27 22:20:16 UTC (rev 120) @@ -95,4 +95,16 @@ throw new UnsupportedOperationException(); } + /** Get the name of the current file. + * @return name of the current file + * @throws IllegalStateException if all arguments from the list have been used up, so there is no current file + */ + public String getCurrentFilename() throws IllegalStateException { + if (argvReader != null) { + return argvReader.getCurrentFilename(); + } else { + throw new IllegalStateException("name of current file not available after argument list has been used up."); + } + } + } // class ARGV Modified: trunk/src/app/net/sf/japi/io/ARGVEnumeration.java =================================================================== --- trunk/src/app/net/sf/japi/io/ARGVEnumeration.java 2006-05-26 00:56:01 UTC (rev 119) +++ trunk/src/app/net/sf/japi/io/ARGVEnumeration.java 2006-05-27 22:20:16 UTC (rev 120) @@ -82,11 +82,13 @@ /* ignore. */ } } + //noinspection InstanceVariableUsedBeforeInitialized currentStream = nextStream; currentFilename = nextFilename; nextStream = null; while (index < args.length && nextStream == null) { try { + //noinspection IOResourceOpenedButNotSafelyClosed,NestedAssignment nextStream = new FileInputStream(nextFilename = args[index++]); } catch (final FileNotFoundException e) { log(e); @@ -125,7 +127,9 @@ handlers.add(handler); } - /** Get the name of the current file. */ + /** Get the name of the current file. + * @return name of the current file + */ public String getCurrentFilename() { return currentFilename; } Modified: trunk/src/app/net/sf/japi/io/ARGVInputStream.java =================================================================== --- trunk/src/app/net/sf/japi/io/ARGVInputStream.java 2006-05-26 00:56:01 UTC (rev 119) +++ trunk/src/app/net/sf/japi/io/ARGVInputStream.java 2006-05-27 22:20:16 UTC (rev 120) @@ -61,11 +61,29 @@ */ public class ARGVInputStream extends SequenceInputStream { + /** The ARGVEnumeration to use. */ + private final ARGVEnumeration argvEnumeration; + /** Create an ARGVInputStream. * @param args Command line arguments or some other String array containing 0 or more file names. */ public ARGVInputStream(final String... args) { - super(new ARGVEnumeration(STDERR, args)); + this(new ARGVEnumeration(STDERR, args)); } + /** Create an ARGVInputStream. + * @param argvEnumeration ARGVEnumeration to use + */ + private ARGVInputStream(final ARGVEnumeration argvEnumeration) { + super(argvEnumeration); + this.argvEnumeration = argvEnumeration; + } + + /** Get the name of the current file. + * @return name of the current file + */ + public String getCurrentFilename() { + return argvEnumeration.getCurrentFilename(); + } + } // class ARGVInputStream Modified: trunk/src/app/net/sf/japi/io/ARGVReader.java =================================================================== --- trunk/src/app/net/sf/japi/io/ARGVReader.java 2006-05-26 00:56:01 UTC (rev 119) +++ trunk/src/app/net/sf/japi/io/ARGVReader.java 2006-05-27 22:20:16 UTC (rev 120) @@ -61,12 +61,31 @@ */ public class ARGVReader extends BufferedReader { + /** The ARGVInputStream to read from. */ + private final ARGVInputStream argvInputStream; + /** Create an ARGVReader. * @param args Command line arguments or some other String array containing 0 or more file names. */ @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public ARGVReader(final String... args) { - super(new InputStreamReader(new ARGVInputStream(args))); + this(new ARGVInputStream(args)); } + /** Create an ARGVReader. + * @param argvInputStream ARGVInputstream to read from + */ + @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) + private ARGVReader(final ARGVInputStream argvInputStream) { + super(new InputStreamReader(argvInputStream)); + this.argvInputStream = argvInputStream; + } + + /** Get the name of the current file. + * @return name of the current file + */ + public String getCurrentFilename() { + return argvInputStream.getCurrentFilename(); + } + } // class ARGVReader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-26 00:56:34
|
Revision: 119 Author: christianhujer Date: 2006-05-25 17:56:01 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=119&view=rev Log Message: ----------- Added test case which asserts that iterator and iterable are the same here. Modified Paths: -------------- trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java Modified: trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java =================================================================== --- trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2006-05-25 23:58:03 UTC (rev 118) +++ trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2006-05-26 00:56:01 UTC (rev 119) @@ -91,4 +91,11 @@ } } + /** Test case for {@link SuperClassIterator#iterator()}. */ + public void testIterator() throws Exception { + final SuperClassIterator it1 = new SuperClassIterator(Object.class); + // if you ever split SuperClassIterator and SuperClassIterable, this assumption ceases to be correct. + assertSame("This kind of iterator must return itself.", it1, it1.iterator()); + } + } // class SuperClassIteratorTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-25 23:58:21
|
Revision: 118 Author: christianhujer Date: 2006-05-25 16:58:03 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=118&view=rev Log Message: ----------- Moved Tests from Daimonin / Gridarta to JAPI. Modified Paths: -------------- trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java Added Paths: ----------- trunk/src/test/net/sf/japi/util/NodeListIteratorTest.java trunk/src/test/net/sf/japi/util/PairTest.java trunk/src/test/net/sf/japi/util/TableTest.java trunk/src/test/net/sf/japi/util/UtilTest.java Modified: trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java 2006-05-25 23:53:53 UTC (rev 117) +++ trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java 2006-05-25 23:58:03 UTC (rev 118) @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ + package test.net.sf.japi.util; import java.util.Arrays; Added: trunk/src/test/net/sf/japi/util/NodeListIteratorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/NodeListIteratorTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/NodeListIteratorTest.java 2006-05-25 23:58:03 UTC (rev 118) @@ -0,0 +1,110 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.util; + +import java.util.Iterator; +import java.util.NoSuchElementException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import junit.framework.TestCase; +import net.sf.japi.xml.NodeListIterator; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** Test class for {@link NodeListIterator}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class NodeListIteratorTest extends TestCase { + + /** Object Under Test: A NodeListIterator. */ + private NodeListIterator<Node> oUT; + + /** Mock NodeList. */ + private NodeList mockNodeList; + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + mockNodeList = createMockNodeList(); + oUT = new NodeListIterator<Node>(mockNodeList); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + oUT = null; + } + + /** Test case for {@link NodeListIterator#iterator()}. */ + public void testIterator() throws Exception { + final Iterator<Node> iterator = oUT.iterator(); + assertNotNull("Iterator must exist", iterator); + } + + /** Test case for {@link net.sf.japi.util.NodeListIterator#hasNext()}. */ + public void testHasNext() throws Exception { + for (int i = 0; i < mockNodeList.getLength(); i++) { + assertTrue("Iterator must return as many elements as the underlying NodeList has.", oUT.hasNext()); + oUT.next(); + } + assertFalse("Iterator must not return more elements than the underlying NodeList.", oUT.hasNext()); + } + + /** Test case for {@link NodeListIterator#next()}. */ + public void testNext() throws Exception { + for (int i = 0; i < mockNodeList.getLength(); i++) { + assertSame("Iterator must return Nodes in original NodeList order.", oUT.next(), mockNodeList.item(i)); + } + try { + oUT.next(); + fail("Iterator must throw NoSuchElementException if invoking next() more often than available Nodes."); + } catch (final NoSuchElementException e) { + /* ignore, this exception is expected to occur. */ + } + } + + /** Test case for {@link NodeListIterator#remove()}. */ + public void testRemove() throws Exception { + try { + oUT.remove(); + fail("NodeListIterator.remove() is expected to always throw UnsupportedOperationException."); + } catch (final UnsupportedOperationException e) { + /* ignore, this exception is expected to occur. */ + } + } + + /** Create a mock NodeList. + * @return a mock NodeList + * @throws Exception in case the test setup couldn't be created + */ + private static NodeList createMockNodeList() throws Exception { + final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + final DocumentBuilder db = dbf.newDocumentBuilder(); + final Document doc = db.newDocument(); + doc.appendChild(doc.createComment("bla")); + doc.appendChild(doc.createElement("bla")); + doc.appendChild(doc.createComment("bla")); + return doc.getChildNodes(); + } + +} // class NodeListIteratorTest Property changes on: trunk/src/test/net/sf/japi/util/NodeListIteratorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/test/net/sf/japi/util/PairTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/PairTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/PairTest.java 2006-05-25 23:58:03 UTC (rev 118) @@ -0,0 +1,77 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.util; + +import junit.framework.TestCase; +import net.sf.japi.util.Pair; + +/** Test class for {@link Pair}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class PairTest extends TestCase { + + /** Object Under Test: A Table. */ + private Pair<Object,Object> oUT; + private String first; + private String second; + + /** {@inheritDoc} */ + @Override protected void setUp() throws Exception { + super.setUp(); + first = "First"; + second = "Second"; + oUT = new Pair<Object,Object>(first, second); + } + + /** {@inheritDoc} */ + @Override protected void tearDown() throws Exception { + super.tearDown(); + oUT = null; + first = null; + second = null; + } + + /** Test case for {@link Pair#getFirst()}. */ + public void testGetFirst() throws Exception { + assertSame("First must be retreivable via getFirst()", first, oUT.getFirst()); + } + + /** Test case for {@link Pair#getSecond()}. */ + public void testGetSecond() throws Exception { + assertSame("First must be retreivable via getSecond()", second, oUT.getSecond()); + } + + /** Test case for {@link Pair#Pair(Object,Object)}. */ + public void testPair() throws Exception { + assertTrue("Dummy assertion.", true); + // This test is already implicitly performed by #setUp(). + } + + /** Test case for {@link Pair#equals(Object)}. */ + public void testEquals() throws Exception { + assertFalse("A pair must not be equal to random objects.", oUT.equals(new Object())); + assertTrue("A pair must be equal to itself", oUT.equals(oUT)); + assertTrue("A pair must be equal to another pair with same first and second", oUT.equals(new Pair<Object,Object>(first, second))); + assertTrue("A pair must be equal to another pair with equal first and second", oUT.equals(new Pair<Object,Object>(new String(first.toCharArray()), new String(second.toCharArray())))); + } + +} // class PairTest Property changes on: trunk/src/test/net/sf/japi/util/PairTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/test/net/sf/japi/util/TableTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/TableTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/TableTest.java 2006-05-25 23:58:03 UTC (rev 118) @@ -0,0 +1,90 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.util; + +import junit.framework.TestCase; +import net.sf.japi.util.Pair; +import net.sf.japi.util.Table; + +/** Test class for Table. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class TableTest extends TestCase { + + /** Object Under Test: A Table. */ + private Table<Object,Object> oUT; + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + oUT = new Table<Object,Object>(); + } + + /** {@inheritDoc} */ + @Override protected void tearDown() throws Exception { + super.tearDown(); + oUT = null; + } + + /** Test case for creating an empty table. */ + public void testTable() { + assertEquals("Newly created table must be empty.", 0, oUT.size()); + } + + /** Test case for clearing a table. */ + public void testClear() throws Exception { + oUT.putPair(new Object(), new Object()); + assertSize("Added 1 Element", 1); + oUT.clear(); + assertSize("Cleared", 0); + oUT.putPair(new Object(), new Object()); + assertSize("Added 1 Element", 1); + oUT.putPair(new Object(), new Object()); + assertSize("Added 2 Elements", 2); + oUT.putPair(new Object(), new Object()); + assertSize("Added 3 Elements", 3); + oUT.clear(); + assertSize("Cleared", 0); + } + + /** Test case for putPair() methods. */ + public void testPutPair() { + final String key1 = "key1"; + final Object value1 = "value1"; + oUT.putPair(key1, value1); + assertSize("Added 1 Element", 1); + final String key2 = "key2"; + final Object value2 = "value2"; + oUT.putPair(new Pair<Object,Object>(key2, value2)); + assertSize("Added 2 Elements", 2); + // TODO: Get pairs and compare... + } + + /** Assert that the table (oUT) has a certain size. + * @param reason Reason why the size is expected + * @param size Expected size + */ + private void assertSize(final String reason, final int size) { + assertEquals("Expected size " + size + " (Reason: " + reason + ')', size, oUT.size()); + } + +} // class TableTest Property changes on: trunk/src/test/net/sf/japi/util/TableTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/test/net/sf/japi/util/UtilTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/UtilTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/UtilTest.java 2006-05-25 23:58:03 UTC (rev 118) @@ -0,0 +1,56 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.util; + +import junit.framework.TestCase; +import net.sf.japi.util.Arrays2; + +/** + * Test for {@link Arrays2}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class UtilTest extends TestCase { + + /** {@inheritDoc} */ + @Override + public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override + public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link Arrays2#linearSearch(int, int[])}. */ + public void testLinearSearch() throws Exception { + 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)); + } + +} // class UtilTest Property changes on: trunk/src/test/net/sf/japi/util/UtilTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-05-25 23:54:04
|
Revision: 117 Author: christianhujer Date: 2006-05-25 16:53:53 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=117&view=rev Log Message: ----------- Added Unit Test for EnumerationIterator (copied from Gridarta / Daimonin). Added Paths: ----------- trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java Added: trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java 2006-05-25 23:53:53 UTC (rev 117) @@ -0,0 +1,99 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +package test.net.sf.japi.util; + +import java.util.Arrays; +import java.util.Collections; +import java.util.NoSuchElementException; +import junit.framework.TestCase; +import net.sf.japi.util.EnumerationIterator; + +/** Test class for {@link EnumerationIterator}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class EnumerationIteratorTest extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link EnumerationIterator#iterator()}. */ + public void testIterator() throws Exception { + EnumerationIterator<?> oUT = new EnumerationIterator<String>(Collections.enumeration(Arrays.asList("foo", "bar"))); + assertNotNull("Even empty enumerations must generate an iterator instance.", oUT.iterator()); + oUT = new EnumerationIterator<Object>(Collections.enumeration(Arrays.asList())); + assertNotNull("Even empty enumerations must generate an iterator instance.", oUT.iterator()); + } + + /** Test case for {@link EnumerationIterator#hasNext()}. */ + public void testHasNext() throws Exception { + EnumerationIterator<?> oUT = new EnumerationIterator<Object>(Collections.enumeration(Arrays.asList())); + assertFalse("hasNext() on empty enumeration must instantly return false.", oUT.hasNext()); + oUT = new EnumerationIterator<String>(Collections.enumeration(Arrays.asList("foo", "bar"))); + assertTrue("hasNext() on nonempty enumeration must first return true.", oUT.hasNext()); + } + + /** Test case for {@link EnumerationIterator#next()}. */ + public void testNext() throws Exception { + EnumerationIterator<?> oUT = new EnumerationIterator<Object>(Collections.enumeration(Arrays.asList())); + try { + oUT.next(); + fail("next() on empty enumeration must instantly throw NoSuchElementException."); + } catch (final NoSuchElementException e) { + /* Expected exception. */ + } + oUT = new EnumerationIterator<String>(Collections.enumeration(Arrays.asList("foo", "bar"))); + oUT.next(); + oUT.next(); + try { + oUT.next(); + fail("next() on two elements enumeration must throw NoSuchElementException on third invocation."); + } catch (final NoSuchElementException e) { + /* Expected exception. */ + } + } + + /** Test case for {@link EnumerationIterator#remove()}. */ + public void testRemove() throws Exception { + EnumerationIterator<?> oUT = new EnumerationIterator<Object>(Collections.enumeration(Arrays.asList())); + try { + oUT.remove(); + fail("remove() on empty enumeration must instantly throw UnsupportedOperationException."); + } catch (final UnsupportedOperationException e) { + /* Expected exception. */ + } + oUT = new EnumerationIterator<String>(Collections.enumeration(Arrays.asList("foo", "bar"))); + try { + oUT.next(); + oUT.remove(); + fail("remove() must throw UnsupportedOperationException."); + } catch (final UnsupportedOperationException e) { + /* Expected exception. */ + } + } + +} // class EnumerationIteratorTest Property changes on: trunk/src/test/net/sf/japi/util/EnumerationIteratorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-05-08 19:05:54
|
Revision: 116 Author: christianhujer Date: 2006-05-08 12:05:45 -0700 (Mon, 08 May 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=116&view=rev Log Message: ----------- Fix for http://www.daimonin.net/mantis/view.php?id=397 Modified Paths: -------------- trunk/src/app/net/sf/japi/swing/JFileChooserButton.java Modified: trunk/src/app/net/sf/japi/swing/JFileChooserButton.java =================================================================== --- trunk/src/app/net/sf/japi/swing/JFileChooserButton.java 2006-04-30 16:44:50 UTC (rev 115) +++ trunk/src/app/net/sf/japi/swing/JFileChooserButton.java 2006-05-08 19:05:45 UTC (rev 116) @@ -152,7 +152,7 @@ } final int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { - textField.setText(chooser.getSelectedFile().getPath()); + textField.setText(base.toURI().relativize(chooser.getSelectedFile().toURI()).toString()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-30 16:44:55
|
Revision: 115 Author: christianhujer Date: 2006-04-30 09:44:50 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=115&view=rev Log Message: ----------- Fixed missing new line at end of file Modified Paths: -------------- trunk/src/test/net/sf/japi/io/BCDTest.java Modified: trunk/src/test/net/sf/japi/io/BCDTest.java =================================================================== --- trunk/src/test/net/sf/japi/io/BCDTest.java 2006-04-30 13:46:36 UTC (rev 114) +++ trunk/src/test/net/sf/japi/io/BCDTest.java 2006-04-30 16:44:50 UTC (rev 115) @@ -87,4 +87,4 @@ assertEquals("correct(0xA) is 0x10.", 0x10, BCD.correct(0xA)); } -} // class BCDTest \ No newline at end of file +} // class BCDTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-30 13:46:46
|
Revision: 114 Author: christianhujer Date: 2006-04-30 06:46:36 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=114&view=rev Log Message: ----------- Added BCD test case. Added Paths: ----------- trunk/src/test/net/sf/japi/io/ trunk/src/test/net/sf/japi/io/BCDTest.java Added: trunk/src/test/net/sf/japi/io/BCDTest.java =================================================================== --- trunk/src/test/net/sf/japi/io/BCDTest.java (rev 0) +++ trunk/src/test/net/sf/japi/io/BCDTest.java 2006-04-30 13:46:36 UTC (rev 114) @@ -0,0 +1,90 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.io; + +import junit.framework.TestCase; +import net.sf.japi.io.BCD; + +/** Test for {@link BCD}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class BCDTest extends TestCase { + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + } + + /** Test case for {@link BCD#bcd2int(int)}. */ + public void testBcd2int() throws Exception { + assertEquals("bcd 0x00000000 -> dec 0", 0, BCD.bcd2int(0x00000000)); + assertEquals("bcd 0x00000010 -> dec 10", 10, BCD.bcd2int(0x00000010)); + assertEquals("bcd 0x99999999 -> dec 99999999", 99999999, BCD.bcd2int(0x99999999)); + } + + /** Test case for {@link BCD#int2bcd(int)}. */ + public void testInt2bcd() throws Exception { + assertEquals("dec 0 -> bcd 0x00000000", 0x00000000, BCD.int2bcd( 0)); + assertEquals("dec 10 -> bcd 0x00000010", 0x00000010, BCD.int2bcd( 10)); + assertEquals("dec 99999999 -> bcd 0x99999999", 0x99999999, BCD.int2bcd(99999999)); + } + + /** Test case for {@link BCD#check(int)}. */ + public void testCheck() throws Exception { + try { + BCD.check(0x99999999); + } catch (final IllegalArgumentException ignore) { + fail("0x99999999 is okay"); + } + } + + /** Test case for {@link BCD#isBcd(int)}. */ + public void testIsBcd() throws Exception { + assertTrue("0x99999999 is okay", BCD.isBcd(0x99999999)); + assertFalse("0xAAAAAAAA is not okay", BCD.isBcd(0xAAAAAAAA)); + } + + /** Test case for {@link BCD#base10(int)}. */ + public void testBase10() throws Exception { + assertEquals("pow(10, 0) is 1.", 1, BCD.base10(0)); + assertEquals("pow(10, 1) is 10.", 10, BCD.base10(1)); + assertEquals("pow(10, 2) is 100.", 100, BCD.base10(2)); + assertEquals("pow(10, 3) is 1000.", 1000, BCD.base10(3)); + assertEquals("pow(10, 4) is 10000.", 10000, BCD.base10(4)); + assertEquals("pow(10, 5) is 100000.", 100000, BCD.base10(5)); + assertEquals("pow(10, 6) is 1000000.", 1000000, BCD.base10(6)); + assertEquals("pow(10, 7) is 10000000.", 10000000, BCD.base10(7)); + assertEquals("pow(10, 8) is 100000000.", 100000000, BCD.base10(8)); + assertEquals("pow(10, 9) is 1000000000.", 1000000000, BCD.base10(9)); + } + + /** Test case for {@link BCD#correct(int)}. */ + public void testCorrect() throws Exception { + assertEquals("correct(0xA) is 0x10.", 0x10, BCD.correct(0xA)); + } + +} // class BCDTest \ No newline at end of file Property changes on: trunk/src/test/net/sf/japi/io/BCDTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-04-30 13:30:31
|
Revision: 113 Author: christianhujer Date: 2006-04-30 06:30:22 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=113&view=rev Log Message: ----------- Suppressed some warnings. Modified Paths: -------------- trunk/src/app/net/sf/japi/io/BCD.java Modified: trunk/src/app/net/sf/japi/io/BCD.java =================================================================== --- trunk/src/app/net/sf/japi/io/BCD.java 2006-04-27 00:34:42 UTC (rev 112) +++ trunk/src/app/net/sf/japi/io/BCD.java 2006-04-30 13:30:22 UTC (rev 113) @@ -25,6 +25,7 @@ * Probably <code>net.sf.japi.io</code> is not the ideal package for this class, yet it seems most appropriate. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ +@SuppressWarnings({"UtilityClass", "ClassNamingConvention"}) public final class BCD { /** Private constructor - no instances needed. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-27 00:34:48
|
Revision: 112 Author: christianhujer Date: 2006-04-26 17:34:42 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=112&view=rev Log Message: ----------- Linked changeset elements to svn web interface. Modified Paths: -------------- trunk/src/doc/changelog.xslt Modified: trunk/src/doc/changelog.xslt =================================================================== --- trunk/src/doc/changelog.xslt 2006-04-27 00:25:30 UTC (rev 111) +++ trunk/src/doc/changelog.xslt 2006-04-27 00:34:42 UTC (rev 112) @@ -100,7 +100,7 @@ <xsl:template match="path"> <li> <xsl:value-of select="@action" /><xsl:text> </xsl:text> - <code><xsl:value-of select="." /></code> + <code><a href="http://svn.sourceforge.net/viewcvs.cgi/japi{.}"><xsl:value-of select="." /></a></code> </li> </xsl:template> </xsl:transform> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-27 00:25:38
|
Revision: 111 Author: christianhujer Date: 2006-04-26 17:25:30 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=111&view=rev Log Message: ----------- Added NotNullIterator and NotNullIterable. Added Paths: ----------- trunk/src/app/net/sf/japi/util/NotNullIterator.java Added: trunk/src/app/net/sf/japi/util/NotNullIterator.java =================================================================== --- trunk/src/app/net/sf/japi/util/NotNullIterator.java (rev 0) +++ trunk/src/app/net/sf/japi/util/NotNullIterator.java 2006-04-27 00:25:30 UTC (rev 111) @@ -0,0 +1,90 @@ +/* + * JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +package net.sf.japi.util; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** Iterator / Iterable decorator that skips elements which are <code>null</code>. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class NotNullIterator<T> implements Iterator<T> { + + /** The iterator to use. */ + private final Iterator<T> iterator; + + /** Prefetched next element. */ + private T next; + + /** Create a NotNullIterator over another Iterator. + * @param iterator + */ + public NotNullIterator(final Iterator<T> iterator) { + this.iterator = iterator; + prefetchNext(); + } + + /** Prefetches the next element. */ + private void prefetchNext() { + //noinspection NestedAssignment,ControlFlowStatementWithoutBraces,StatementWithEmptyBody + while (iterator.hasNext() && (next = iterator.next()) == null); + } + + /** {@inheritDoc} */ + public boolean hasNext() { + return next != null; + } + + /** {@inheritDoc} */ + public T next() { + if (next == null) { + throw new NoSuchElementException(); + } + try { + return next; + } finally { + prefetchNext(); + } + } + + /** {@inheritDoc} */ + public void remove() { + throw new UnsupportedOperationException(); + } + + /** An Iterable adapter for NotNullIterator. */ + public static class NotNullIterable<T> implements Iterable<T> { + + /** The iterable to iterate over. */ + private final Iterable<T> iterable; + + public NotNullIterable(final Iterable<T> iterable) { + this.iterable = iterable; + } + + /** {@inheritDoc} */ + public Iterator<T> iterator() { + return new NotNullIterator<T>(iterable.iterator()); + } + + } // class NotNullIterable + +} // class NotNullIterator Property changes on: trunk/src/app/net/sf/japi/util/NotNullIterator.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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...> - 2006-04-26 22:17:38
|
Revision: 110 Author: christianhujer Date: 2006-04-26 15:17:31 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=110&view=rev Log Message: ----------- Added creation of popup menus. Modified Paths: -------------- trunk/src/app/net/sf/japi/swing/ActionFactory.java Modified: trunk/src/app/net/sf/japi/swing/ActionFactory.java =================================================================== --- trunk/src/app/net/sf/japi/swing/ActionFactory.java 2006-04-25 20:47:18 UTC (rev 109) +++ trunk/src/app/net/sf/japi/swing/ActionFactory.java 2006-04-26 22:17:31 UTC (rev 110) @@ -51,6 +51,7 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JToolBar; +import javax.swing.JPopupMenu; import static javax.swing.KeyStroke.getKeyStroke; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -620,6 +621,37 @@ return menuBar; } + /** Method for creating a popup menu. + * @param store whether to store the initialized Actions in the ActionMap of this ActionFactory + * @param popupKey Action key of popup menu to create + * @return JPopupMenu created for <var>popupKey</var> + * @throws NullPointerException if no menubar definition was found + * @todo make error handling consistent (see createMenu and others) + */ + @NotNull public JPopupMenu createPopupMenu(final boolean store, final String popupKey) throws NullPointerException { + final JPopupMenu menu = new JPopupMenu(); + for (final String key : getString(popupKey + ".menu").split("\\s+")) { + if (key != null && key.length() == 0) { + /* ignore this for empty menus */ + } else if (key == null || "-".equals(key)) { + menu.addSeparator(); + } else if (getString(key + ".menu") != null) { + menu.add(createMenu(store, key)); + } else { + final Action action = getAction(key); + if (action == null) { + throw new Error("No Action for key " + key); + } + if (action instanceof ToggleAction) { + menu.add(((ToggleAction) action).createCheckBoxMenuItem()); + } else { + menu.add(action); + } + } + } + return menu; + } + /** Method for creating a Menu. * This method assumes that the underlying properties contain an entry like <code>key + ".menu"</code> which lists the menu element's keys. * Submenus are build recursively. @@ -670,6 +702,42 @@ return menuBar; } + /** Method for creating a popup menu. + * @param store whether to store the initialized Actions in the ActionMap of this ActionFactory + * @param popupKey Action key of popup menu to create + * @param target Target object + * @return JPopupMenu created for <var>barKey</var> + */ + public JPopupMenu createPopupMenu(final boolean store, final String popupKey, final Object target) { + final JPopupMenu menu = new JPopupMenu(); + for (final String key : getString(popupKey + ".menu").split("\\s+")) { + if (key != null && key.length() == 0) { + /* ignore this for empty menus */ + } else if (key == null || "-".equals(key)) { + menu.addSeparator(); + } else if (getString(key + ".menu") != null) { + menu.add(createMenu(store, key, target)); + } else { + Action action = null; + if (store) { + action = getAction(key); + } + if (action == null) { + action = createAction(store, key, target); + } + if (action == null) { + throw new Error("No Action for key " + key); + } + if (action instanceof ToggleAction) { + menu.add(((ToggleAction) action).createCheckBoxMenuItem()); + } else { + menu.add(action); + } + } + } + return menu; + } + /** Method for creating a Menu. * This method assumes that the underlying properties contain an entry like <code>key + ".menu"</code> which lists the menu element's keys. * Submenus are build recursively. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z0...@us...> - 2006-04-25 20:47:43
|
Revision: 109 Author: z0ra Date: 2006-04-25 13:47:18 -0700 (Tue, 25 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=109&view=rev Log Message: ----------- Changed class name of InterestCalculator. Added Paths: ----------- trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java Removed Paths: ------------- trunk/src/app/net/sf/japi/finance/InterestCalculator.java trunk/src/test/net/sf/japi/finance/InterestCalculatorTest.java Deleted: trunk/src/app/net/sf/japi/finance/InterestCalculator.java =================================================================== --- trunk/src/app/net/sf/japi/finance/InterestCalculator.java 2006-04-24 22:27:52 UTC (rev 108) +++ trunk/src/app/net/sf/japi/finance/InterestCalculator.java 2006-04-25 20:47:18 UTC (rev 109) @@ -1,95 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2006 Anja Heim - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.finance; - -/** Class contains some functionality for calculating capital after some periods of time. - * @author <a href="mailto:miz...@we...">A. Heim</a> - */ -public class InterestCalculator { - - private final float initialCapital; - private float interestRate; - private float currentCapital; - - public InterestCalculator(final float initialCapital, final float interestRate) { - this.initialCapital = initialCapital; - this.interestRate = interestRate; - this.currentCapital = this.initialCapital; - } - - /** Calculates the overall capital after some periods beginnig with given initial capital and interest rate. - * <br />The formula is: <code>capital_after_n_periods = start_captial * ( 1 + p/100 )^n</code> - * (with p as interest rate) - * @param numberOfPeriods - * @return the overall capital after numberOfPeriods periods - */ - public float calculateCapital( int numberOfPeriods ) { - if ( numberOfPeriods < 0 ) throw new IllegalArgumentException("Number of periods has to be at least 1!"); - if ( numberOfPeriods == 0 ) - return initialCapital; - if( numberOfPeriods == 1 ) { - currentCapital = currentCapital *(1 + interestRate/100); - } else { - currentCapital = calculateCapital( numberOfPeriods - 1 ); - } - return currentCapital; - } - - /** Returns the current capital. - * - * @return current capital - */ - public float getCurrentCapital() { - return currentCapital; - } - - /** Sets new current capital. - * - * @param currentCapital - */ - public void setCurrentCapital(float currentCapital) { - this.currentCapital = currentCapital; - } - - /** Sets new interest rate. - * - * @param interestRate - */ - public void setInterestRate(float interestRate) { - this.interestRate = interestRate; - } - - /** Returns the current interest rate. - * - * @return the current interest rate - */ - public float getInterestRate() { - return interestRate; - } - - /** Resets the current capital to initial capital. - * - */ - public void resetCapital() { - this.currentCapital = this.initialCapital; - } - -} // class InterestCalculator Copied: trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java (from rev 50, trunk/src/app/net/sf/japi/finance/InterestCalculator.java) =================================================================== --- trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java (rev 0) +++ trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2006-04-25 20:47:18 UTC (rev 109) @@ -0,0 +1,116 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Anja Heim + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.finance; + +/** Class contains some functionality for calculating capital after some periods of time. + * @author <a href="mailto:z0...@us...">A. Heim</a> + */ +public class SimpleCapitalCalculator { + + private final double initialCapital; + private double interestRate; + private double currentCapital; + + public SimpleCapitalCalculator(final double initialCapital, final double interestRate) { + this.initialCapital = initialCapital; + this.interestRate = interestRate; + this.currentCapital = this.initialCapital; + } + + /** Calculates the overall capital after some periods beginnig with given initial capital and interest rate. + * <br />The formula is: <code>capital_after_n_periods = start_captial * ( 1 + p/100 )^n</code> + * (with p as interest rate) + * @param numberOfPeriods + * @return the overall capital after numberOfPeriods periods + */ + public double calculateCapital( int numberOfPeriods ) { + if ( numberOfPeriods < 0 ) throw new IllegalArgumentException("Number of periods has to be at least 0!"); + if ( numberOfPeriods == 0 ) + return initialCapital; + if( numberOfPeriods == 1 ) { + currentCapital = currentCapital *(1 + interestRate/100); + } else { + currentCapital = calculateCapital( numberOfPeriods - 1 ); + } + return currentCapital; + } + + /** Returns the current capital. + * + * @return current capital + */ + public double getCurrentCapital() { + return currentCapital; + } + + /** Sets new current capital. + * + * @param currentCapital + */ + public void setCurrentCapital(double currentCapital) { + this.currentCapital = currentCapital; + } + + /** Sets new interest rate. + * + * @param interestRate + */ + public void setInterestRate(double interestRate) { + this.interestRate = interestRate; + } + + /** Returns the current interest rate. + * + * @return the current interest rate + */ + public double getInterestRate() { + return interestRate; + } + + /** Resets the current capital to initial capital. + * + */ + public void resetCapital() { + this.currentCapital = this.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; + } + + /** Clones the current SimpleCapitalCalculator. + * + * @return Object SimpleCapitalCalculator + */ + public Object clone() { + try { + return super.clone(); + } catch ( CloneNotSupportedException e ) { + throw new InternalError(); + } + } +} // class SimpleCapitalCalculator Property changes on: trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Deleted: trunk/src/test/net/sf/japi/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/finance/InterestCalculatorTest.java 2006-04-24 22:27:52 UTC (rev 108) +++ trunk/src/test/net/sf/japi/finance/InterestCalculatorTest.java 2006-04-25 20:47:18 UTC (rev 109) @@ -1,88 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2006 Anja Heim - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package test.net.sf.japi.finance; - -import junit.framework.TestCase; -import net.sf.japi.finance.InterestCalculator; - -/** Tests the capital finance class. - * Date: 09.04.2006 - */ -public class InterestCalculatorTest extends TestCase { - - InterestCalculator ic = new InterestCalculator(100, 15); - - public void testInterestCalculator() throws Exception { - //ic = new InterestCalculator(100, 15); - } - - /** Tests capital after 0, 1, 2 , 3 years. - * @throws Exception - */ - public void testCalculateCapital() throws Exception { - //ic = new InterestCalculator(100, 15); - - - /* first try it with invalid argument */ - try { - ic.calculateCapital(-1); - fail("Expected IllegalArgumentException."); - } catch (final IllegalArgumentException ignore) { - /* ignore */ - } - /* then use some different periods */ - assertEquals("Capital after a time period of 0 must be the starting capital.", (float)100.0 , ic.calculateCapital( 0 ) ); - assertEquals( (float)115.0 , ic.calculateCapital( 1 ) ); - assertEquals( (float)132.25 , ic.calculateCapital( 2 ) ); - assertEquals( (float)152.0875, ic.calculateCapital( 3 ) ); - } - - public void testGetCurrentCapital() throws Exception { - assertEquals( (float)100.00, ic.getCurrentCapital() ); - ic.calculateCapital(1); - assertEquals( (float)115.00, ic.getCurrentCapital() ); - } - - public void testSetCurrentCapital() throws Exception { - assertEquals( (float)100.00, ic.getCurrentCapital() ); - ic.calculateCapital(1); - assertEquals( (float)115.00, ic.getCurrentCapital() ); - ic.setCurrentCapital((float)100.00); - assertEquals( (float)100.00, ic.getCurrentCapital() ); - } - - public void testGetInterestRate() throws Exception { - assertEquals( (float)15, ic.getInterestRate() ); - } - - public void testSetInterestRate() throws Exception { - ic.setInterestRate(16); - assertEquals( (float)16, ic.getInterestRate() ); - } - - public void testResetCapital() throws Exception { - ic.calculateCapital(1); - assertEquals( (float)115, ic.getCurrentCapital() ); - ic.resetCapital(); - assertEquals( (float)100, ic.getCurrentCapital() ); - } - -} // class InterestCalculatorTest Copied: trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java (from rev 50, trunk/src/test/net/sf/japi/finance/InterestCalculatorTest.java) =================================================================== --- trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java (rev 0) +++ trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java 2006-04-25 20:47:18 UTC (rev 109) @@ -0,0 +1,80 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2006 Anja Heim + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package test.net.sf.japi.finance; + +import junit.framework.TestCase; +import net.sf.japi.finance.SimpleCapitalCalculator; + +/** Tests the capital finance class. + * Date: 09.04.2006 + * + */ +public class SimpleCapitalCalculatorTest extends TestCase { + + SimpleCapitalCalculator ic = new SimpleCapitalCalculator(100, 15); + + public void testSimpleCapitalCalculator() throws Exception { + //ic = new SimpleCapitalCalculator(100, 15); + } + + /** Tests capital after 0, 1, 2 , 3 years. + * @throws Exception + */ + public void testCalculateCapital() throws Exception { + /* first try it with invalid argument */ + try { + ic.calculateCapital(-1); + fail("Expected IllegalArgumentException."); + } catch (final IllegalArgumentException ignore) { + /* ignore */ + } + /* then use some different periods */ + assertEquals("Capital after a time period of 0 must be the starting capital.", 100.0 , ic.calculateCapital( 0 ) ); + assertEquals("Capital after a time period of 1 must be 115.0.", 115.0 , ic.calculateCapital( 1 ), 0.001 ); + assertEquals("Capital after a time period of 2 must be 132.25", 132.25 , ic.calculateCapital( 2 ), 0.001 ); + assertEquals("Capital after a time period of 3 must be 152.0875", 152.0875, ic.calculateCapital( 3 ), 0.001 ); + } + + public void testGetCurrentCapital() throws Exception { + ic.calculateCapital(1); + assertEquals("GetCurrentCapital after one period should be 115.00.", 115.00, ic.getCurrentCapital(), 0.001 ); + } + + public void testSetCurrentCapital() throws Exception { + ic.setCurrentCapital(123.45); + assertEquals("Capital set to 123.45.", 123.45, ic.getCurrentCapital(), 0.001 ); + } + + public void testGetInterestRate() throws Exception { + assertEquals("Interest rate should be 15.", 15, ic.getInterestRate(), 0.001 ); + } + + public void testSetInterestRate() throws Exception { + ic.setInterestRate(16); + assertEquals("Interest rate set to 16.", 16, ic.getInterestRate(), 0.001 ); + } + + public void testResetCapital() throws Exception { + ic.calculateCapital(1); + ic.resetCapital(); + assertEquals("After reset capital has to be the initial capital.", 100, ic.getCurrentCapital(), 0.001 ); + } +} // class SimpleCapitalCalculatorTest Property changes on: trunk/src/test/net/sf/japi/finance/SimpleCapitalCalculatorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |