Adding solutions received for task1
authorjapod@localhost
Sun, 28 Sep 2008 14:12:38 +0200
changeset 697662396c0fd
parent 5 d283f4401334
child 7 ac8f5d2832db
Adding solutions received for task1
task1/README
task1/solution01/build.xml
task1/solution01/nbproject/build-impl.xml
task1/solution01/nbproject/genfiles.properties
task1/solution01/nbproject/project.properties
task1/solution01/nbproject/project.xml
task1/solution01/src/org/apidesign/apifest08/currency/AbstractConvertorFactory.java
task1/solution01/src/org/apidesign/apifest08/currency/AbstractCurrencyConvertor.java
task1/solution01/src/org/apidesign/apifest08/currency/CannotConvertException.java
task1/solution01/src/org/apidesign/apifest08/currency/CannotInstantiateFactoryException.java
task1/solution01/src/org/apidesign/apifest08/currency/CannotProvideValueException.java
task1/solution01/src/org/apidesign/apifest08/currency/ConversionProperties.java
task1/solution01/src/org/apidesign/apifest08/currency/ConversionRatioProvider.java
task1/solution01/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution01/src/org/apidesign/apifest08/currency/ConvertorNotAvailableException.java
task1/solution01/src/org/apidesign/apifest08/currency/ConvertorsFactory.java
task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorFactory.java
task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorFactoryImpl.java
task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorImpl.java
task1/solution01/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution02/build.xml
task1/solution02/nbproject/build-impl.xml
task1/solution02/nbproject/genfiles.properties
task1/solution02/nbproject/project.properties
task1/solution02/nbproject/project.xml
task1/solution02/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution02/src/org/apidesign/apifest08/currency/ConvertorFactory.java
task1/solution02/src/org/apidesign/apifest08/currency/DefaultConvertor.java
task1/solution02/src/org/apidesign/apifest08/currency/DefaultConvertorFactory.java
task1/solution02/src/org/apidesign/apifest08/currency/Money.java
task1/solution02/src/org/apidesign/apifest08/currency/MoneyImpl.java
task1/solution02/src/org/apidesign/apifest08/currency/UnsupportedConversionException.java
task1/solution02/test/org/apidesign/apifest08/test/ConvertorFactoryTest.java
task1/solution02/test/org/apidesign/apifest08/test/ConvertorTest.java
task1/solution02/test/org/apidesign/apifest08/test/MoneyTest.java
task1/solution02/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution03/build.xml
task1/solution03/nbproject/build-impl.xml
task1/solution03/nbproject/genfiles.properties
task1/solution03/nbproject/project.properties
task1/solution03/nbproject/project.xml
task1/solution03/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution03/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution04/build.xml
task1/solution04/nbproject/build-impl.xml
task1/solution04/nbproject/genfiles.properties
task1/solution04/nbproject/project.properties
task1/solution04/nbproject/project.xml
task1/solution04/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution04/src/org/apidesign/apifest08/currency/ConvertorFactory.java
task1/solution04/src/org/apidesign/apifest08/currency/CurrencyValues.java
task1/solution04/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution05/build.xml
task1/solution05/nbproject/build-impl.xml
task1/solution05/nbproject/genfiles.properties
task1/solution05/nbproject/project.properties
task1/solution05/nbproject/project.xml
task1/solution05/src/org/apidesign/apifest08/currency/Amount.java
task1/solution05/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution05/src/org/apidesign/apifest08/currency/ConvertorFactory.java
task1/solution05/src/org/apidesign/apifest08/currency/ConvertorImpl.java
task1/solution05/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution06/build.xml
task1/solution06/nbproject/build-impl.xml
task1/solution06/nbproject/genfiles.properties
task1/solution06/nbproject/project.properties
task1/solution06/nbproject/project.xml
task1/solution06/src/org/apidesign/apifest08/currency/Amount.java
task1/solution06/src/org/apidesign/apifest08/currency/Assert.java
task1/solution06/src/org/apidesign/apifest08/currency/Bid.java
task1/solution06/src/org/apidesign/apifest08/currency/ConversionException.java
task1/solution06/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution06/src/org/apidesign/apifest08/currency/ConvertorFactory.java
task1/solution06/src/org/apidesign/apifest08/currency/Currencies.java
task1/solution06/src/org/apidesign/apifest08/currency/CurrencyException.java
task1/solution06/src/org/apidesign/apifest08/currency/UnsupportedConversionException.java
task1/solution06/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution07/build.xml
task1/solution07/nbproject/build-impl.xml
task1/solution07/nbproject/genfiles.properties
task1/solution07/nbproject/project.properties
task1/solution07/nbproject/project.xml
task1/solution07/src/org/apidesign/apifest08/currency/ConversionRate.java
task1/solution07/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution07/src/org/apidesign/apifest08/currency/DelegatingConvertor.java
task1/solution07/src/org/apidesign/apifest08/currency/IllegalRequestSubtypeException.java
task1/solution07/src/org/apidesign/apifest08/currency/MonetaryAmount.java
task1/solution07/src/org/apidesign/apifest08/currency/TableConvertor.java
task1/solution07/test/org/apidesign/apifest08/test/ContractImposingDelegatingConvertor.java
task1/solution07/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution08/build.xml
task1/solution08/nbproject/build-impl.xml
task1/solution08/nbproject/genfiles.properties
task1/solution08/nbproject/project.properties
task1/solution08/nbproject/project.xml
task1/solution08/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution08/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution09/build.xml
task1/solution09/nbproject/build-impl.xml
task1/solution09/nbproject/genfiles.properties
task1/solution09/nbproject/project.properties
task1/solution09/nbproject/project.xml
task1/solution09/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution09/src/org/apidesign/apifest08/currency/ConvertorFactory.java
task1/solution09/src/org/apidesign/apifest08/currency/CurrencyType.java
task1/solution09/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution10/build.xml
task1/solution10/nbproject/.DS_Store
task1/solution10/nbproject/build-impl.xml
task1/solution10/nbproject/genfiles.properties
task1/solution10/nbproject/project.properties
task1/solution10/nbproject/project.xml
task1/solution10/src/org/apidesign/apifest08/currency/ConstantRateConverter.java
task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConversionException.java
task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConverter.java
task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConverterProvider.java
task1/solution10/src/org/apidesign/apifest08/currency/CurrencyNotAvailableException.java
task1/solution10/src/org/apidesign/apifest08/currency/MultiCurrencyConstantRateConverter.java
task1/solution10/src/org/apidesign/apifest08/currency/OfflineConverterProvider.java
task1/solution10/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution11/build.xml
task1/solution11/nbproject/build-impl.xml
task1/solution11/nbproject/genfiles.properties
task1/solution11/nbproject/project.properties
task1/solution11/nbproject/project.xml
task1/solution11/src/org/apidesign/apifest08/currency/Computer.java
task1/solution11/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution11/src/org/apidesign/apifest08/currency/CurrencyValue.java
task1/solution11/test/org/apidesign/apifest08/test/Task1Test.java
task1/solution12/build.xml
task1/solution12/nbproject/build-impl.xml
task1/solution12/nbproject/genfiles.properties
task1/solution12/nbproject/project.properties
task1/solution12/nbproject/project.xml
task1/solution12/src/org/apidesign/apifest08/currency/Convertor.java
task1/solution12/src/org/apidesign/apifest08/currency/ConvertorException.java
task1/solution12/src/org/apidesign/apifest08/currency/ExchangeRate.java
task1/solution12/test/org/apidesign/apifest08/test/Task1Test.java
     1.1 --- a/task1/README	Fri Sep 26 06:21:08 2008 +0200
     1.2 +++ b/task1/README	Sun Sep 28 14:12:38 2008 +0200
     1.3 @@ -1,16 +1,9 @@
     1.4  This directory shall contain solutions for the task1.
     1.5  Each solution is NetBeans Java SE project, in its own
     1.6 -directory with name being a codename. The codename
     1.7 +directory solution<id>. The id is a number of the solution.
     1.8 +A README file in a solution<id> dir can contain
     1.9 +detailed information on the solution and
    1.10  shall somehow reflect the internals and be based on
    1.11  some significant aspect used in the solution. For
    1.12  example: welltested, delegating, verbose, etc.
    1.13  
    1.14 -At the end the structure shall be:
    1.15 -task1/xyz/build.xml
    1.16 -task1/xyz/nbproject/
    1.17 -task1/xyz/...
    1.18 -
    1.19 -task1/abc/build.xml
    1.20 -task1/abc/nbproject/
    1.21 -task1/abc/...
    1.22 -
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/task1/solution01/build.xml	Sun Sep 28 14:12:38 2008 +0200
     2.3 @@ -0,0 +1,69 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<!-- You may freely edit this file. See commented blocks below for -->
     2.6 +<!-- some examples of how to customize the build. -->
     2.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
     2.8 +<project name="currency" default="default" basedir=".">
     2.9 +    <description>Builds, tests, and runs the project.</description>
    2.10 +    <import file="nbproject/build-impl.xml"/>
    2.11 +    <!--
    2.12 +
    2.13 +    There exist several targets which are by default empty and which can be 
    2.14 +    used for execution of your tasks. These targets are usually executed 
    2.15 +    before and after some main targets. They are: 
    2.16 +
    2.17 +      -pre-init:                 called before initialization of project properties
    2.18 +      -post-init:                called after initialization of project properties
    2.19 +      -pre-compile:              called before javac compilation
    2.20 +      -post-compile:             called after javac compilation
    2.21 +      -pre-compile-single:       called before javac compilation of single file
    2.22 +      -post-compile-single:      called after javac compilation of single file
    2.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
    2.24 +      -post-compile-test:        called after javac compilation of JUnit tests
    2.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
    2.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
    2.27 +      -pre-jar:                  called before JAR building
    2.28 +      -post-jar:                 called after JAR building
    2.29 +      -post-clean:               called after cleaning build products
    2.30 +
    2.31 +    (Targets beginning with '-' are not intended to be called on their own.)
    2.32 +
    2.33 +    Example of inserting an obfuscator after compilation could look like this:
    2.34 +
    2.35 +        <target name="-post-compile">
    2.36 +            <obfuscate>
    2.37 +                <fileset dir="${build.classes.dir}"/>
    2.38 +            </obfuscate>
    2.39 +        </target>
    2.40 +
    2.41 +    For list of available properties check the imported 
    2.42 +    nbproject/build-impl.xml file. 
    2.43 +
    2.44 +
    2.45 +    Another way to customize the build is by overriding existing main targets.
    2.46 +    The targets of interest are: 
    2.47 +
    2.48 +      -init-macrodef-javac:     defines macro for javac compilation
    2.49 +      -init-macrodef-junit:     defines macro for junit execution
    2.50 +      -init-macrodef-debug:     defines macro for class debugging
    2.51 +      -init-macrodef-java:      defines macro for class execution
    2.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    2.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    2.54 +      run:                      execution of project 
    2.55 +      -javadoc-build:           Javadoc generation
    2.56 +      test-report:              JUnit report generation
    2.57 +
    2.58 +    An example of overriding the target for project execution could look like this:
    2.59 +
    2.60 +        <target name="run" depends="currency-impl.jar">
    2.61 +            <exec dir="bin" executable="launcher.exe">
    2.62 +                <arg file="${dist.jar}"/>
    2.63 +            </exec>
    2.64 +        </target>
    2.65 +
    2.66 +    Notice that the overridden target depends on the jar target and not only on 
    2.67 +    the compile target as the regular run target does. Again, for a list of available 
    2.68 +    properties which you can use, check the target you are overriding in the
    2.69 +    nbproject/build-impl.xml file. 
    2.70 +
    2.71 +    -->
    2.72 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/task1/solution01/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
     3.3 @@ -0,0 +1,642 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<!--
     3.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     3.7 +***         EDIT ../build.xml INSTEAD         ***
     3.8 +
     3.9 +For the purpose of easier reading the script
    3.10 +is divided into following sections:
    3.11 +
    3.12 +  - initialization
    3.13 +  - compilation
    3.14 +  - jar
    3.15 +  - execution
    3.16 +  - debugging
    3.17 +  - javadoc
    3.18 +  - junit compilation
    3.19 +  - junit execution
    3.20 +  - junit debugging
    3.21 +  - applet
    3.22 +  - cleanup
    3.23 +
    3.24 +        -->
    3.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_01-impl">
    3.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    3.27 +    <!-- 
    3.28 +                ======================
    3.29 +                INITIALIZATION SECTION 
    3.30 +                ======================
    3.31 +            -->
    3.32 +    <target name="-pre-init">
    3.33 +        <!-- Empty placeholder for easier customization. -->
    3.34 +        <!-- You can override this target in the ../build.xml file. -->
    3.35 +    </target>
    3.36 +    <target depends="-pre-init" name="-init-private">
    3.37 +        <property file="nbproject/private/config.properties"/>
    3.38 +        <property file="nbproject/private/configs/${config}.properties"/>
    3.39 +        <property file="nbproject/private/private.properties"/>
    3.40 +    </target>
    3.41 +    <target depends="-pre-init,-init-private" name="-init-user">
    3.42 +        <property file="${user.properties.file}"/>
    3.43 +        <!-- The two properties below are usually overridden -->
    3.44 +        <!-- by the active platform. Just a fallback. -->
    3.45 +        <property name="default.javac.source" value="1.4"/>
    3.46 +        <property name="default.javac.target" value="1.4"/>
    3.47 +    </target>
    3.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    3.49 +        <property file="nbproject/configs/${config}.properties"/>
    3.50 +        <property file="nbproject/project.properties"/>
    3.51 +    </target>
    3.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    3.53 +        <available file="${manifest.file}" property="manifest.available"/>
    3.54 +        <condition property="manifest.available+main.class">
    3.55 +            <and>
    3.56 +                <isset property="manifest.available"/>
    3.57 +                <isset property="main.class"/>
    3.58 +                <not>
    3.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    3.60 +                </not>
    3.61 +            </and>
    3.62 +        </condition>
    3.63 +        <condition property="manifest.available+main.class+mkdist.available">
    3.64 +            <and>
    3.65 +                <istrue value="${manifest.available+main.class}"/>
    3.66 +                <isset property="libs.CopyLibs.classpath"/>
    3.67 +            </and>
    3.68 +        </condition>
    3.69 +        <condition property="have.tests">
    3.70 +            <or>
    3.71 +                <available file="${test.src.dir}"/>
    3.72 +            </or>
    3.73 +        </condition>
    3.74 +        <condition property="have.sources">
    3.75 +            <or>
    3.76 +                <available file="${src.dir}"/>
    3.77 +            </or>
    3.78 +        </condition>
    3.79 +        <condition property="netbeans.home+have.tests">
    3.80 +            <and>
    3.81 +                <isset property="netbeans.home"/>
    3.82 +                <isset property="have.tests"/>
    3.83 +            </and>
    3.84 +        </condition>
    3.85 +        <condition property="no.javadoc.preview">
    3.86 +            <and>
    3.87 +                <isset property="javadoc.preview"/>
    3.88 +                <isfalse value="${javadoc.preview}"/>
    3.89 +            </and>
    3.90 +        </condition>
    3.91 +        <property name="run.jvmargs" value=""/>
    3.92 +        <property name="javac.compilerargs" value=""/>
    3.93 +        <property name="work.dir" value="${basedir}"/>
    3.94 +        <condition property="no.deps">
    3.95 +            <and>
    3.96 +                <istrue value="${no.dependencies}"/>
    3.97 +            </and>
    3.98 +        </condition>
    3.99 +        <property name="javac.debug" value="true"/>
   3.100 +        <property name="javadoc.preview" value="true"/>
   3.101 +        <property name="application.args" value=""/>
   3.102 +        <property name="source.encoding" value="${file.encoding}"/>
   3.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   3.104 +            <and>
   3.105 +                <isset property="javadoc.encoding"/>
   3.106 +                <not>
   3.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   3.108 +                </not>
   3.109 +            </and>
   3.110 +        </condition>
   3.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   3.112 +        <property name="includes" value="**"/>
   3.113 +        <property name="excludes" value=""/>
   3.114 +        <property name="do.depend" value="false"/>
   3.115 +        <condition property="do.depend.true">
   3.116 +            <istrue value="${do.depend}"/>
   3.117 +        </condition>
   3.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   3.119 +            <and>
   3.120 +                <isset property="jaxws.endorsed.dir"/>
   3.121 +                <available file="nbproject/jaxws-build.xml"/>
   3.122 +            </and>
   3.123 +        </condition>
   3.124 +    </target>
   3.125 +    <target name="-post-init">
   3.126 +        <!-- Empty placeholder for easier customization. -->
   3.127 +        <!-- You can override this target in the ../build.xml file. -->
   3.128 +    </target>
   3.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   3.130 +        <fail unless="src.dir">Must set src.dir</fail>
   3.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   3.132 +        <fail unless="build.dir">Must set build.dir</fail>
   3.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
   3.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   3.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   3.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   3.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   3.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   3.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
   3.140 +    </target>
   3.141 +    <target name="-init-macrodef-property">
   3.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.143 +            <attribute name="name"/>
   3.144 +            <attribute name="value"/>
   3.145 +            <sequential>
   3.146 +                <property name="@{name}" value="${@{value}}"/>
   3.147 +            </sequential>
   3.148 +        </macrodef>
   3.149 +    </target>
   3.150 +    <target name="-init-macrodef-javac">
   3.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.152 +            <attribute default="${src.dir}" name="srcdir"/>
   3.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.154 +            <attribute default="${javac.classpath}" name="classpath"/>
   3.155 +            <attribute default="${includes}" name="includes"/>
   3.156 +            <attribute default="${excludes}" name="excludes"/>
   3.157 +            <attribute default="${javac.debug}" name="debug"/>
   3.158 +            <attribute default="" name="sourcepath"/>
   3.159 +            <element name="customize" optional="true"/>
   3.160 +            <sequential>
   3.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
   3.162 +                    <classpath>
   3.163 +                        <path path="@{classpath}"/>
   3.164 +                    </classpath>
   3.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   3.166 +                    <customize/>
   3.167 +                </javac>
   3.168 +            </sequential>
   3.169 +        </macrodef>
   3.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.171 +            <attribute default="${src.dir}" name="srcdir"/>
   3.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.173 +            <attribute default="${javac.classpath}" name="classpath"/>
   3.174 +            <sequential>
   3.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   3.176 +                    <classpath>
   3.177 +                        <path path="@{classpath}"/>
   3.178 +                    </classpath>
   3.179 +                </depend>
   3.180 +            </sequential>
   3.181 +        </macrodef>
   3.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
   3.184 +            <sequential>
   3.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
   3.186 +                <pathconvert pathsep="," property="javac.includes.binary">
   3.187 +                    <path>
   3.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   3.189 +                    </path>
   3.190 +                    <globmapper from="*.java" to="*.class"/>
   3.191 +                </pathconvert>
   3.192 +                <delete>
   3.193 +                    <files includes="${javac.includes.binary}"/>
   3.194 +                </delete>
   3.195 +            </sequential>
   3.196 +        </macrodef>
   3.197 +    </target>
   3.198 +    <target name="-init-macrodef-junit">
   3.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.200 +            <attribute default="${includes}" name="includes"/>
   3.201 +            <attribute default="${excludes}" name="excludes"/>
   3.202 +            <attribute default="**" name="testincludes"/>
   3.203 +            <sequential>
   3.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   3.205 +                    <batchtest todir="${build.test.results.dir}">
   3.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   3.207 +                            <filename name="@{testincludes}"/>
   3.208 +                        </fileset>
   3.209 +                    </batchtest>
   3.210 +                    <classpath>
   3.211 +                        <path path="${run.test.classpath}"/>
   3.212 +                    </classpath>
   3.213 +                    <syspropertyset>
   3.214 +                        <propertyref prefix="test-sys-prop."/>
   3.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   3.216 +                    </syspropertyset>
   3.217 +                    <formatter type="brief" usefile="false"/>
   3.218 +                    <formatter type="xml"/>
   3.219 +                    <jvmarg line="${run.jvmargs}"/>
   3.220 +                </junit>
   3.221 +            </sequential>
   3.222 +        </macrodef>
   3.223 +    </target>
   3.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
   3.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.226 +            <attribute default="${main.class}" name="name"/>
   3.227 +            <attribute default="${debug.classpath}" name="classpath"/>
   3.228 +            <attribute default="" name="stopclassname"/>
   3.229 +            <sequential>
   3.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
   3.231 +                    <classpath>
   3.232 +                        <path path="@{classpath}"/>
   3.233 +                    </classpath>
   3.234 +                </nbjpdastart>
   3.235 +            </sequential>
   3.236 +        </macrodef>
   3.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.238 +            <attribute default="${build.classes.dir}" name="dir"/>
   3.239 +            <sequential>
   3.240 +                <nbjpdareload>
   3.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
   3.242 +                        <include name="${fix.includes}*.class"/>
   3.243 +                    </fileset>
   3.244 +                </nbjpdareload>
   3.245 +            </sequential>
   3.246 +        </macrodef>
   3.247 +    </target>
   3.248 +    <target name="-init-debug-args">
   3.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   3.250 +        <condition property="have-jdk-older-than-1.4">
   3.251 +            <or>
   3.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   3.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   3.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   3.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   3.256 +            </or>
   3.257 +        </condition>
   3.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   3.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
   3.260 +        </condition>
   3.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
   3.262 +            <os family="windows"/>
   3.263 +        </condition>
   3.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
   3.265 +            <isset property="debug.transport"/>
   3.266 +        </condition>
   3.267 +    </target>
   3.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   3.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   3.270 +            <attribute default="${main.class}" name="classname"/>
   3.271 +            <attribute default="${debug.classpath}" name="classpath"/>
   3.272 +            <element name="customize" optional="true"/>
   3.273 +            <sequential>
   3.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   3.275 +                    <jvmarg line="${debug-args-line}"/>
   3.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
   3.277 +                    <jvmarg line="${run.jvmargs}"/>
   3.278 +                    <classpath>
   3.279 +                        <path path="@{classpath}"/>
   3.280 +                    </classpath>
   3.281 +                    <syspropertyset>
   3.282 +                        <propertyref prefix="run-sys-prop."/>
   3.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   3.284 +                    </syspropertyset>
   3.285 +                    <customize/>
   3.286 +                </java>
   3.287 +            </sequential>
   3.288 +        </macrodef>
   3.289 +    </target>
   3.290 +    <target name="-init-macrodef-java">
   3.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.292 +            <attribute default="${main.class}" name="classname"/>
   3.293 +            <element name="customize" optional="true"/>
   3.294 +            <sequential>
   3.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   3.296 +                    <jvmarg line="${run.jvmargs}"/>
   3.297 +                    <classpath>
   3.298 +                        <path path="${run.classpath}"/>
   3.299 +                    </classpath>
   3.300 +                    <syspropertyset>
   3.301 +                        <propertyref prefix="run-sys-prop."/>
   3.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   3.303 +                    </syspropertyset>
   3.304 +                    <customize/>
   3.305 +                </java>
   3.306 +            </sequential>
   3.307 +        </macrodef>
   3.308 +    </target>
   3.309 +    <target name="-init-presetdef-jar">
   3.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   3.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   3.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
   3.313 +            </jar>
   3.314 +        </presetdef>
   3.315 +    </target>
   3.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
   3.317 +    <!--
   3.318 +                ===================
   3.319 +                COMPILATION SECTION
   3.320 +                ===================
   3.321 +            -->
   3.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
   3.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
   3.324 +    <target depends="init" name="-check-automatic-build">
   3.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
   3.326 +    </target>
   3.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
   3.328 +        <antcall target="clean"/>
   3.329 +    </target>
   3.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   3.331 +        <mkdir dir="${build.classes.dir}"/>
   3.332 +    </target>
   3.333 +    <target name="-pre-compile">
   3.334 +        <!-- Empty placeholder for easier customization. -->
   3.335 +        <!-- You can override this target in the ../build.xml file. -->
   3.336 +    </target>
   3.337 +    <target if="do.depend.true" name="-compile-depend">
   3.338 +        <j2seproject3:depend/>
   3.339 +    </target>
   3.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   3.341 +        <j2seproject3:javac/>
   3.342 +        <copy todir="${build.classes.dir}">
   3.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.344 +        </copy>
   3.345 +    </target>
   3.346 +    <target name="-post-compile">
   3.347 +        <!-- Empty placeholder for easier customization. -->
   3.348 +        <!-- You can override this target in the ../build.xml file. -->
   3.349 +    </target>
   3.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   3.351 +    <target name="-pre-compile-single">
   3.352 +        <!-- Empty placeholder for easier customization. -->
   3.353 +        <!-- You can override this target in the ../build.xml file. -->
   3.354 +    </target>
   3.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   3.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   3.357 +        <j2seproject3:force-recompile/>
   3.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   3.359 +    </target>
   3.360 +    <target name="-post-compile-single">
   3.361 +        <!-- Empty placeholder for easier customization. -->
   3.362 +        <!-- You can override this target in the ../build.xml file. -->
   3.363 +    </target>
   3.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   3.365 +    <!--
   3.366 +                ====================
   3.367 +                JAR BUILDING SECTION
   3.368 +                ====================
   3.369 +            -->
   3.370 +    <target depends="init" name="-pre-pre-jar">
   3.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   3.372 +        <mkdir dir="${dist.jar.dir}"/>
   3.373 +    </target>
   3.374 +    <target name="-pre-jar">
   3.375 +        <!-- Empty placeholder for easier customization. -->
   3.376 +        <!-- You can override this target in the ../build.xml file. -->
   3.377 +    </target>
   3.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   3.379 +        <j2seproject1:jar/>
   3.380 +    </target>
   3.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   3.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
   3.383 +    </target>
   3.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
   3.385 +        <j2seproject1:jar manifest="${manifest.file}">
   3.386 +            <j2seproject1:manifest>
   3.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   3.388 +            </j2seproject1:manifest>
   3.389 +        </j2seproject1:jar>
   3.390 +        <echo>To run this application from the command line without Ant, try:</echo>
   3.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   3.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   3.393 +        <pathconvert property="run.classpath.with.dist.jar">
   3.394 +            <path path="${run.classpath}"/>
   3.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   3.396 +        </pathconvert>
   3.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   3.398 +    </target>
   3.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   3.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   3.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
   3.402 +            <path path="${run.classpath}"/>
   3.403 +            <map from="${build.classes.dir.resolved}" to=""/>
   3.404 +        </pathconvert>
   3.405 +        <pathconvert pathsep=" " property="jar.classpath">
   3.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
   3.407 +            <chainedmapper>
   3.408 +                <flattenmapper/>
   3.409 +                <globmapper from="*" to="lib/*"/>
   3.410 +            </chainedmapper>
   3.411 +        </pathconvert>
   3.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   3.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   3.414 +            <fileset dir="${build.classes.dir}"/>
   3.415 +            <manifest>
   3.416 +                <attribute name="Main-Class" value="${main.class}"/>
   3.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
   3.418 +            </manifest>
   3.419 +        </copylibs>
   3.420 +        <echo>To run this application from the command line without Ant, try:</echo>
   3.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   3.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   3.423 +    </target>
   3.424 +    <target name="-post-jar">
   3.425 +        <!-- Empty placeholder for easier customization. -->
   3.426 +        <!-- You can override this target in the ../build.xml file. -->
   3.427 +    </target>
   3.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
   3.429 +    <!--
   3.430 +                =================
   3.431 +                EXECUTION SECTION
   3.432 +                =================
   3.433 +            -->
   3.434 +    <target depends="init,compile" description="Run a main class." name="run">
   3.435 +        <j2seproject1:java>
   3.436 +            <customize>
   3.437 +                <arg line="${application.args}"/>
   3.438 +            </customize>
   3.439 +        </j2seproject1:java>
   3.440 +    </target>
   3.441 +    <target name="-do-not-recompile">
   3.442 +        <property name="javac.includes.binary" value=""/>
   3.443 +    </target>
   3.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   3.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   3.446 +        <j2seproject1:java classname="${run.class}"/>
   3.447 +    </target>
   3.448 +    <!--
   3.449 +                =================
   3.450 +                DEBUGGING SECTION
   3.451 +                =================
   3.452 +            -->
   3.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   3.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
   3.455 +    </target>
   3.456 +    <target depends="init,compile" name="-debug-start-debuggee">
   3.457 +        <j2seproject3:debug>
   3.458 +            <customize>
   3.459 +                <arg line="${application.args}"/>
   3.460 +            </customize>
   3.461 +        </j2seproject3:debug>
   3.462 +    </target>
   3.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   3.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   3.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   3.466 +    </target>
   3.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   3.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   3.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   3.470 +        <j2seproject3:debug classname="${debug.class}"/>
   3.471 +    </target>
   3.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   3.473 +    <target depends="init" name="-pre-debug-fix">
   3.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
   3.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
   3.476 +    </target>
   3.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   3.478 +        <j2seproject1:nbjpdareload/>
   3.479 +    </target>
   3.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   3.481 +    <!--
   3.482 +                ===============
   3.483 +                JAVADOC SECTION
   3.484 +                ===============
   3.485 +            -->
   3.486 +    <target depends="init" name="-javadoc-build">
   3.487 +        <mkdir dir="${dist.javadoc.dir}"/>
   3.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
   3.489 +            <classpath>
   3.490 +                <path path="${javac.classpath}"/>
   3.491 +            </classpath>
   3.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   3.493 +                <filename name="**/*.java"/>
   3.494 +            </fileset>
   3.495 +        </javadoc>
   3.496 +    </target>
   3.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   3.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   3.499 +    </target>
   3.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   3.501 +    <!--
   3.502 +                =========================
   3.503 +                JUNIT COMPILATION SECTION
   3.504 +                =========================
   3.505 +            -->
   3.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   3.507 +        <mkdir dir="${build.test.classes.dir}"/>
   3.508 +    </target>
   3.509 +    <target name="-pre-compile-test">
   3.510 +        <!-- Empty placeholder for easier customization. -->
   3.511 +        <!-- You can override this target in the ../build.xml file. -->
   3.512 +    </target>
   3.513 +    <target if="do.depend.true" name="-compile-test-depend">
   3.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   3.515 +    </target>
   3.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   3.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   3.518 +        <copy todir="${build.test.classes.dir}">
   3.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.520 +        </copy>
   3.521 +    </target>
   3.522 +    <target name="-post-compile-test">
   3.523 +        <!-- Empty placeholder for easier customization. -->
   3.524 +        <!-- You can override this target in the ../build.xml file. -->
   3.525 +    </target>
   3.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   3.527 +    <target name="-pre-compile-test-single">
   3.528 +        <!-- Empty placeholder for easier customization. -->
   3.529 +        <!-- You can override this target in the ../build.xml file. -->
   3.530 +    </target>
   3.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   3.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   3.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   3.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
   3.535 +        <copy todir="${build.test.classes.dir}">
   3.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   3.537 +        </copy>
   3.538 +    </target>
   3.539 +    <target name="-post-compile-test-single">
   3.540 +        <!-- Empty placeholder for easier customization. -->
   3.541 +        <!-- You can override this target in the ../build.xml file. -->
   3.542 +    </target>
   3.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   3.544 +    <!--
   3.545 +                =======================
   3.546 +                JUNIT EXECUTION SECTION
   3.547 +                =======================
   3.548 +            -->
   3.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
   3.550 +        <mkdir dir="${build.test.results.dir}"/>
   3.551 +    </target>
   3.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   3.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
   3.554 +    </target>
   3.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   3.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   3.557 +    </target>
   3.558 +    <target depends="init" if="have.tests" name="test-report"/>
   3.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   3.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   3.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   3.562 +        <mkdir dir="${build.test.results.dir}"/>
   3.563 +    </target>
   3.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   3.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   3.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   3.567 +    </target>
   3.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   3.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   3.570 +    </target>
   3.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
   3.572 +    <!--
   3.573 +                =======================
   3.574 +                JUNIT DEBUGGING SECTION
   3.575 +                =======================
   3.576 +            -->
   3.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   3.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   3.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   3.580 +        <delete file="${test.report.file}"/>
   3.581 +        <mkdir dir="${build.test.results.dir}"/>
   3.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
   3.583 +            <customize>
   3.584 +                <syspropertyset>
   3.585 +                    <propertyref prefix="test-sys-prop."/>
   3.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   3.587 +                </syspropertyset>
   3.588 +                <arg value="${test.class}"/>
   3.589 +                <arg value="showoutput=true"/>
   3.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   3.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   3.592 +            </customize>
   3.593 +        </j2seproject3:debug>
   3.594 +    </target>
   3.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   3.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   3.597 +    </target>
   3.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   3.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   3.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   3.601 +    </target>
   3.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   3.603 +    <!--
   3.604 +                =========================
   3.605 +                APPLET EXECUTION SECTION
   3.606 +                =========================
   3.607 +            -->
   3.608 +    <target depends="init,compile-single" name="run-applet">
   3.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   3.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
   3.611 +            <customize>
   3.612 +                <arg value="${applet.url}"/>
   3.613 +            </customize>
   3.614 +        </j2seproject1:java>
   3.615 +    </target>
   3.616 +    <!--
   3.617 +                =========================
   3.618 +                APPLET DEBUGGING  SECTION
   3.619 +                =========================
   3.620 +            -->
   3.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   3.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   3.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
   3.624 +            <customize>
   3.625 +                <arg value="${applet.url}"/>
   3.626 +            </customize>
   3.627 +        </j2seproject3:debug>
   3.628 +    </target>
   3.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   3.630 +    <!--
   3.631 +                ===============
   3.632 +                CLEANUP SECTION
   3.633 +                ===============
   3.634 +            -->
   3.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
   3.636 +    <target depends="init" name="-do-clean">
   3.637 +        <delete dir="${build.dir}"/>
   3.638 +        <delete dir="${dist.dir}"/>
   3.639 +    </target>
   3.640 +    <target name="-post-clean">
   3.641 +        <!-- Empty placeholder for easier customization. -->
   3.642 +        <!-- You can override this target in the ../build.xml file. -->
   3.643 +    </target>
   3.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   3.645 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/task1/solution01/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
     4.3 @@ -0,0 +1,8 @@
     4.4 +build.xml.data.CRC32=2ab820eb
     4.5 +build.xml.script.CRC32=58a52595
     4.6 +build.xml.stylesheet.CRC32=be360661
     4.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     4.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     4.9 +nbproject/build-impl.xml.data.CRC32=3cae0313
    4.10 +nbproject/build-impl.xml.script.CRC32=3c8caa17
    4.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/task1/solution01/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
     5.3 @@ -0,0 +1,68 @@
     5.4 +application.title=currency
     5.5 +application.vendor=apidesign.org
     5.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
     5.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
     5.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
     5.9 +build.classes.dir=${build.dir}/classes
    5.10 +build.classes.excludes=**/*.java,**/*.form
    5.11 +# This directory is removed when the project is cleaned:
    5.12 +build.dir=build
    5.13 +build.generated.dir=${build.dir}/generated
    5.14 +# Only compile against the classpath explicitly listed here:
    5.15 +build.sysclasspath=ignore
    5.16 +build.test.classes.dir=${build.dir}/test/classes
    5.17 +build.test.results.dir=${build.dir}/test/results
    5.18 +debug.classpath=\
    5.19 +    ${run.classpath}
    5.20 +debug.test.classpath=\
    5.21 +    ${run.test.classpath}
    5.22 +# This directory is removed when the project is cleaned:
    5.23 +dist.dir=dist
    5.24 +dist.jar=${dist.dir}/currency.jar
    5.25 +dist.javadoc.dir=${dist.dir}/javadoc
    5.26 +excludes=
    5.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
    5.28 +file.reference.src-apifest08=..
    5.29 +includes=**
    5.30 +jar.compress=false
    5.31 +javac.classpath=
    5.32 +# Space-separated list of extra javac options
    5.33 +javac.compilerargs=
    5.34 +javac.deprecation=false
    5.35 +javac.source=1.5
    5.36 +javac.target=1.5
    5.37 +javac.test.classpath=\
    5.38 +    ${javac.classpath}:\
    5.39 +    ${build.classes.dir}:\
    5.40 +    ${file.reference.junit-4.4.jar}
    5.41 +javadoc.additionalparam=
    5.42 +javadoc.author=false
    5.43 +javadoc.encoding=
    5.44 +javadoc.noindex=false
    5.45 +javadoc.nonavbar=false
    5.46 +javadoc.notree=false
    5.47 +javadoc.private=false
    5.48 +javadoc.splitindex=true
    5.49 +javadoc.use=true
    5.50 +javadoc.version=false
    5.51 +javadoc.windowtitle=
    5.52 +jnlp.codebase.type=local
    5.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
    5.54 +jnlp.descriptor=application
    5.55 +jnlp.enabled=false
    5.56 +jnlp.offline-allowed=false
    5.57 +jnlp.signed=false
    5.58 +meta.inf.dir=${src.dir}/META-INF
    5.59 +platform.active=default_platform
    5.60 +run.classpath=\
    5.61 +    ${javac.classpath}:\
    5.62 +    ${build.classes.dir}
    5.63 +# Space-separated list of JVM arguments used when running the project
    5.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    5.65 +# or test-sys-prop.name=value to set system properties for unit tests):
    5.66 +run.jvmargs=
    5.67 +run.test.classpath=\
    5.68 +    ${javac.test.classpath}:\
    5.69 +    ${build.test.classes.dir}
    5.70 +src.dir=src
    5.71 +test.src.dir=test
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/task1/solution01/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
     6.3 @@ -0,0 +1,16 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     6.6 +    <type>org.netbeans.modules.java.j2seproject</type>
     6.7 +    <configuration>
     6.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     6.9 +            <name>Currency Convertor Solution 01</name>
    6.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
    6.11 +            <source-roots>
    6.12 +                <root id="src.dir"/>
    6.13 +            </source-roots>
    6.14 +            <test-roots>
    6.15 +                <root id="test.src.dir"/>
    6.16 +            </test-roots>
    6.17 +        </data>
    6.18 +    </configuration>
    6.19 +</project>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/AbstractConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
     7.3 @@ -0,0 +1,12 @@
     7.4 +package org.apidesign.apifest08.currency;
     7.5 +
     7.6 +/**
     7.7 + * Abstract class for future possible purposes
     7.8 + * @author Ladislav Vitasek
     7.9 + */
    7.10 +abstract class AbstractConvertorFactory implements CurrencyConvertorFactory{
    7.11 +
    7.12 +    AbstractConvertorFactory() {
    7.13 +    }
    7.14 +
    7.15 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/AbstractCurrencyConvertor.java	Sun Sep 28 14:12:38 2008 +0200
     8.3 @@ -0,0 +1,64 @@
     8.4 +package org.apidesign.apifest08.currency;
     8.5 +
     8.6 +import java.util.Currency;
     8.7 +
     8.8 +/**
     8.9 + * Abstract convertor implementation.
    8.10 + * This class provide necessary stuff for creating any CurrencyConvertor
    8.11 + * Convert value can be get by different way. Conversion should be made in its subclass.
    8.12 + * @author Ladislav Vitasek
    8.13 + */
    8.14 +abstract class AbstractCurrencyConvertor implements Convertor {
    8.15 +    protected final ConversionRatioProvider conversionRatioProvider;
    8.16 +    protected final Currency currency1;
    8.17 +    protected final Currency currency2;
    8.18 +
    8.19 +    public AbstractCurrencyConvertor(Currency currency1, Currency currency2, ConversionRatioProvider conversionRatioProvider) {
    8.20 +        this.currency1 = currency1;
    8.21 +        this.currency2 = currency2;
    8.22 +        this.conversionRatioProvider = conversionRatioProvider;
    8.23 +    }
    8.24 +
    8.25 +    
    8.26 +    public Currency getCurrency1() {
    8.27 +        return currency1;
    8.28 +    }
    8.29 +
    8.30 +
    8.31 +    public Currency getCurrency2() {
    8.32 +        return currency2;
    8.33 +    }
    8.34 +
    8.35 +//    /**
    8.36 +//     * Conversion value can be get by Different way. Let's decide subclass where to get actual value
    8.37 +//     * @return current value of conversion constant
    8.38 +//     */
    8.39 +//    protected abstract BigDecimal getConversionValue();
    8.40 +
    8.41 +    @SuppressWarnings({"RedundantIfStatement"})
    8.42 +    public boolean equals(Object o) {
    8.43 +        if (this == o) return true;
    8.44 +        if (o == null || getClass() != o.getClass()) return false;
    8.45 +
    8.46 +        AbstractCurrencyConvertor that = (AbstractCurrencyConvertor) o;
    8.47 +
    8.48 +        if (!conversionRatioProvider.equals(that.conversionRatioProvider)) return false;
    8.49 +        if (!currency1.equals(that.currency1)) return false;
    8.50 +        if (!currency2.equals(that.currency2)) return false;
    8.51 +
    8.52 +        return true;
    8.53 +    }
    8.54 +
    8.55 +    public int hashCode() {
    8.56 +        int result;
    8.57 +        result = conversionRatioProvider.hashCode();
    8.58 +        result = 31 * result + currency1.hashCode();
    8.59 +        result = 31 * result + currency2.hashCode();
    8.60 +        return result;
    8.61 +    }
    8.62 +
    8.63 +    ConversionRatioProvider getConversionRatioProvider() {
    8.64 +        return conversionRatioProvider;
    8.65 +    }    
    8.66 +
    8.67 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CannotConvertException.java	Sun Sep 28 14:12:38 2008 +0200
     9.3 @@ -0,0 +1,26 @@
     9.4 +package org.apidesign.apifest08.currency;
     9.5 +
     9.6 +/**
     9.7 + * If something was wrong during converting currencies...
     9.8 + * Eg. when the convertor is outdated
     9.9 + * Should be a descendant of RuntimeException? Hmmms...
    9.10 + * @author Ladislav Vitasek
    9.11 + */
    9.12 +public class CannotConvertException extends RuntimeException {
    9.13 +    
    9.14 +    public CannotConvertException() {
    9.15 +
    9.16 +    }
    9.17 +
    9.18 +    public CannotConvertException(String message) {
    9.19 +        super(message);
    9.20 +    }
    9.21 +
    9.22 +    public CannotConvertException(Throwable e) {
    9.23 +        super(e);
    9.24 +    }
    9.25 +
    9.26 +    public CannotConvertException(String message, Throwable cause) {
    9.27 +        super(message, cause);
    9.28 +    }
    9.29 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CannotInstantiateFactoryException.java	Sun Sep 28 14:12:38 2008 +0200
    10.3 @@ -0,0 +1,23 @@
    10.4 +package org.apidesign.apifest08.currency;
    10.5 +
    10.6 +/**
    10.7 + * Failed to instantiate class for factory
    10.8 + * @author Ladislav Vitasek
    10.9 + */
   10.10 +public class CannotInstantiateFactoryException extends Exception {
   10.11 +    public CannotInstantiateFactoryException(Throwable e) {
   10.12 +        super(e);
   10.13 +    }
   10.14 +
   10.15 +    public CannotInstantiateFactoryException(String message) {
   10.16 +        super(message);
   10.17 +    }
   10.18 +
   10.19 +    public CannotInstantiateFactoryException() {
   10.20 +        super();
   10.21 +    }
   10.22 +
   10.23 +    public CannotInstantiateFactoryException(String message, Throwable cause) {
   10.24 +        super(message, cause);
   10.25 +    }
   10.26 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CannotProvideValueException.java	Sun Sep 28 14:12:38 2008 +0200
    11.3 @@ -0,0 +1,24 @@
    11.4 +package org.apidesign.apifest08.currency;
    11.5 +
    11.6 +/**
    11.7 + * Used when value cannot be get from the source
    11.8 + * @author Ladislav Vitasek
    11.9 + */
   11.10 +public class CannotProvideValueException extends RuntimeException {
   11.11 +
   11.12 +    public CannotProvideValueException() {
   11.13 +        super();
   11.14 +    }
   11.15 +
   11.16 +    public CannotProvideValueException(String message) {
   11.17 +        super(message);
   11.18 +    }
   11.19 +
   11.20 +    public CannotProvideValueException(String message, Throwable cause) {
   11.21 +        super(message, cause);
   11.22 +    }
   11.23 +
   11.24 +    public CannotProvideValueException(Throwable cause) {
   11.25 +        super(cause);
   11.26 +    }
   11.27 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/ConversionProperties.java	Sun Sep 28 14:12:38 2008 +0200
    12.3 @@ -0,0 +1,101 @@
    12.4 +package org.apidesign.apifest08.currency;
    12.5 +
    12.6 +import java.math.BigDecimal;
    12.7 +import java.math.RoundingMode;
    12.8 +
    12.9 +/**
   12.10 + * This class encapsulates settings for currency conversion
   12.11 + * We can use it eg. for uptime options etc. in future versions
   12.12 + *
   12.13 + * @author Ladislav Vitasek
   12.14 + */
   12.15 +final public class ConversionProperties {
   12.16 +
   12.17 +    private final ConversionRatioProvider conversionRatioProvider;
   12.18 +    private final RoundingMode roundingMode;
   12.19 +
   12.20 +    /**
   12.21 +     * Returns conversion constants - conversion operation is invertable
   12.22 +     * Default
   12.23 +     */
   12.24 +    private final static class FixedBidirectionalRatioConversion implements ConversionRatioProvider {
   12.25 +        private final BigDecimal currency1ToCurrency2Constant;
   12.26 +        private final BigDecimal currency2ToCurrency1Constant;
   12.27 +        private static final int SCALE_MAX_DEFAULT = 20;
   12.28 +
   12.29 +        /**
   12.30 +         * Constructor
   12.31 +         * @param ratioConstant fixed ratio constant
   12.32 +         * @param mode math rounding mode
   12.33 +         * @throws IllegalArgumentException if conversion value is <= 0
   12.34 +         */
   12.35 +        private FixedBidirectionalRatioConversion(BigDecimal ratioConstant, RoundingMode mode) {
   12.36 +            if (ratioConstant.compareTo(BigDecimal.ZERO) <= 0)
   12.37 +                throw new IllegalArgumentException("Conversion value cannot be <= 0");
   12.38 +            this.currency1ToCurrency2Constant = ratioConstant;
   12.39 +            this.currency2ToCurrency1Constant = BigDecimal.ONE.setScale(SCALE_MAX_DEFAULT).divide(ratioConstant, mode);
   12.40 +        }
   12.41 +
   12.42 +        public BigDecimal getCurrency1ToCurrency2Constant() {
   12.43 +            return currency1ToCurrency2Constant;
   12.44 +        }
   12.45 +
   12.46 +        public BigDecimal getCurrency2ToCurrency1Constant() {
   12.47 +            return currency2ToCurrency1Constant;
   12.48 +        }
   12.49 +    }
   12.50 +
   12.51 +
   12.52 +    /**
   12.53 +     * Returns new instance Conversion properties - fixed conversion ratio - both directions
   12.54 +     * Default max scale is set to 20
   12.55 +     *
   12.56 +     * @param conversionConstant value of constant for conversion
   12.57 +     * @param roundingMode       math rounding mode
   12.58 +     * @return new instance of ConversionProperties class
   12.59 +     * @throws IllegalArgumentException if conversion constant is <= 0 
   12.60 +     * @see org.apidesign.apifest08.currency.ConversionProperties.FixedBidirectionalRatioConversion
   12.61 +     */
   12.62 +    public static ConversionProperties create(BigDecimal conversionConstant, RoundingMode roundingMode) {
   12.63 +        return create(new FixedBidirectionalRatioConversion(conversionConstant, roundingMode), roundingMode);
   12.64 +    }
   12.65 +
   12.66 +    /**
   12.67 +     * Returns new instance Conversion properties
   12.68 +     *
   12.69 +     * @param conversionRatioProvider provider for conversion constants
   12.70 +     * @param roundingMode       math rounding mode
   12.71 +     * @return new instance of ConversionProperties class
   12.72 +     */
   12.73 +    public static ConversionProperties create(ConversionRatioProvider conversionRatioProvider, RoundingMode roundingMode) {
   12.74 +        if (conversionRatioProvider == null || roundingMode == null)
   12.75 +            throw new NullPointerException();
   12.76 +        return new ConversionProperties(conversionRatioProvider, roundingMode);
   12.77 +    }
   12.78 +
   12.79 +    /**
   12.80 +     * Returns new instance Conversion properties with values set to conversionConstant=BigDecimal.ONE
   12.81 +     * and roundingMode=RoundingMode.HALF_EVEN
   12.82 +     * 
   12.83 +     * Conversion is bidirectional.
   12.84 +     *
   12.85 +     * @return
   12.86 +     */
   12.87 +    public static ConversionProperties createDefault() {
   12.88 +        return create(BigDecimal.ONE, RoundingMode.HALF_EVEN);
   12.89 +    }
   12.90 +
   12.91 +    private ConversionProperties(ConversionRatioProvider conversionRatioProvider, RoundingMode roundingMode) {
   12.92 +        this.conversionRatioProvider = conversionRatioProvider;
   12.93 +        this.roundingMode = roundingMode;
   12.94 +    }
   12.95 +
   12.96 +
   12.97 +    public RoundingMode getRoundingMode() {
   12.98 +        return roundingMode;
   12.99 +    }
  12.100 +
  12.101 +    public ConversionRatioProvider getConversionRatioProvider() {
  12.102 +        return conversionRatioProvider;
  12.103 +    }
  12.104 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/ConversionRatioProvider.java	Sun Sep 28 14:12:38 2008 +0200
    13.3 @@ -0,0 +1,12 @@
    13.4 +package org.apidesign.apifest08.currency;
    13.5 +
    13.6 +import java.math.BigDecimal;
    13.7 +
    13.8 +/**
    13.9 + * Provider for conversion constant from any source
   13.10 + * @author Ladislav Vitasek
   13.11 + */
   13.12 +public interface ConversionRatioProvider {
   13.13 +    public BigDecimal getCurrency1ToCurrency2Constant() throws CannotProvideValueException;
   13.14 +    public BigDecimal getCurrency2ToCurrency1Constant() throws CannotProvideValueException;
   13.15 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    14.3 @@ -0,0 +1,51 @@
    14.4 +package org.apidesign.apifest08.currency;
    14.5 +
    14.6 +import java.math.BigDecimal;
    14.7 +import java.util.Currency;
    14.8 +
    14.9 +/** This is the skeleton class for your API. You need to make it public, so
   14.10 + * it is accessible to your client code (currently in Task1Test.java) file.
   14.11 + * <p>
   14.12 + * Feel free to create additional classes or rename this one, just keep all
   14.13 + * the API and its implementation in this package. Do not spread it outside
   14.14 + * to other packages.
   14.15 + */
   14.16 +public interface Convertor {
   14.17 +    /**
   14.18 +     * Methods converts some pounds
   14.19 +     * API design question - what kind of parameters?
   14.20 +     * I decided to use BigDecimal based on experience on Java conf ;-)
   14.21 +     * @param amountOfMoney
   14.22 +     * @return converted amount of money
   14.23 +     * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
   14.24 +     */
   14.25 +
   14.26 +    BigDecimal convertCurrency1ToCurrency2(BigDecimal amountOfMoney) throws CannotConvertException;
   14.27 +
   14.28 +    /**
   14.29 +     * Methods converts some pounds
   14.30 +     * API design question - what kind of parameters?
   14.31 +     * @param amountOfMoney
   14.32 +     * @return converted amount of money
   14.33 +     * @throws org.apidesign.apifest08.currency.CannotConvertException - if convertor is outdated or any other problem
   14.34 +     */
   14.35 +
   14.36 +    BigDecimal convertCurrency2ToCurrency1(BigDecimal amountOfMoney) throws CannotConvertException;
   14.37 +
   14.38 +    //handy getters
   14.39 +
   14.40 +    /**
   14.41 +     * Getter - Returns Currency 1 of this convertor
   14.42 +     * @return money code
   14.43 +     */
   14.44 +    Currency getCurrency1();
   14.45 +
   14.46 +    /**
   14.47 +     * Getter - Returns Currency 2 of this convertor
   14.48 +     * @return money code
   14.49 +     */
   14.50 +    Currency getCurrency2();
   14.51 +
   14.52 +    // For Future purposes...? - it was not as a requirement in TestCase
   14.53 +    //BigDecimal getConversionValue();
   14.54 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/ConvertorNotAvailableException.java	Sun Sep 28 14:12:38 2008 +0200
    15.3 @@ -0,0 +1,23 @@
    15.4 +package org.apidesign.apifest08.currency;
    15.5 +
    15.6 +/**
    15.7 + * No convertor is available for current conversion settings
    15.8 + * @author Ladislav Vitasek
    15.9 + */
   15.10 +public class ConvertorNotAvailableException extends Exception {
   15.11 +    public ConvertorNotAvailableException() {
   15.12 +
   15.13 +    }
   15.14 +
   15.15 +    public ConvertorNotAvailableException(String message) {
   15.16 +        super(message);
   15.17 +    }
   15.18 +
   15.19 +    public ConvertorNotAvailableException(String message, Throwable cause) {
   15.20 +        super(message, cause);
   15.21 +    }
   15.22 +
   15.23 +    public ConvertorNotAvailableException(Throwable cause) {
   15.24 +        super(cause);
   15.25 +    }
   15.26 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/ConvertorsFactory.java	Sun Sep 28 14:12:38 2008 +0200
    16.3 @@ -0,0 +1,43 @@
    16.4 +package org.apidesign.apifest08.currency;
    16.5 +
    16.6 +/**
    16.7 + * Some Factory for Factories :-)
    16.8 + * Depends on the whole application design...
    16.9 + * @author Ladislav Vitasek
   16.10 + */
   16.11 +final public class ConvertorsFactory {
   16.12 +    private CurrencyConvertorFactory currencyConvertorFactoryInstance = null;
   16.13 +    private final static ConvertorsFactory instance = new ConvertorsFactory();
   16.14 +
   16.15 +
   16.16 +    private ConvertorsFactory() {
   16.17 +
   16.18 +    }
   16.19 +
   16.20 +    public static CurrencyConvertorFactory getCurrencyConvertorFactoryInstance() throws CannotInstantiateFactoryException {
   16.21 +        return getInstance().getCurrencyConvertor();
   16.22 +    }
   16.23 +
   16.24 +    /**
   16.25 +     * Returns instance of CurrencyConvertorFactory 
   16.26 +     * @return new instance of CurrencyConvertorFactory
   16.27 +     * @throws CannotInstantiateFactoryException
   16.28 +     */
   16.29 +    private synchronized CurrencyConvertorFactory getCurrencyConvertor() throws CannotInstantiateFactoryException {
   16.30 +        if (currencyConvertorFactoryInstance == null) {//intern implementation
   16.31 +//            String className = System.getProperty("currencyFactory", CurrencyConvertorFactoryImpl.class.getName());
   16.32 +//            try {
   16.33 +//                currencyConvertorFactoryInstance = (CurrencyConvertorFactory) Class.forName(className).newInstance();
   16.34 +//            } catch (Exception e) {
   16.35 +//                throw new CannotInstantiateFactoryException(e);
   16.36 +//            }
   16.37 +            //without reflection
   16.38 +            currencyConvertorFactoryInstance = new CurrencyConvertorFactoryImpl();
   16.39 +        }
   16.40 +        return currencyConvertorFactoryInstance;
   16.41 +    }
   16.42 +
   16.43 +    public static ConvertorsFactory getInstance() {
   16.44 +        return instance;
   16.45 +    }
   16.46 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    17.3 @@ -0,0 +1,22 @@
    17.4 +package org.apidesign.apifest08.currency;
    17.5 +
    17.6 +import java.util.Currency;
    17.7 +
    17.8 +/**
    17.9 + * @author Ladislav Vitasek
   17.10 + */
   17.11 +public interface CurrencyConvertorFactory {
   17.12 +
   17.13 +    /**
   17.14 +     * Instantiate a new instance convertor      
   17.15 +     * @param currency1 a code currency you want to convert between
   17.16 +     * @param currency2 a code currency you want to convert between
   17.17 +     * @param conversionProperties settings for conversion
   17.18 +     * @return converter for currency converting
   17.19 +     * @throws ConvertorNotAvailableException throws if there is no available convertor for selected currencies
   17.20 +     */
   17.21 +    Convertor createConvertor(Currency currency1, Currency currency2, ConversionProperties conversionProperties) throws ConvertorNotAvailableException;
   17.22 +
   17.23 +
   17.24 +
   17.25 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorFactoryImpl.java	Sun Sep 28 14:12:38 2008 +0200
    18.3 @@ -0,0 +1,29 @@
    18.4 +package org.apidesign.apifest08.currency;
    18.5 +
    18.6 +import java.util.Currency;
    18.7 +
    18.8 +/**
    18.9 + * Convertor Factory implementation
   18.10 + * In the real-time world this code should be optimized - convertors caching etc.
   18.11 + * @author Ladislav Vitasek
   18.12 + */
   18.13 +class CurrencyConvertorFactoryImpl extends AbstractConvertorFactory  {
   18.14 +    
   18.15 +
   18.16 +    CurrencyConvertorFactoryImpl() {
   18.17 +        super();
   18.18 +    }
   18.19 +
   18.20 +    // Note - implementation of this method is dummy
   18.21 +    
   18.22 +    public Convertor createConvertor(Currency currency1, Currency currency2, ConversionProperties conversionProperties) throws ConvertorNotAvailableException {
   18.23 +        if (currency1 == null || currency2 == null || conversionProperties == null)
   18.24 +            throw new NullPointerException();
   18.25 +
   18.26 +        try {
   18.27 +            return new CurrencyConvertorImpl(currency1, currency2, conversionProperties.getConversionRatioProvider(), conversionProperties.getRoundingMode());//can be cached somehow
   18.28 +        } catch (Exception e) {
   18.29 +            throw new ConvertorNotAvailableException(e);
   18.30 +        }
   18.31 +    }
   18.32 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/task1/solution01/src/org/apidesign/apifest08/currency/CurrencyConvertorImpl.java	Sun Sep 28 14:12:38 2008 +0200
    19.3 @@ -0,0 +1,108 @@
    19.4 +package org.apidesign.apifest08.currency;
    19.5 +
    19.6 +import java.math.BigDecimal;
    19.7 +import java.math.RoundingMode;
    19.8 +import java.util.Currency;
    19.9 +
   19.10 +/**
   19.11 + * Intern implementation of Bidirectional Convertor - this class is only for internal purposes only.
   19.12 + * This implementation uses BigDecimals to count result value
   19.13 + * Scale is set by ISO 4217 as default
   19.14 + *
   19.15 + * @author Ladislav Vitasek
   19.16 + */
   19.17 +class CurrencyConvertorImpl extends AbstractCurrencyConvertor {
   19.18 +
   19.19 +    protected RoundingMode roundingMode;
   19.20 +    protected int currency1Scale;
   19.21 +    protected int currency2Scale;
   19.22 +
   19.23 +    /**
   19.24 +     * Constructor
   19.25 +     * By default it creates convertor with conversion value 1
   19.26 +     *
   19.27 +     * @param currency1       currency for conversion
   19.28 +     * @param currency2       currency for conversion
   19.29 +     * @param provider constants provider
   19.30 +     * @param roundingMode    math rounding mode
   19.31 +     */
   19.32 +    CurrencyConvertorImpl(Currency currency1, Currency currency2, ConversionRatioProvider provider, RoundingMode roundingMode) {
   19.33 +        this(currency1, currency2, provider, roundingMode, currency1.getDefaultFractionDigits(), currency2.getDefaultFractionDigits());
   19.34 +    }
   19.35 +
   19.36 +    /**
   19.37 +     * Constructor
   19.38 +     *
   19.39 +     * @param currency1       currency for conversion
   19.40 +     * @param currency2       currency for conversion
   19.41 +     * @param conversionRatioProvider conversion constants provider
   19.42 +     * @param roundingMode    math rounding mode
   19.43 +     * @param conversionRatioProvider constants provider
   19.44 +     * @param currency2Scale
   19.45 +     */
   19.46 +    CurrencyConvertorImpl(Currency currency1, Currency currency2, ConversionRatioProvider conversionRatioProvider, RoundingMode roundingMode, int currency1Scale, int currency2Scale) {
   19.47 +        super(currency1, currency2, conversionRatioProvider);
   19.48 +        this.roundingMode = roundingMode;
   19.49 +        this.currency1Scale = currency1Scale;
   19.50 +        this.currency2Scale = currency2Scale;
   19.51 +    }
   19.52 +
   19.53 +
   19.54 +    public BigDecimal convertCurrency1ToCurrency2(BigDecimal amountOfMoney) throws CannotConvertException {
   19.55 +        try {
   19.56 +            final BigDecimal result = amountOfMoney.multiply(getConversionRatioProvider().getCurrency1ToCurrency2Constant());
   19.57 +            return result.setScale(getCurrency2Scale(), getRoundingMode());
   19.58 +        } catch (CannotProvideValueException e) {
   19.59 +            throw new CannotConvertException(e);            
   19.60 +        } catch (ArithmeticException e) {
   19.61 +            throw new CannotConvertException(e);
   19.62 +        }
   19.63 +    }
   19.64 +
   19.65 +
   19.66 +    public BigDecimal convertCurrency2ToCurrency1(BigDecimal amountOfMoney) throws CannotConvertException {
   19.67 +        try {
   19.68 +            final BigDecimal result = amountOfMoney.multiply(getConversionRatioProvider().getCurrency2ToCurrency1Constant());
   19.69 +            return result.setScale(getCurrency1Scale(), getRoundingMode());
   19.70 +        } catch (CannotProvideValueException e) {
   19.71 +            throw new CannotConvertException(e);
   19.72 +        } catch (ArithmeticException e) {
   19.73 +            throw new CannotConvertException(e);
   19.74 +        }
   19.75 +    }
   19.76 +  
   19.77 +    public String toString() {
   19.78 +        return "CurrencyConvertorImpl{" +
   19.79 +                "currency1=" + getCurrency1() +
   19.80 +                ",currency2=" + getCurrency2() +
   19.81 +                ", roundingMode=" + roundingMode +
   19.82 +                ", currency1Scale=" + currency1Scale +
   19.83 +                ", currency2Scale=" + currency2Scale +
   19.84 +                '}';
   19.85 +    }
   19.86 +
   19.87 +    RoundingMode getRoundingMode() {
   19.88 +        return roundingMode;
   19.89 +    }    
   19.90 +
   19.91 +    int getCurrency1Scale() {
   19.92 +        return currency1Scale;
   19.93 +    }
   19.94 +
   19.95 +    int getCurrency2Scale() {
   19.96 +        return currency2Scale;
   19.97 +    }
   19.98 +
   19.99 +    void setRoundingMode(RoundingMode roundingMode) {
  19.100 +        this.roundingMode = roundingMode;
  19.101 +    }
  19.102 +
  19.103 +    void setCurrency1Scale(int currency1Scale) {
  19.104 +        this.currency1Scale = currency1Scale;
  19.105 +    }
  19.106 +
  19.107 +    void setCurrency2Scale(int currency2Scale) {
  19.108 +        this.currency2Scale = currency2Scale;
  19.109 +    }
  19.110 +
  19.111 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/task1/solution01/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    20.3 @@ -0,0 +1,104 @@
    20.4 +package org.apidesign.apifest08.test;
    20.5 +
    20.6 +import junit.framework.TestCase;
    20.7 +import org.apidesign.apifest08.currency.*;
    20.8 +
    20.9 +import java.math.BigDecimal;
   20.10 +import java.math.RoundingMode;
   20.11 +import java.util.Currency;
   20.12 +
   20.13 +/**
   20.14 + * Finish the Convertor API, and then write bodies of methods inside
   20.15 + * of this class to match the given tasks. To fullfil your task, use the
   20.16 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   20.17 + * Do not you reflection, or other hacks as your code
   20.18 + * shall run without any runtime permissions.
   20.19 + */
   20.20 +public class Task1Test extends TestCase {
   20.21 +    private static CurrencyConvertorFactory currencyConvertorFactoryInstance;
   20.22 +
   20.23 +    public Task1Test(String testName) {
   20.24 +        super(testName);
   20.25 +    }
   20.26 +
   20.27 +    @Override
   20.28 +    protected void setUp() throws Exception {
   20.29 +        currencyConvertorFactoryInstance = ConvertorsFactory.getCurrencyConvertorFactoryInstance();
   20.30 +    }
   20.31 +
   20.32 +    @Override
   20.33 +    protected void tearDown() throws Exception {
   20.34 +        currencyConvertorFactoryInstance = null;
   20.35 +    }
   20.36 +
   20.37 +    /**
   20.38 +     * Create convertor that understands two currencies, CZK and
   20.39 +     * USD. Make 1 USD == 17 CZK.
   20.40 +     * <p/>
   20.41 +     * Creation of the convertor shall not require subclassing of any class
   20.42 +     * or interface on the client side.
   20.43 +     *
   20.44 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   20.45 +     */
   20.46 +    public static Convertor createCZKtoUSD() throws ConvertorNotAvailableException {
   20.47 +        final Currency czk = Currency.getInstance("CZK");
   20.48 +        final Currency usd = Currency.getInstance("USD");
   20.49 +        final BigDecimal constant = BigDecimal.ONE.divide(BigDecimal.valueOf(17), 10, RoundingMode.HALF_EVEN);
   20.50 +        return currencyConvertorFactoryInstance.createConvertor(czk, usd, ConversionProperties.create(constant, RoundingMode.HALF_EVEN));
   20.51 +    }
   20.52 +
   20.53 +    /**
   20.54 +     * Create convertor that understands two currencies, CZK and
   20.55 +     * SKK. Make 100 SKK == 80 CZK.
   20.56 +     * <p/>
   20.57 +     * Creation of the convertor shall not require subclassing of any class
   20.58 +     * or interface on the client side.
   20.59 +     *
   20.60 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   20.61 +     */
   20.62 +    public static Convertor createSKKtoCZK() throws ConvertorNotAvailableException {
   20.63 +        final Currency skk = Currency.getInstance("SKK");
   20.64 +        final Currency czk = Currency.getInstance("CZK");
   20.65 +        final BigDecimal constant = new BigDecimal("0.8");
   20.66 +        return currencyConvertorFactoryInstance.createConvertor(skk, czk, ConversionProperties.create(constant, RoundingMode.HALF_EVEN));
   20.67 +    }
   20.68 +
   20.69 +    /**
   20.70 +     * Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   20.71 +     * with it.
   20.72 +     */
   20.73 +    public void testCurrencyCZKUSD() throws Exception {
   20.74 +        Convertor c = createCZKtoUSD();
   20.75 +        // convert $5 to CZK using c:
   20.76 +
   20.77 +        final int czkDigitsScale = c.getCurrency1().getDefaultFractionDigits();
   20.78 +        final int usdDigitsScale = c.getCurrency2().getDefaultFractionDigits();
   20.79 +
   20.80 +        assertEquals("Result is 85 CZK", BigDecimal.valueOf(85).setScale(czkDigitsScale), c.convertCurrency2ToCurrency1(BigDecimal.valueOf(5)));
   20.81 +
   20.82 +        // convert $8 to CZK
   20.83 +        assertEquals("Result is 136 CZK", BigDecimal.valueOf(136).setScale(czkDigitsScale), c.convertCurrency2ToCurrency1(BigDecimal.valueOf(8)));
   20.84 +
   20.85 +        // convert 1003CZK to USD
   20.86 +        assertEquals("Result is 59 USD", BigDecimal.valueOf(59).setScale(usdDigitsScale), c.convertCurrency1ToCurrency2(BigDecimal.valueOf(1003)));
   20.87 +    }
   20.88 +
   20.89 +    /**
   20.90 +     * Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   20.91 +     * with it.
   20.92 +     */
   20.93 +    public void testCurrencySKKCZK() throws Exception {
   20.94 +        Convertor c = createSKKtoCZK();
   20.95 +        // convert 16CZK using c:
   20.96 +
   20.97 +        final int skkDigitsScale = c.getCurrency1().getDefaultFractionDigits();
   20.98 +        final int czkDigitsScale = c.getCurrency2().getDefaultFractionDigits();
   20.99 +        
  20.100 +        assertEquals("Result is 20 SKK", BigDecimal.valueOf(20).setScale(skkDigitsScale), c.convertCurrency2ToCurrency1(BigDecimal.valueOf(16)));
  20.101 +
  20.102 +        // convert 500SKK to CZK
  20.103 +        assertEquals("Result is 400 CZK", BigDecimal.valueOf(400).setScale(czkDigitsScale), c.convertCurrency1ToCurrency2(BigDecimal.valueOf(500)));
  20.104 +    }
  20.105 +
  20.106 +}
  20.107 +
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/task1/solution02/build.xml	Sun Sep 28 14:12:38 2008 +0200
    21.3 @@ -0,0 +1,69 @@
    21.4 +<?xml version="1.0" encoding="UTF-8"?>
    21.5 +<!-- You may freely edit this file. See commented blocks below for -->
    21.6 +<!-- some examples of how to customize the build. -->
    21.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    21.8 +<project name="currency" default="default" basedir=".">
    21.9 +    <description>Builds, tests, and runs the project.</description>
   21.10 +    <import file="nbproject/build-impl.xml"/>
   21.11 +    <!--
   21.12 +
   21.13 +    There exist several targets which are by default empty and which can be 
   21.14 +    used for execution of your tasks. These targets are usually executed 
   21.15 +    before and after some main targets. They are: 
   21.16 +
   21.17 +      -pre-init:                 called before initialization of project properties
   21.18 +      -post-init:                called after initialization of project properties
   21.19 +      -pre-compile:              called before javac compilation
   21.20 +      -post-compile:             called after javac compilation
   21.21 +      -pre-compile-single:       called before javac compilation of single file
   21.22 +      -post-compile-single:      called after javac compilation of single file
   21.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   21.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   21.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   21.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   21.27 +      -pre-jar:                  called before JAR building
   21.28 +      -post-jar:                 called after JAR building
   21.29 +      -post-clean:               called after cleaning build products
   21.30 +
   21.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   21.32 +
   21.33 +    Example of inserting an obfuscator after compilation could look like this:
   21.34 +
   21.35 +        <target name="-post-compile">
   21.36 +            <obfuscate>
   21.37 +                <fileset dir="${build.classes.dir}"/>
   21.38 +            </obfuscate>
   21.39 +        </target>
   21.40 +
   21.41 +    For list of available properties check the imported 
   21.42 +    nbproject/build-impl.xml file. 
   21.43 +
   21.44 +
   21.45 +    Another way to customize the build is by overriding existing main targets.
   21.46 +    The targets of interest are: 
   21.47 +
   21.48 +      -init-macrodef-javac:     defines macro for javac compilation
   21.49 +      -init-macrodef-junit:     defines macro for junit execution
   21.50 +      -init-macrodef-debug:     defines macro for class debugging
   21.51 +      -init-macrodef-java:      defines macro for class execution
   21.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   21.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   21.54 +      run:                      execution of project 
   21.55 +      -javadoc-build:           Javadoc generation
   21.56 +      test-report:              JUnit report generation
   21.57 +
   21.58 +    An example of overriding the target for project execution could look like this:
   21.59 +
   21.60 +        <target name="run" depends="currency-impl.jar">
   21.61 +            <exec dir="bin" executable="launcher.exe">
   21.62 +                <arg file="${dist.jar}"/>
   21.63 +            </exec>
   21.64 +        </target>
   21.65 +
   21.66 +    Notice that the overridden target depends on the jar target and not only on 
   21.67 +    the compile target as the regular run target does. Again, for a list of available 
   21.68 +    properties which you can use, check the target you are overriding in the
   21.69 +    nbproject/build-impl.xml file. 
   21.70 +
   21.71 +    -->
   21.72 +</project>
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/task1/solution02/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    22.3 @@ -0,0 +1,642 @@
    22.4 +<?xml version="1.0" encoding="UTF-8"?>
    22.5 +<!--
    22.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    22.7 +***         EDIT ../build.xml INSTEAD         ***
    22.8 +
    22.9 +For the purpose of easier reading the script
   22.10 +is divided into following sections:
   22.11 +
   22.12 +  - initialization
   22.13 +  - compilation
   22.14 +  - jar
   22.15 +  - execution
   22.16 +  - debugging
   22.17 +  - javadoc
   22.18 +  - junit compilation
   22.19 +  - junit execution
   22.20 +  - junit debugging
   22.21 +  - applet
   22.22 +  - cleanup
   22.23 +
   22.24 +        -->
   22.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_02-impl">
   22.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   22.27 +    <!-- 
   22.28 +                ======================
   22.29 +                INITIALIZATION SECTION 
   22.30 +                ======================
   22.31 +            -->
   22.32 +    <target name="-pre-init">
   22.33 +        <!-- Empty placeholder for easier customization. -->
   22.34 +        <!-- You can override this target in the ../build.xml file. -->
   22.35 +    </target>
   22.36 +    <target depends="-pre-init" name="-init-private">
   22.37 +        <property file="nbproject/private/config.properties"/>
   22.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   22.39 +        <property file="nbproject/private/private.properties"/>
   22.40 +    </target>
   22.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   22.42 +        <property file="${user.properties.file}"/>
   22.43 +        <!-- The two properties below are usually overridden -->
   22.44 +        <!-- by the active platform. Just a fallback. -->
   22.45 +        <property name="default.javac.source" value="1.4"/>
   22.46 +        <property name="default.javac.target" value="1.4"/>
   22.47 +    </target>
   22.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   22.49 +        <property file="nbproject/configs/${config}.properties"/>
   22.50 +        <property file="nbproject/project.properties"/>
   22.51 +    </target>
   22.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   22.53 +        <available file="${manifest.file}" property="manifest.available"/>
   22.54 +        <condition property="manifest.available+main.class">
   22.55 +            <and>
   22.56 +                <isset property="manifest.available"/>
   22.57 +                <isset property="main.class"/>
   22.58 +                <not>
   22.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   22.60 +                </not>
   22.61 +            </and>
   22.62 +        </condition>
   22.63 +        <condition property="manifest.available+main.class+mkdist.available">
   22.64 +            <and>
   22.65 +                <istrue value="${manifest.available+main.class}"/>
   22.66 +                <isset property="libs.CopyLibs.classpath"/>
   22.67 +            </and>
   22.68 +        </condition>
   22.69 +        <condition property="have.tests">
   22.70 +            <or>
   22.71 +                <available file="${test.src.dir}"/>
   22.72 +            </or>
   22.73 +        </condition>
   22.74 +        <condition property="have.sources">
   22.75 +            <or>
   22.76 +                <available file="${src.dir}"/>
   22.77 +            </or>
   22.78 +        </condition>
   22.79 +        <condition property="netbeans.home+have.tests">
   22.80 +            <and>
   22.81 +                <isset property="netbeans.home"/>
   22.82 +                <isset property="have.tests"/>
   22.83 +            </and>
   22.84 +        </condition>
   22.85 +        <condition property="no.javadoc.preview">
   22.86 +            <and>
   22.87 +                <isset property="javadoc.preview"/>
   22.88 +                <isfalse value="${javadoc.preview}"/>
   22.89 +            </and>
   22.90 +        </condition>
   22.91 +        <property name="run.jvmargs" value=""/>
   22.92 +        <property name="javac.compilerargs" value=""/>
   22.93 +        <property name="work.dir" value="${basedir}"/>
   22.94 +        <condition property="no.deps">
   22.95 +            <and>
   22.96 +                <istrue value="${no.dependencies}"/>
   22.97 +            </and>
   22.98 +        </condition>
   22.99 +        <property name="javac.debug" value="true"/>
  22.100 +        <property name="javadoc.preview" value="true"/>
  22.101 +        <property name="application.args" value=""/>
  22.102 +        <property name="source.encoding" value="${file.encoding}"/>
  22.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  22.104 +            <and>
  22.105 +                <isset property="javadoc.encoding"/>
  22.106 +                <not>
  22.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  22.108 +                </not>
  22.109 +            </and>
  22.110 +        </condition>
  22.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  22.112 +        <property name="includes" value="**"/>
  22.113 +        <property name="excludes" value=""/>
  22.114 +        <property name="do.depend" value="false"/>
  22.115 +        <condition property="do.depend.true">
  22.116 +            <istrue value="${do.depend}"/>
  22.117 +        </condition>
  22.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  22.119 +            <and>
  22.120 +                <isset property="jaxws.endorsed.dir"/>
  22.121 +                <available file="nbproject/jaxws-build.xml"/>
  22.122 +            </and>
  22.123 +        </condition>
  22.124 +    </target>
  22.125 +    <target name="-post-init">
  22.126 +        <!-- Empty placeholder for easier customization. -->
  22.127 +        <!-- You can override this target in the ../build.xml file. -->
  22.128 +    </target>
  22.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  22.130 +        <fail unless="src.dir">Must set src.dir</fail>
  22.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  22.132 +        <fail unless="build.dir">Must set build.dir</fail>
  22.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  22.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  22.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  22.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  22.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  22.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  22.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  22.140 +    </target>
  22.141 +    <target name="-init-macrodef-property">
  22.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  22.143 +            <attribute name="name"/>
  22.144 +            <attribute name="value"/>
  22.145 +            <sequential>
  22.146 +                <property name="@{name}" value="${@{value}}"/>
  22.147 +            </sequential>
  22.148 +        </macrodef>
  22.149 +    </target>
  22.150 +    <target name="-init-macrodef-javac">
  22.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  22.152 +            <attribute default="${src.dir}" name="srcdir"/>
  22.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  22.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  22.155 +            <attribute default="${includes}" name="includes"/>
  22.156 +            <attribute default="${excludes}" name="excludes"/>
  22.157 +            <attribute default="${javac.debug}" name="debug"/>
  22.158 +            <attribute default="" name="sourcepath"/>
  22.159 +            <element name="customize" optional="true"/>
  22.160 +            <sequential>
  22.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  22.162 +                    <classpath>
  22.163 +                        <path path="@{classpath}"/>
  22.164 +                    </classpath>
  22.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  22.166 +                    <customize/>
  22.167 +                </javac>
  22.168 +            </sequential>
  22.169 +        </macrodef>
  22.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  22.171 +            <attribute default="${src.dir}" name="srcdir"/>
  22.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  22.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  22.174 +            <sequential>
  22.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  22.176 +                    <classpath>
  22.177 +                        <path path="@{classpath}"/>
  22.178 +                    </classpath>
  22.179 +                </depend>
  22.180 +            </sequential>
  22.181 +        </macrodef>
  22.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  22.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  22.184 +            <sequential>
  22.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  22.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  22.187 +                    <path>
  22.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  22.189 +                    </path>
  22.190 +                    <globmapper from="*.java" to="*.class"/>
  22.191 +                </pathconvert>
  22.192 +                <delete>
  22.193 +                    <files includes="${javac.includes.binary}"/>
  22.194 +                </delete>
  22.195 +            </sequential>
  22.196 +        </macrodef>
  22.197 +    </target>
  22.198 +    <target name="-init-macrodef-junit">
  22.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  22.200 +            <attribute default="${includes}" name="includes"/>
  22.201 +            <attribute default="${excludes}" name="excludes"/>
  22.202 +            <attribute default="**" name="testincludes"/>
  22.203 +            <sequential>
  22.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  22.205 +                    <batchtest todir="${build.test.results.dir}">
  22.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  22.207 +                            <filename name="@{testincludes}"/>
  22.208 +                        </fileset>
  22.209 +                    </batchtest>
  22.210 +                    <classpath>
  22.211 +                        <path path="${run.test.classpath}"/>
  22.212 +                    </classpath>
  22.213 +                    <syspropertyset>
  22.214 +                        <propertyref prefix="test-sys-prop."/>
  22.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  22.216 +                    </syspropertyset>
  22.217 +                    <formatter type="brief" usefile="false"/>
  22.218 +                    <formatter type="xml"/>
  22.219 +                    <jvmarg line="${run.jvmargs}"/>
  22.220 +                </junit>
  22.221 +            </sequential>
  22.222 +        </macrodef>
  22.223 +    </target>
  22.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  22.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  22.226 +            <attribute default="${main.class}" name="name"/>
  22.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  22.228 +            <attribute default="" name="stopclassname"/>
  22.229 +            <sequential>
  22.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  22.231 +                    <classpath>
  22.232 +                        <path path="@{classpath}"/>
  22.233 +                    </classpath>
  22.234 +                </nbjpdastart>
  22.235 +            </sequential>
  22.236 +        </macrodef>
  22.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  22.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  22.239 +            <sequential>
  22.240 +                <nbjpdareload>
  22.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  22.242 +                        <include name="${fix.includes}*.class"/>
  22.243 +                    </fileset>
  22.244 +                </nbjpdareload>
  22.245 +            </sequential>
  22.246 +        </macrodef>
  22.247 +    </target>
  22.248 +    <target name="-init-debug-args">
  22.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  22.250 +        <condition property="have-jdk-older-than-1.4">
  22.251 +            <or>
  22.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  22.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  22.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  22.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  22.256 +            </or>
  22.257 +        </condition>
  22.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  22.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  22.260 +        </condition>
  22.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  22.262 +            <os family="windows"/>
  22.263 +        </condition>
  22.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  22.265 +            <isset property="debug.transport"/>
  22.266 +        </condition>
  22.267 +    </target>
  22.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  22.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  22.270 +            <attribute default="${main.class}" name="classname"/>
  22.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  22.272 +            <element name="customize" optional="true"/>
  22.273 +            <sequential>
  22.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  22.275 +                    <jvmarg line="${debug-args-line}"/>
  22.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  22.277 +                    <jvmarg line="${run.jvmargs}"/>
  22.278 +                    <classpath>
  22.279 +                        <path path="@{classpath}"/>
  22.280 +                    </classpath>
  22.281 +                    <syspropertyset>
  22.282 +                        <propertyref prefix="run-sys-prop."/>
  22.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  22.284 +                    </syspropertyset>
  22.285 +                    <customize/>
  22.286 +                </java>
  22.287 +            </sequential>
  22.288 +        </macrodef>
  22.289 +    </target>
  22.290 +    <target name="-init-macrodef-java">
  22.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  22.292 +            <attribute default="${main.class}" name="classname"/>
  22.293 +            <element name="customize" optional="true"/>
  22.294 +            <sequential>
  22.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  22.296 +                    <jvmarg line="${run.jvmargs}"/>
  22.297 +                    <classpath>
  22.298 +                        <path path="${run.classpath}"/>
  22.299 +                    </classpath>
  22.300 +                    <syspropertyset>
  22.301 +                        <propertyref prefix="run-sys-prop."/>
  22.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  22.303 +                    </syspropertyset>
  22.304 +                    <customize/>
  22.305 +                </java>
  22.306 +            </sequential>
  22.307 +        </macrodef>
  22.308 +    </target>
  22.309 +    <target name="-init-presetdef-jar">
  22.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  22.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  22.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  22.313 +            </jar>
  22.314 +        </presetdef>
  22.315 +    </target>
  22.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  22.317 +    <!--
  22.318 +                ===================
  22.319 +                COMPILATION SECTION
  22.320 +                ===================
  22.321 +            -->
  22.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  22.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  22.324 +    <target depends="init" name="-check-automatic-build">
  22.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  22.326 +    </target>
  22.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  22.328 +        <antcall target="clean"/>
  22.329 +    </target>
  22.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  22.331 +        <mkdir dir="${build.classes.dir}"/>
  22.332 +    </target>
  22.333 +    <target name="-pre-compile">
  22.334 +        <!-- Empty placeholder for easier customization. -->
  22.335 +        <!-- You can override this target in the ../build.xml file. -->
  22.336 +    </target>
  22.337 +    <target if="do.depend.true" name="-compile-depend">
  22.338 +        <j2seproject3:depend/>
  22.339 +    </target>
  22.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  22.341 +        <j2seproject3:javac/>
  22.342 +        <copy todir="${build.classes.dir}">
  22.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  22.344 +        </copy>
  22.345 +    </target>
  22.346 +    <target name="-post-compile">
  22.347 +        <!-- Empty placeholder for easier customization. -->
  22.348 +        <!-- You can override this target in the ../build.xml file. -->
  22.349 +    </target>
  22.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  22.351 +    <target name="-pre-compile-single">
  22.352 +        <!-- Empty placeholder for easier customization. -->
  22.353 +        <!-- You can override this target in the ../build.xml file. -->
  22.354 +    </target>
  22.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  22.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  22.357 +        <j2seproject3:force-recompile/>
  22.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  22.359 +    </target>
  22.360 +    <target name="-post-compile-single">
  22.361 +        <!-- Empty placeholder for easier customization. -->
  22.362 +        <!-- You can override this target in the ../build.xml file. -->
  22.363 +    </target>
  22.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  22.365 +    <!--
  22.366 +                ====================
  22.367 +                JAR BUILDING SECTION
  22.368 +                ====================
  22.369 +            -->
  22.370 +    <target depends="init" name="-pre-pre-jar">
  22.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  22.372 +        <mkdir dir="${dist.jar.dir}"/>
  22.373 +    </target>
  22.374 +    <target name="-pre-jar">
  22.375 +        <!-- Empty placeholder for easier customization. -->
  22.376 +        <!-- You can override this target in the ../build.xml file. -->
  22.377 +    </target>
  22.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  22.379 +        <j2seproject1:jar/>
  22.380 +    </target>
  22.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  22.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  22.383 +    </target>
  22.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  22.385 +        <j2seproject1:jar manifest="${manifest.file}">
  22.386 +            <j2seproject1:manifest>
  22.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  22.388 +            </j2seproject1:manifest>
  22.389 +        </j2seproject1:jar>
  22.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  22.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  22.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  22.393 +        <pathconvert property="run.classpath.with.dist.jar">
  22.394 +            <path path="${run.classpath}"/>
  22.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  22.396 +        </pathconvert>
  22.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  22.398 +    </target>
  22.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  22.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  22.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  22.402 +            <path path="${run.classpath}"/>
  22.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  22.404 +        </pathconvert>
  22.405 +        <pathconvert pathsep=" " property="jar.classpath">
  22.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  22.407 +            <chainedmapper>
  22.408 +                <flattenmapper/>
  22.409 +                <globmapper from="*" to="lib/*"/>
  22.410 +            </chainedmapper>
  22.411 +        </pathconvert>
  22.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  22.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  22.414 +            <fileset dir="${build.classes.dir}"/>
  22.415 +            <manifest>
  22.416 +                <attribute name="Main-Class" value="${main.class}"/>
  22.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  22.418 +            </manifest>
  22.419 +        </copylibs>
  22.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  22.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  22.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  22.423 +    </target>
  22.424 +    <target name="-post-jar">
  22.425 +        <!-- Empty placeholder for easier customization. -->
  22.426 +        <!-- You can override this target in the ../build.xml file. -->
  22.427 +    </target>
  22.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  22.429 +    <!--
  22.430 +                =================
  22.431 +                EXECUTION SECTION
  22.432 +                =================
  22.433 +            -->
  22.434 +    <target depends="init,compile" description="Run a main class." name="run">
  22.435 +        <j2seproject1:java>
  22.436 +            <customize>
  22.437 +                <arg line="${application.args}"/>
  22.438 +            </customize>
  22.439 +        </j2seproject1:java>
  22.440 +    </target>
  22.441 +    <target name="-do-not-recompile">
  22.442 +        <property name="javac.includes.binary" value=""/>
  22.443 +    </target>
  22.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  22.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  22.446 +        <j2seproject1:java classname="${run.class}"/>
  22.447 +    </target>
  22.448 +    <!--
  22.449 +                =================
  22.450 +                DEBUGGING SECTION
  22.451 +                =================
  22.452 +            -->
  22.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  22.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  22.455 +    </target>
  22.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  22.457 +        <j2seproject3:debug>
  22.458 +            <customize>
  22.459 +                <arg line="${application.args}"/>
  22.460 +            </customize>
  22.461 +        </j2seproject3:debug>
  22.462 +    </target>
  22.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  22.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  22.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  22.466 +    </target>
  22.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  22.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  22.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  22.470 +        <j2seproject3:debug classname="${debug.class}"/>
  22.471 +    </target>
  22.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  22.473 +    <target depends="init" name="-pre-debug-fix">
  22.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  22.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  22.476 +    </target>
  22.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  22.478 +        <j2seproject1:nbjpdareload/>
  22.479 +    </target>
  22.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  22.481 +    <!--
  22.482 +                ===============
  22.483 +                JAVADOC SECTION
  22.484 +                ===============
  22.485 +            -->
  22.486 +    <target depends="init" name="-javadoc-build">
  22.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  22.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  22.489 +            <classpath>
  22.490 +                <path path="${javac.classpath}"/>
  22.491 +            </classpath>
  22.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  22.493 +                <filename name="**/*.java"/>
  22.494 +            </fileset>
  22.495 +        </javadoc>
  22.496 +    </target>
  22.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  22.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  22.499 +    </target>
  22.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  22.501 +    <!--
  22.502 +                =========================
  22.503 +                JUNIT COMPILATION SECTION
  22.504 +                =========================
  22.505 +            -->
  22.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  22.507 +        <mkdir dir="${build.test.classes.dir}"/>
  22.508 +    </target>
  22.509 +    <target name="-pre-compile-test">
  22.510 +        <!-- Empty placeholder for easier customization. -->
  22.511 +        <!-- You can override this target in the ../build.xml file. -->
  22.512 +    </target>
  22.513 +    <target if="do.depend.true" name="-compile-test-depend">
  22.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  22.515 +    </target>
  22.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  22.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  22.518 +        <copy todir="${build.test.classes.dir}">
  22.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  22.520 +        </copy>
  22.521 +    </target>
  22.522 +    <target name="-post-compile-test">
  22.523 +        <!-- Empty placeholder for easier customization. -->
  22.524 +        <!-- You can override this target in the ../build.xml file. -->
  22.525 +    </target>
  22.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  22.527 +    <target name="-pre-compile-test-single">
  22.528 +        <!-- Empty placeholder for easier customization. -->
  22.529 +        <!-- You can override this target in the ../build.xml file. -->
  22.530 +    </target>
  22.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  22.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  22.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  22.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  22.535 +        <copy todir="${build.test.classes.dir}">
  22.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  22.537 +        </copy>
  22.538 +    </target>
  22.539 +    <target name="-post-compile-test-single">
  22.540 +        <!-- Empty placeholder for easier customization. -->
  22.541 +        <!-- You can override this target in the ../build.xml file. -->
  22.542 +    </target>
  22.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  22.544 +    <!--
  22.545 +                =======================
  22.546 +                JUNIT EXECUTION SECTION
  22.547 +                =======================
  22.548 +            -->
  22.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  22.550 +        <mkdir dir="${build.test.results.dir}"/>
  22.551 +    </target>
  22.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  22.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  22.554 +    </target>
  22.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  22.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  22.557 +    </target>
  22.558 +    <target depends="init" if="have.tests" name="test-report"/>
  22.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  22.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  22.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  22.562 +        <mkdir dir="${build.test.results.dir}"/>
  22.563 +    </target>
  22.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  22.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  22.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  22.567 +    </target>
  22.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  22.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  22.570 +    </target>
  22.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  22.572 +    <!--
  22.573 +                =======================
  22.574 +                JUNIT DEBUGGING SECTION
  22.575 +                =======================
  22.576 +            -->
  22.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  22.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  22.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  22.580 +        <delete file="${test.report.file}"/>
  22.581 +        <mkdir dir="${build.test.results.dir}"/>
  22.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  22.583 +            <customize>
  22.584 +                <syspropertyset>
  22.585 +                    <propertyref prefix="test-sys-prop."/>
  22.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  22.587 +                </syspropertyset>
  22.588 +                <arg value="${test.class}"/>
  22.589 +                <arg value="showoutput=true"/>
  22.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  22.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  22.592 +            </customize>
  22.593 +        </j2seproject3:debug>
  22.594 +    </target>
  22.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  22.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  22.597 +    </target>
  22.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  22.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  22.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  22.601 +    </target>
  22.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  22.603 +    <!--
  22.604 +                =========================
  22.605 +                APPLET EXECUTION SECTION
  22.606 +                =========================
  22.607 +            -->
  22.608 +    <target depends="init,compile-single" name="run-applet">
  22.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  22.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  22.611 +            <customize>
  22.612 +                <arg value="${applet.url}"/>
  22.613 +            </customize>
  22.614 +        </j2seproject1:java>
  22.615 +    </target>
  22.616 +    <!--
  22.617 +                =========================
  22.618 +                APPLET DEBUGGING  SECTION
  22.619 +                =========================
  22.620 +            -->
  22.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  22.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  22.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  22.624 +            <customize>
  22.625 +                <arg value="${applet.url}"/>
  22.626 +            </customize>
  22.627 +        </j2seproject3:debug>
  22.628 +    </target>
  22.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  22.630 +    <!--
  22.631 +                ===============
  22.632 +                CLEANUP SECTION
  22.633 +                ===============
  22.634 +            -->
  22.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  22.636 +    <target depends="init" name="-do-clean">
  22.637 +        <delete dir="${build.dir}"/>
  22.638 +        <delete dir="${dist.dir}"/>
  22.639 +    </target>
  22.640 +    <target name="-post-clean">
  22.641 +        <!-- Empty placeholder for easier customization. -->
  22.642 +        <!-- You can override this target in the ../build.xml file. -->
  22.643 +    </target>
  22.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  22.645 +</project>
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/task1/solution02/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    23.3 @@ -0,0 +1,8 @@
    23.4 +build.xml.data.CRC32=2ab820eb
    23.5 +build.xml.script.CRC32=58a52595
    23.6 +build.xml.stylesheet.CRC32=be360661
    23.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    23.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    23.9 +nbproject/build-impl.xml.data.CRC32=848e6267
   23.10 +nbproject/build-impl.xml.script.CRC32=6be86987
   23.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/task1/solution02/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    24.3 @@ -0,0 +1,68 @@
    24.4 +application.title=currency
    24.5 +application.vendor=apidesign.org
    24.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    24.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    24.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    24.9 +build.classes.dir=${build.dir}/classes
   24.10 +build.classes.excludes=**/*.java,**/*.form
   24.11 +# This directory is removed when the project is cleaned:
   24.12 +build.dir=build
   24.13 +build.generated.dir=${build.dir}/generated
   24.14 +# Only compile against the classpath explicitly listed here:
   24.15 +build.sysclasspath=ignore
   24.16 +build.test.classes.dir=${build.dir}/test/classes
   24.17 +build.test.results.dir=${build.dir}/test/results
   24.18 +debug.classpath=\
   24.19 +    ${run.classpath}
   24.20 +debug.test.classpath=\
   24.21 +    ${run.test.classpath}
   24.22 +# This directory is removed when the project is cleaned:
   24.23 +dist.dir=dist
   24.24 +dist.jar=${dist.dir}/currency.jar
   24.25 +dist.javadoc.dir=${dist.dir}/javadoc
   24.26 +excludes=
   24.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   24.28 +file.reference.src-apifest08=..
   24.29 +includes=**
   24.30 +jar.compress=false
   24.31 +javac.classpath=
   24.32 +# Space-separated list of extra javac options
   24.33 +javac.compilerargs=
   24.34 +javac.deprecation=false
   24.35 +javac.source=1.5
   24.36 +javac.target=1.5
   24.37 +javac.test.classpath=\
   24.38 +    ${javac.classpath}:\
   24.39 +    ${build.classes.dir}:\
   24.40 +    ${file.reference.junit-4.4.jar}
   24.41 +javadoc.additionalparam=
   24.42 +javadoc.author=false
   24.43 +javadoc.encoding=
   24.44 +javadoc.noindex=false
   24.45 +javadoc.nonavbar=false
   24.46 +javadoc.notree=false
   24.47 +javadoc.private=false
   24.48 +javadoc.splitindex=true
   24.49 +javadoc.use=true
   24.50 +javadoc.version=false
   24.51 +javadoc.windowtitle=
   24.52 +jnlp.codebase.type=local
   24.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   24.54 +jnlp.descriptor=application
   24.55 +jnlp.enabled=false
   24.56 +jnlp.offline-allowed=false
   24.57 +jnlp.signed=false
   24.58 +meta.inf.dir=${src.dir}/META-INF
   24.59 +platform.active=default_platform
   24.60 +run.classpath=\
   24.61 +    ${javac.classpath}:\
   24.62 +    ${build.classes.dir}
   24.63 +# Space-separated list of JVM arguments used when running the project
   24.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   24.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   24.66 +run.jvmargs=
   24.67 +run.test.classpath=\
   24.68 +    ${javac.test.classpath}:\
   24.69 +    ${build.test.classes.dir}
   24.70 +src.dir=src
   24.71 +test.src.dir=test
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/task1/solution02/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    25.3 @@ -0,0 +1,16 @@
    25.4 +<?xml version="1.0" encoding="UTF-8"?>
    25.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    25.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    25.7 +    <configuration>
    25.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    25.9 +            <name>Currency Convertor Solution 02</name>
   25.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   25.11 +            <source-roots>
   25.12 +                <root id="src.dir"/>
   25.13 +            </source-roots>
   25.14 +            <test-roots>
   25.15 +                <root id="test.src.dir"/>
   25.16 +            </test-roots>
   25.17 +        </data>
   25.18 +    </configuration>
   25.19 +</project>
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    26.3 @@ -0,0 +1,38 @@
    26.4 +package org.apidesign.apifest08.currency;
    26.5 +
    26.6 +import java.util.Currency;
    26.7 +
    26.8 +
    26.9 +/** 
   26.10 + * Converts one currency to other. The conversion is unidirectional. 
   26.11 + * For example you can have convertor that converts USD (sourceCurrency) to CZK (destination currency). You can call the {@link Convertor#convert(Money)} method
   26.12 + * with amount in USD to get the equivalent in CZK. If you need convert CZK to USD you can call {@link Convertor#revert()} method to get CZK to USD 
   26.13 + * convertor. To create a convertor instance call {@link ConvertorFactory#createConvertor(Currency, Currency)}.
   26.14 + */
   26.15 +public interface Convertor {
   26.16 +	/**
   26.17 +	 * Converts amount in source currency to amount in destination currency. The result is rounded to two decimal places.
   26.18 +	 * @param money 
   26.19 +	 * @return
   26.20 +	 * @throws IllegalArgumentException if money.getCurrency is not equal to sourceCurrency.
   26.21 +	 */
   26.22 +	public Money convert(Money money);
   26.23 +
   26.24 +	/**
   26.25 +	 * Returns convertor that converts from destination currency to source currency with the same exchange rate. 
   26.26 +	 * @return
   26.27 +	 */
   26.28 +	public Convertor revert();
   26.29 +	
   26.30 +	/**
   26.31 +	 * Returns source currency.
   26.32 +	 * @return
   26.33 +	 */
   26.34 +	public Currency getSourceCurrency();
   26.35 +
   26.36 +	/**
   26.37 +	 * Returns destination currency.
   26.38 +	 * @return
   26.39 +	 */
   26.40 +	public Currency getDestinationCurrency();
   26.41 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/ConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    27.3 @@ -0,0 +1,50 @@
    27.4 +package org.apidesign.apifest08.currency;
    27.5 +
    27.6 +import java.util.Currency;
    27.7 +
    27.8 +
    27.9 +/**
   27.10 + * Creates default {@link Convertor} implementations.
   27.11 + * @author lukas
   27.12 + *
   27.13 + */
   27.14 +public class ConvertorFactory {
   27.15 +	private static final DefaultConvertorFactory DEFAULT_FACTORY = new DefaultConvertorFactory();
   27.16 +	
   27.17 +	private ConvertorFactory()
   27.18 +	{
   27.19 +		//nothing
   27.20 +	}
   27.21 +		
   27.22 +	/**
   27.23 +	 * Creates {@link Convertor} that converts from sourceCurrency to destinationCurrency with stored exchange rate.
   27.24 +	 * @param sourceCurrency
   27.25 +	 * @param destinationCurrency
   27.26 +	 * @return
   27.27 +	 * @throws UnsupportedConversionException when exchange rate between currencies is not known.
   27.28 +	 */
   27.29 +	/*
   27.30 +	 * Only one of the createConveror methods is needed. The assignment is not explicit where the exchange rate should be set.
   27.31 +	 */
   27.32 +	public static final Convertor createConvertor(Currency sourceCurrency, Currency destinationCurrency) throws UnsupportedConversionException
   27.33 +	{
   27.34 +		return DEFAULT_FACTORY.getConvertor(sourceCurrency, destinationCurrency);
   27.35 +	}
   27.36 +	/**
   27.37 +	 * Creates {@link Convertor} that converts from sourceEquivalent.currency to destinationEquivalent.currency. 
   27.38 +	 * Exchange rate is set as equivalents. It means if you want to create USD to CZK convertor where USD1 = CZK17 
   27.39 +     * call createConvertor(new MoneyImpl(1, USD), new MoneyImpl(17, CZK)).
   27.40 +	 * @param sourceEquivalent
   27.41 +	 * @param destinationEquivalent
   27.42 +	 * @return
   27.43 +	 */
   27.44 +	/*
   27.45 +	 * Only one of the createConveror methods is needed. The assignment is not explicit where the exchange rate should be set.
   27.46 +	 */
   27.47 +	public static final Convertor createConvertor(Money sourceEquivalent, Money destinationEquivalent)
   27.48 +	{
   27.49 +		return new DefaultConvertor(sourceEquivalent.getAmount(), destinationEquivalent.getAmount(), sourceEquivalent.getCurrency(), destinationEquivalent.getCurrency());
   27.50 +	}
   27.51 +	
   27.52 +
   27.53 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/DefaultConvertor.java	Sun Sep 28 14:12:38 2008 +0200
    28.3 @@ -0,0 +1,134 @@
    28.4 +package org.apidesign.apifest08.currency;
    28.5 +
    28.6 +import java.io.Serializable;
    28.7 +import java.math.BigDecimal;
    28.8 +import java.math.RoundingMode;
    28.9 +import java.util.Currency;
   28.10 +
   28.11 +/**
   28.12 + * Default {@link Convertor} implementation. Exchange rate is stored as equivalents. It means if we have USD to CZK convertor and USD1 = CZK17 
   28.13 + * we store 1 in sourceEquivalent and 17 in destinationEquivalent. This class is immutable.
   28.14 + * @author lukas
   28.15 + *
   28.16 + */
   28.17 +class DefaultConvertor implements Convertor, Serializable {
   28.18 +
   28.19 +	private static final long serialVersionUID = -1754789142402148099L;
   28.20 +
   28.21 +	/**
   28.22 +	 * Equivalent in source currency.
   28.23 +	 */
   28.24 +	private final BigDecimal sourceEquivalent;
   28.25 +	
   28.26 +	/**
   28.27 +	 * Equivalent in destination currency.
   28.28 +	 */
   28.29 +	private final BigDecimal destinationEquivalent;
   28.30 +	
   28.31 +	private final Currency sourceCurrency;
   28.32 +	
   28.33 +	private final Currency destinationCurrency;
   28.34 +	
   28.35 +	public DefaultConvertor(BigDecimal sourceEquivalent, BigDecimal destinationEquivalent, Currency sourceCurrency, Currency destinationCurrency) {
   28.36 +		super();
   28.37 +		this.sourceEquivalent = sourceEquivalent;
   28.38 +		this.destinationEquivalent = destinationEquivalent;
   28.39 +		this.sourceCurrency = sourceCurrency;
   28.40 +		this.destinationCurrency = destinationCurrency;
   28.41 +	}
   28.42 +	
   28.43 +	public Money convert(Money money) {
   28.44 +		if (money==null)
   28.45 +		{
   28.46 +			throw new NullPointerException("Money is null");
   28.47 +		}
   28.48 +		if (!money.getCurrency().equals(getSourceCurrency()))
   28.49 +		{
   28.50 +			throw new IllegalArgumentException("Can not convert from "+money.getCurrency()+". Converts "+getSourceCurrency()+" to "+getDestinationCurrency());
   28.51 +		}
   28.52 +		BigDecimal sourceAmount = money.getAmount();
   28.53 +		BigDecimal destinationAmount = sourceAmount.multiply(destinationEquivalent).divide(sourceEquivalent, 2, RoundingMode.HALF_DOWN);
   28.54 +		return new MoneyImpl(destinationAmount, getDestinationCurrency());
   28.55 +	}
   28.56 +
   28.57 +
   28.58 +	public Convertor revert() {
   28.59 +		return new DefaultConvertor(destinationEquivalent, sourceEquivalent, destinationCurrency, sourceCurrency);
   28.60 +	}
   28.61 +
   28.62 +	public BigDecimal getSourceEquivalent() {
   28.63 +		return sourceEquivalent;
   28.64 +	}
   28.65 +
   28.66 +	public BigDecimal getDestinationEquivalent() {
   28.67 +		return destinationEquivalent;
   28.68 +	}
   28.69 +
   28.70 +	public Currency getSourceCurrency() {
   28.71 +		return sourceCurrency;
   28.72 +	}
   28.73 +
   28.74 +	public Currency getDestinationCurrency() {
   28.75 +		return destinationCurrency;
   28.76 +	}
   28.77 +	
   28.78 +	@Override
   28.79 +	public String toString() {
   28.80 +		return getClass().getName()+" converts "+getSourceCurrency()+" to "+getDestinationCurrency()+" "
   28.81 +			+getSourceCurrency()+getSourceEquivalent()+"="+getDestinationCurrency()+getDestinationEquivalent();
   28.82 +	}
   28.83 +
   28.84 +	@Override
   28.85 +	public int hashCode() {
   28.86 +		final int prime = 31;
   28.87 +		int result = 1;
   28.88 +		result = prime
   28.89 +				* result
   28.90 +				+ ((destinationCurrency == null) ? 0 : destinationCurrency
   28.91 +						.hashCode());
   28.92 +		result = prime
   28.93 +				* result
   28.94 +				+ ((destinationEquivalent == null) ? 0 : destinationEquivalent
   28.95 +						.hashCode());
   28.96 +		result = prime * result
   28.97 +				+ ((sourceCurrency == null) ? 0 : sourceCurrency.hashCode());
   28.98 +		result = prime
   28.99 +				* result
  28.100 +				+ ((sourceEquivalent == null) ? 0 : sourceEquivalent.hashCode());
  28.101 +		return result;
  28.102 +	}
  28.103 +
  28.104 +	@Override
  28.105 +	public boolean equals(Object obj) {
  28.106 +		if (this == obj)
  28.107 +			return true;
  28.108 +		if (obj == null)
  28.109 +			return false;
  28.110 +		if (!(obj instanceof DefaultConvertor))
  28.111 +			return false;
  28.112 +		DefaultConvertor other = (DefaultConvertor) obj;
  28.113 +		if (destinationCurrency == null) {
  28.114 +			if (other.destinationCurrency != null)
  28.115 +				return false;
  28.116 +		} else if (!destinationCurrency.equals(other.destinationCurrency))
  28.117 +			return false;
  28.118 +		if (destinationEquivalent == null) {
  28.119 +			if (other.destinationEquivalent != null)
  28.120 +				return false;
  28.121 +		} else if (!destinationEquivalent.equals(other.destinationEquivalent))
  28.122 +			return false;
  28.123 +		if (sourceCurrency == null) {
  28.124 +			if (other.sourceCurrency != null)
  28.125 +				return false;
  28.126 +		} else if (!sourceCurrency.equals(other.sourceCurrency))
  28.127 +			return false;
  28.128 +		if (sourceEquivalent == null) {
  28.129 +			if (other.sourceEquivalent != null)
  28.130 +				return false;
  28.131 +		} else if (!sourceEquivalent.equals(other.sourceEquivalent))
  28.132 +			return false;
  28.133 +		return true;
  28.134 +	}
  28.135 +
  28.136 +
  28.137 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/DefaultConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    29.3 @@ -0,0 +1,49 @@
    29.4 +package org.apidesign.apifest08.currency;
    29.5 +
    29.6 +
    29.7 +import java.math.BigDecimal;
    29.8 +import java.util.Currency;
    29.9 +import java.util.HashMap;
   29.10 +import java.util.Map;
   29.11 +
   29.12 +/**
   29.13 + * Default factory for convertors. Basically it just keeps exchange rates for given currency combinations.
   29.14 + * @author lukas
   29.15 + *
   29.16 + */
   29.17 +class DefaultConvertorFactory {
   29.18 +	private static final Currency SKK = Currency.getInstance("SKK");
   29.19 +	private static final Currency USD = Currency.getInstance("USD");
   29.20 +	private static final Currency CZK = Currency.getInstance("CZK");
   29.21 +	private Map<String, Convertor> convertorMap = new HashMap<String, Convertor>();
   29.22 +	
   29.23 +	public 	DefaultConvertorFactory()
   29.24 +	{
   29.25 +		addConvertor(CZK,USD,BigDecimal.valueOf(17),BigDecimal.valueOf(1));
   29.26 +		addConvertor(CZK,SKK,BigDecimal.valueOf(80),BigDecimal.valueOf(100));
   29.27 +	}
   29.28 +
   29.29 +	private void addConvertor(Currency sourceCurrency, Currency destinationCurrency, BigDecimal sourceEquivalent, BigDecimal destinationEquivalent) {
   29.30 +		DefaultConvertor convertor = new DefaultConvertor(sourceEquivalent, destinationEquivalent, sourceCurrency, destinationCurrency);
   29.31 +		convertorMap.put(getConvertorKey(sourceCurrency, destinationCurrency), convertor);
   29.32 +		convertorMap.put(getConvertorKey(destinationCurrency, sourceCurrency), convertor.revert());
   29.33 +	}
   29.34 +		
   29.35 +	public Convertor getConvertor(Currency sourceCurrency, Currency destinationCurrency) throws UnsupportedConversionException
   29.36 +	{
   29.37 +		String convertorKey = getConvertorKey(sourceCurrency, destinationCurrency);
   29.38 +		Convertor result = convertorMap.get(convertorKey);
   29.39 +		if (result!=null)
   29.40 +		{
   29.41 +			return result;
   29.42 +		}
   29.43 +		else
   29.44 +		{
   29.45 +			throw new UnsupportedConversionException("Conversion from "+sourceCurrency+" to "+destinationCurrency+" is not supported");
   29.46 +		}
   29.47 +	}
   29.48 +
   29.49 +	private String getConvertorKey(Currency sourceCurrency,	Currency destinationCurrency) {
   29.50 +		return sourceCurrency.getCurrencyCode()+destinationCurrency.getCurrencyCode();
   29.51 +	}
   29.52 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/Money.java	Sun Sep 28 14:12:38 2008 +0200
    30.3 @@ -0,0 +1,29 @@
    30.4 +package org.apidesign.apifest08.currency;
    30.5 +
    30.6 +import java.math.BigDecimal;
    30.7 +import java.util.Currency;
    30.8 +
    30.9 +/**
   30.10 + * Money representation. Default implementation {@link MoneyImpl} is provided. This interface can
   30.11 + * be implemented by a DTO used in client application.
   30.12 + * @author lukas
   30.13 + *
   30.14 + */
   30.15 +/*
   30.16 + * Whether we need such interface depends on context. I can imagine than in a desktop application this interface 
   30.17 + * would be useless, Money could be a class. In J2EE environment it can be useful.
   30.18 + */
   30.19 +public interface Money {
   30.20 +
   30.21 +	/**
   30.22 +	 * Returns amount.
   30.23 +	 * @return
   30.24 +	 */
   30.25 +	public BigDecimal getAmount();
   30.26 +
   30.27 +	/**
   30.28 +	 * Returns currency.
   30.29 +	 */
   30.30 +	public Currency getCurrency();
   30.31 +
   30.32 +}
   30.33 \ No newline at end of file
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/MoneyImpl.java	Sun Sep 28 14:12:38 2008 +0200
    31.3 @@ -0,0 +1,87 @@
    31.4 +package org.apidesign.apifest08.currency;
    31.5 +
    31.6 +import java.io.Serializable;
    31.7 +import java.math.BigDecimal;
    31.8 +import java.util.Currency;
    31.9 +
   31.10 +/**
   31.11 + * Default implementation of {@link Money} interface. This class is immutable.
   31.12 + * @author lukas
   31.13 + *
   31.14 + */
   31.15 +public final class MoneyImpl implements Serializable, Money{
   31.16 +	private static final long serialVersionUID = -6091808475616516136L;
   31.17 +
   31.18 +	private final BigDecimal amount;
   31.19 +	
   31.20 +	private final Currency currency;
   31.21 +
   31.22 +	public MoneyImpl(BigDecimal amount, Currency currency) {
   31.23 +		if (amount==null) throw new NullPointerException("Amount is null");
   31.24 +		if (currency==null) throw new NullPointerException("Currency is null"+currency);
   31.25 +		this.amount = amount.setScale(2);
   31.26 +		this.currency = currency;
   31.27 +	}
   31.28 +	
   31.29 +	public MoneyImpl(long amount, Currency currency) {
   31.30 +		this(BigDecimal.valueOf(amount), currency);
   31.31 +	}
   31.32 +	
   31.33 +	public MoneyImpl(double amount, Currency currency) {
   31.34 +		this(BigDecimal.valueOf(amount), currency);
   31.35 +	}
   31.36 +
   31.37 +	/* (non-Javadoc)
   31.38 +	 * @see org.apidesign.apifest08.currency.Money#getAmount()
   31.39 +	 */
   31.40 +	public BigDecimal getAmount() {
   31.41 +		return amount;
   31.42 +	}
   31.43 +	
   31.44 +	/* (non-Javadoc)
   31.45 +	 * @see org.apidesign.apifest08.currency.Money#getCurrency()
   31.46 +	 */
   31.47 +	public Currency getCurrency() {
   31.48 +		return currency;
   31.49 +	}
   31.50 +
   31.51 +	@Override
   31.52 +	public int hashCode() {
   31.53 +		final int prime = 31;
   31.54 +		int result = 1;
   31.55 +		result = prime * result + ((amount == null) ? 0 : amount.hashCode());
   31.56 +		result = prime * result
   31.57 +				+ ((currency == null) ? 0 : currency.hashCode());
   31.58 +		return result;
   31.59 +	}
   31.60 +
   31.61 +	@Override
   31.62 +	public boolean equals(Object obj) {
   31.63 +		if (this == obj)
   31.64 +			return true;
   31.65 +		if (obj == null)
   31.66 +			return false;
   31.67 +		if (!(obj instanceof MoneyImpl))
   31.68 +			return false;
   31.69 +		MoneyImpl other = (MoneyImpl) obj;
   31.70 +		if (amount == null) {
   31.71 +			if (other.amount != null)
   31.72 +				return false;
   31.73 +		} else if (!amount.equals(other.amount))
   31.74 +			return false;
   31.75 +		if (currency == null) {
   31.76 +			if (other.currency != null)
   31.77 +				return false;
   31.78 +		} else if (!currency.equals(other.currency))
   31.79 +			return false;
   31.80 +		return true;
   31.81 +	}
   31.82 +	
   31.83 +	@Override
   31.84 +	public String toString() {
   31.85 +		return getClass().getName()+"["+currency+amount+"]";
   31.86 +	}
   31.87 +
   31.88 +	
   31.89 +	
   31.90 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/UnsupportedConversionException.java	Sun Sep 28 14:12:38 2008 +0200
    32.3 @@ -0,0 +1,28 @@
    32.4 +package org.apidesign.apifest08.currency;
    32.5 +
    32.6 +/**
    32.7 + * Exception thrown when conversion is not supported.
    32.8 + * @author lukas
    32.9 + *
   32.10 + */
   32.11 +public class UnsupportedConversionException extends IllegalArgumentException {
   32.12 +	private static final long serialVersionUID = 4412475695345865196L;
   32.13 +
   32.14 +	public UnsupportedConversionException() {
   32.15 +		super();
   32.16 +	}
   32.17 +
   32.18 +	public UnsupportedConversionException(String message, Throwable cause) {
   32.19 +		super(message, cause);
   32.20 +	}
   32.21 +
   32.22 +	public UnsupportedConversionException(String s) {
   32.23 +		super(s);
   32.24 +	}
   32.25 +
   32.26 +	public UnsupportedConversionException(Throwable cause) {
   32.27 +		super(cause);
   32.28 +	}
   32.29 +
   32.30 +
   32.31 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/task1/solution02/test/org/apidesign/apifest08/test/ConvertorFactoryTest.java	Sun Sep 28 14:12:38 2008 +0200
    33.3 @@ -0,0 +1,46 @@
    33.4 +package org.apidesign.apifest08.test;
    33.5 +
    33.6 +import static junit.framework.Assert.assertEquals;
    33.7 +import static junit.framework.Assert.assertNotNull;
    33.8 +import static org.apidesign.apifest08.test.Task1Test.CZK;
    33.9 +import static org.apidesign.apifest08.test.Task1Test.USD;
   33.10 +
   33.11 +import java.util.Currency;
   33.12 +
   33.13 +import org.apidesign.apifest08.currency.ConvertorFactory;
   33.14 +import org.apidesign.apifest08.currency.UnsupportedConversionException;
   33.15 +import org.junit.Test;
   33.16 +
   33.17 +
   33.18 +public class ConvertorFactoryTest {
   33.19 +	@Test(expected=NullPointerException.class)
   33.20 +	public void testNullSource()
   33.21 +	{
   33.22 +		ConvertorFactory.createConvertor(null, USD);
   33.23 +	}
   33.24 +	@Test(expected=NullPointerException.class)
   33.25 +	public void testNullDestination()
   33.26 +	{
   33.27 +		ConvertorFactory.createConvertor(CZK, null);
   33.28 +	}
   33.29 +	@Test(expected=IllegalArgumentException.class)
   33.30 +	public void testShortSource()
   33.31 +	{
   33.32 +		ConvertorFactory.createConvertor(Currency.getInstance("CZ"), USD);
   33.33 +	}
   33.34 +	@Test(expected=UnsupportedConversionException.class)
   33.35 +	public void testUnknownCombination()
   33.36 +	{
   33.37 +		ConvertorFactory.createConvertor(CZK, Currency.getInstance("ZAR"));
   33.38 +	}
   33.39 +	@Test
   33.40 +	public void testOk()
   33.41 +	{
   33.42 +		assertNotNull(ConvertorFactory.createConvertor(CZK, USD));
   33.43 +	}
   33.44 +	@Test
   33.45 +	public void testReverted()
   33.46 +	{
   33.47 +		assertEquals(ConvertorFactory.createConvertor(CZK, USD).revert(), ConvertorFactory.createConvertor(USD, CZK));
   33.48 +	}
   33.49 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/task1/solution02/test/org/apidesign/apifest08/test/ConvertorTest.java	Sun Sep 28 14:12:38 2008 +0200
    34.3 @@ -0,0 +1,30 @@
    34.4 +package org.apidesign.apifest08.test;
    34.5 +
    34.6 +import static org.apidesign.apifest08.test.Task1Test.CZK;
    34.7 +import static org.apidesign.apifest08.test.Task1Test.USD;
    34.8 +import static org.junit.Assert.assertEquals;
    34.9 +
   34.10 +import java.math.BigDecimal;
   34.11 +
   34.12 +import org.apidesign.apifest08.currency.ConvertorFactory;
   34.13 +import org.apidesign.apifest08.currency.Money;
   34.14 +import org.apidesign.apifest08.currency.MoneyImpl;
   34.15 +import org.junit.Test;
   34.16 +
   34.17 +
   34.18 +public class ConvertorTest {
   34.19 +
   34.20 +	@Test
   34.21 +	public void testConvertSmall()
   34.22 +	{
   34.23 +		Money converted = ConvertorFactory.createConvertor(CZK, USD).convert(new MoneyImpl(0.17,CZK));
   34.24 +		assertEquals(new MoneyImpl(new BigDecimal("0.01"),USD),converted);
   34.25 +		assertEquals(USD,converted.getCurrency());
   34.26 +	}
   34.27 +	@Test
   34.28 +	public void testConvertSmallReverse()
   34.29 +	{
   34.30 +		Money converted = ConvertorFactory.createConvertor(USD, CZK).convert(new MoneyImpl(0.01,USD));
   34.31 +		assertEquals(new MoneyImpl(new BigDecimal("0.17"),CZK),converted);
   34.32 +	}
   34.33 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/task1/solution02/test/org/apidesign/apifest08/test/MoneyTest.java	Sun Sep 28 14:12:38 2008 +0200
    35.3 @@ -0,0 +1,24 @@
    35.4 +package org.apidesign.apifest08.test;
    35.5 +
    35.6 +import static junit.framework.Assert.assertEquals;
    35.7 +
    35.8 +import java.math.BigDecimal;
    35.9 +
   35.10 +import org.apidesign.apifest08.currency.MoneyImpl;
   35.11 +import org.junit.Test;
   35.12 +import static org.apidesign.apifest08.test.Task1Test.*;
   35.13 +
   35.14 +public class MoneyTest {
   35.15 +	@Test(expected=NullPointerException.class)
   35.16 +	public void testNullAmount(){
   35.17 +		new MoneyImpl(null,CZK);
   35.18 +	}
   35.19 +	@Test(expected=NullPointerException.class)
   35.20 +	public void testNullCurrency(){
   35.21 +		new MoneyImpl(1,null);
   35.22 +	}
   35.23 +	@Test
   35.24 +	public void testOk(){
   35.25 +		assertEquals(new BigDecimal("123.00"),new MoneyImpl(123,CZK).getAmount());
   35.26 +	}
   35.27 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/task1/solution02/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    36.3 @@ -0,0 +1,91 @@
    36.4 +package org.apidesign.apifest08.test;
    36.5 +
    36.6 +import java.util.Currency;
    36.7 +
    36.8 +import junit.framework.TestCase;
    36.9 +
   36.10 +import org.apidesign.apifest08.currency.Convertor;
   36.11 +import org.apidesign.apifest08.currency.ConvertorFactory;
   36.12 +import org.apidesign.apifest08.currency.MoneyImpl;
   36.13 +
   36.14 +/** Finish the Convertor API, and then write bodies of methods inside
   36.15 + * of this class to match the given tasks. To fullfil your task, use the
   36.16 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   36.17 + * Do not you reflection, or other hacks as your code
   36.18 + * shall run without any runtime permissions.
   36.19 + */
   36.20 +public class Task1Test extends TestCase {
   36.21 +	public static final Currency USD = Currency.getInstance("USD");
   36.22 +	public static final Currency CZK = Currency.getInstance("CZK");
   36.23 +	public static final Currency SKK = Currency.getInstance("SKK");
   36.24 +    public Task1Test(String testName) {
   36.25 +        super(testName);
   36.26 +    }
   36.27 +
   36.28 +    @Override
   36.29 +    protected void setUp() throws Exception {
   36.30 +    }
   36.31 +
   36.32 +    @Override
   36.33 +    protected void tearDown() throws Exception {
   36.34 +    }
   36.35 +
   36.36 +    /** Create convertor that understands two currencies, CZK and
   36.37 +     *  USD. Make 1 USD == 17 CZK.
   36.38 +     *
   36.39 +     * Creation of the convertor shall not require subclassing of any class
   36.40 +     * or interface on the client side.
   36.41 +     *
   36.42 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   36.43 +     */
   36.44 +    public static Convertor createCZKtoUSD() {
   36.45 +      //You can use both variants. I wrote the first one but than I realized that maybe
   36.46 +      //you want me to write the second one. So I have written both. 
   36.47 +      return ConvertorFactory.createConvertor(CZK, USD);
   36.48 +      //return ConvertorFactory.createConvertor(new MoneyImpl(17,CZK), new MoneyImpl(1,USD));
   36.49 +    }
   36.50 +
   36.51 +    /** Create convertor that understands two currencies, CZK and
   36.52 +     *  SKK. Make 100 SKK == 80 CZK.
   36.53 +     *
   36.54 +     * Creation of the convertor shall not require subclassing of any class
   36.55 +     * or interface on the client side.
   36.56 +     * 
   36.57 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   36.58 +     */
   36.59 +    public static Convertor createSKKtoCZK() {
   36.60 +    	//You can use both variants. I wrote the first one but than I realized that maybe
   36.61 +        //you want me to write the second one. So I have written both.
   36.62 +        //return ConvertorFactory.createConvertor(SKK, CZK);
   36.63 +        return ConvertorFactory.createConvertor(new MoneyImpl(100,SKK), new MoneyImpl(80,CZK));
   36.64 +    }
   36.65 +    
   36.66 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   36.67 +     * with it.
   36.68 +     */
   36.69 +    public void testCurrencyCZKUSD() throws Exception {
   36.70 +        Convertor czkToUsdConvertor = createCZKtoUSD();
   36.71 +        // convert $5 to CZK using c:
   36.72 +        Convertor usdToCzkConvertor = czkToUsdConvertor.revert();
   36.73 +		assertEquals("Result is 85 CZK",new MoneyImpl(85,CZK), usdToCzkConvertor.convert(new MoneyImpl(5,USD)));
   36.74 +
   36.75 +        // convert $8 to CZK
   36.76 +        assertEquals("Result is 136 CZK",new MoneyImpl(136,CZK), usdToCzkConvertor.convert(new MoneyImpl(8,USD)));
   36.77 +
   36.78 +        // convert 1003CZK to USD
   36.79 +        assertEquals("Result is 59 USD", new MoneyImpl(59,USD), czkToUsdConvertor.convert(new MoneyImpl(1003,CZK)));
   36.80 +    }
   36.81 +
   36.82 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   36.83 +     * with it.
   36.84 +     */
   36.85 +    public void testCurrencySKKCZK() throws Exception {
   36.86 +        Convertor skkToCzkConvertor = createSKKtoCZK();
   36.87 +        // convert 16CZK using c:
   36.88 +        assertEquals("Result is 20 SKK", new MoneyImpl(20,SKK), skkToCzkConvertor.revert().convert(new MoneyImpl(16,CZK)));
   36.89 +
   36.90 +        // convert 500SKK to CZK
   36.91 +        assertEquals("Result is 400 CZK", new MoneyImpl(400,CZK), skkToCzkConvertor.convert(new MoneyImpl(500,SKK)));
   36.92 +    }
   36.93 +}
   36.94 +
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/task1/solution03/build.xml	Sun Sep 28 14:12:38 2008 +0200
    37.3 @@ -0,0 +1,69 @@
    37.4 +<?xml version="1.0" encoding="UTF-8"?>
    37.5 +<!-- You may freely edit this file. See commented blocks below for -->
    37.6 +<!-- some examples of how to customize the build. -->
    37.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    37.8 +<project name="currency" default="default" basedir=".">
    37.9 +    <description>Builds, tests, and runs the project.</description>
   37.10 +    <import file="nbproject/build-impl.xml"/>
   37.11 +    <!--
   37.12 +
   37.13 +    There exist several targets which are by default empty and which can be 
   37.14 +    used for execution of your tasks. These targets are usually executed 
   37.15 +    before and after some main targets. They are: 
   37.16 +
   37.17 +      -pre-init:                 called before initialization of project properties
   37.18 +      -post-init:                called after initialization of project properties
   37.19 +      -pre-compile:              called before javac compilation
   37.20 +      -post-compile:             called after javac compilation
   37.21 +      -pre-compile-single:       called before javac compilation of single file
   37.22 +      -post-compile-single:      called after javac compilation of single file
   37.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   37.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   37.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   37.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   37.27 +      -pre-jar:                  called before JAR building
   37.28 +      -post-jar:                 called after JAR building
   37.29 +      -post-clean:               called after cleaning build products
   37.30 +
   37.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   37.32 +
   37.33 +    Example of inserting an obfuscator after compilation could look like this:
   37.34 +
   37.35 +        <target name="-post-compile">
   37.36 +            <obfuscate>
   37.37 +                <fileset dir="${build.classes.dir}"/>
   37.38 +            </obfuscate>
   37.39 +        </target>
   37.40 +
   37.41 +    For list of available properties check the imported 
   37.42 +    nbproject/build-impl.xml file. 
   37.43 +
   37.44 +
   37.45 +    Another way to customize the build is by overriding existing main targets.
   37.46 +    The targets of interest are: 
   37.47 +
   37.48 +      -init-macrodef-javac:     defines macro for javac compilation
   37.49 +      -init-macrodef-junit:     defines macro for junit execution
   37.50 +      -init-macrodef-debug:     defines macro for class debugging
   37.51 +      -init-macrodef-java:      defines macro for class execution
   37.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   37.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   37.54 +      run:                      execution of project 
   37.55 +      -javadoc-build:           Javadoc generation
   37.56 +      test-report:              JUnit report generation
   37.57 +
   37.58 +    An example of overriding the target for project execution could look like this:
   37.59 +
   37.60 +        <target name="run" depends="currency-impl.jar">
   37.61 +            <exec dir="bin" executable="launcher.exe">
   37.62 +                <arg file="${dist.jar}"/>
   37.63 +            </exec>
   37.64 +        </target>
   37.65 +
   37.66 +    Notice that the overridden target depends on the jar target and not only on 
   37.67 +    the compile target as the regular run target does. Again, for a list of available 
   37.68 +    properties which you can use, check the target you are overriding in the
   37.69 +    nbproject/build-impl.xml file. 
   37.70 +
   37.71 +    -->
   37.72 +</project>
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/task1/solution03/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    38.3 @@ -0,0 +1,642 @@
    38.4 +<?xml version="1.0" encoding="UTF-8"?>
    38.5 +<!--
    38.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    38.7 +***         EDIT ../build.xml INSTEAD         ***
    38.8 +
    38.9 +For the purpose of easier reading the script
   38.10 +is divided into following sections:
   38.11 +
   38.12 +  - initialization
   38.13 +  - compilation
   38.14 +  - jar
   38.15 +  - execution
   38.16 +  - debugging
   38.17 +  - javadoc
   38.18 +  - junit compilation
   38.19 +  - junit execution
   38.20 +  - junit debugging
   38.21 +  - applet
   38.22 +  - cleanup
   38.23 +
   38.24 +        -->
   38.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_03-impl">
   38.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   38.27 +    <!-- 
   38.28 +                ======================
   38.29 +                INITIALIZATION SECTION 
   38.30 +                ======================
   38.31 +            -->
   38.32 +    <target name="-pre-init">
   38.33 +        <!-- Empty placeholder for easier customization. -->
   38.34 +        <!-- You can override this target in the ../build.xml file. -->
   38.35 +    </target>
   38.36 +    <target depends="-pre-init" name="-init-private">
   38.37 +        <property file="nbproject/private/config.properties"/>
   38.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   38.39 +        <property file="nbproject/private/private.properties"/>
   38.40 +    </target>
   38.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   38.42 +        <property file="${user.properties.file}"/>
   38.43 +        <!-- The two properties below are usually overridden -->
   38.44 +        <!-- by the active platform. Just a fallback. -->
   38.45 +        <property name="default.javac.source" value="1.4"/>
   38.46 +        <property name="default.javac.target" value="1.4"/>
   38.47 +    </target>
   38.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   38.49 +        <property file="nbproject/configs/${config}.properties"/>
   38.50 +        <property file="nbproject/project.properties"/>
   38.51 +    </target>
   38.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   38.53 +        <available file="${manifest.file}" property="manifest.available"/>
   38.54 +        <condition property="manifest.available+main.class">
   38.55 +            <and>
   38.56 +                <isset property="manifest.available"/>
   38.57 +                <isset property="main.class"/>
   38.58 +                <not>
   38.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   38.60 +                </not>
   38.61 +            </and>
   38.62 +        </condition>
   38.63 +        <condition property="manifest.available+main.class+mkdist.available">
   38.64 +            <and>
   38.65 +                <istrue value="${manifest.available+main.class}"/>
   38.66 +                <isset property="libs.CopyLibs.classpath"/>
   38.67 +            </and>
   38.68 +        </condition>
   38.69 +        <condition property="have.tests">
   38.70 +            <or>
   38.71 +                <available file="${test.src.dir}"/>
   38.72 +            </or>
   38.73 +        </condition>
   38.74 +        <condition property="have.sources">
   38.75 +            <or>
   38.76 +                <available file="${src.dir}"/>
   38.77 +            </or>
   38.78 +        </condition>
   38.79 +        <condition property="netbeans.home+have.tests">
   38.80 +            <and>
   38.81 +                <isset property="netbeans.home"/>
   38.82 +                <isset property="have.tests"/>
   38.83 +            </and>
   38.84 +        </condition>
   38.85 +        <condition property="no.javadoc.preview">
   38.86 +            <and>
   38.87 +                <isset property="javadoc.preview"/>
   38.88 +                <isfalse value="${javadoc.preview}"/>
   38.89 +            </and>
   38.90 +        </condition>
   38.91 +        <property name="run.jvmargs" value=""/>
   38.92 +        <property name="javac.compilerargs" value=""/>
   38.93 +        <property name="work.dir" value="${basedir}"/>
   38.94 +        <condition property="no.deps">
   38.95 +            <and>
   38.96 +                <istrue value="${no.dependencies}"/>
   38.97 +            </and>
   38.98 +        </condition>
   38.99 +        <property name="javac.debug" value="true"/>
  38.100 +        <property name="javadoc.preview" value="true"/>
  38.101 +        <property name="application.args" value=""/>
  38.102 +        <property name="source.encoding" value="${file.encoding}"/>
  38.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  38.104 +            <and>
  38.105 +                <isset property="javadoc.encoding"/>
  38.106 +                <not>
  38.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  38.108 +                </not>
  38.109 +            </and>
  38.110 +        </condition>
  38.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  38.112 +        <property name="includes" value="**"/>
  38.113 +        <property name="excludes" value=""/>
  38.114 +        <property name="do.depend" value="false"/>
  38.115 +        <condition property="do.depend.true">
  38.116 +            <istrue value="${do.depend}"/>
  38.117 +        </condition>
  38.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  38.119 +            <and>
  38.120 +                <isset property="jaxws.endorsed.dir"/>
  38.121 +                <available file="nbproject/jaxws-build.xml"/>
  38.122 +            </and>
  38.123 +        </condition>
  38.124 +    </target>
  38.125 +    <target name="-post-init">
  38.126 +        <!-- Empty placeholder for easier customization. -->
  38.127 +        <!-- You can override this target in the ../build.xml file. -->
  38.128 +    </target>
  38.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  38.130 +        <fail unless="src.dir">Must set src.dir</fail>
  38.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  38.132 +        <fail unless="build.dir">Must set build.dir</fail>
  38.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  38.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  38.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  38.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  38.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  38.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  38.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  38.140 +    </target>
  38.141 +    <target name="-init-macrodef-property">
  38.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.143 +            <attribute name="name"/>
  38.144 +            <attribute name="value"/>
  38.145 +            <sequential>
  38.146 +                <property name="@{name}" value="${@{value}}"/>
  38.147 +            </sequential>
  38.148 +        </macrodef>
  38.149 +    </target>
  38.150 +    <target name="-init-macrodef-javac">
  38.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.152 +            <attribute default="${src.dir}" name="srcdir"/>
  38.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  38.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  38.155 +            <attribute default="${includes}" name="includes"/>
  38.156 +            <attribute default="${excludes}" name="excludes"/>
  38.157 +            <attribute default="${javac.debug}" name="debug"/>
  38.158 +            <attribute default="" name="sourcepath"/>
  38.159 +            <element name="customize" optional="true"/>
  38.160 +            <sequential>
  38.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  38.162 +                    <classpath>
  38.163 +                        <path path="@{classpath}"/>
  38.164 +                    </classpath>
  38.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  38.166 +                    <customize/>
  38.167 +                </javac>
  38.168 +            </sequential>
  38.169 +        </macrodef>
  38.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.171 +            <attribute default="${src.dir}" name="srcdir"/>
  38.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  38.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  38.174 +            <sequential>
  38.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  38.176 +                    <classpath>
  38.177 +                        <path path="@{classpath}"/>
  38.178 +                    </classpath>
  38.179 +                </depend>
  38.180 +            </sequential>
  38.181 +        </macrodef>
  38.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  38.184 +            <sequential>
  38.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  38.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  38.187 +                    <path>
  38.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  38.189 +                    </path>
  38.190 +                    <globmapper from="*.java" to="*.class"/>
  38.191 +                </pathconvert>
  38.192 +                <delete>
  38.193 +                    <files includes="${javac.includes.binary}"/>
  38.194 +                </delete>
  38.195 +            </sequential>
  38.196 +        </macrodef>
  38.197 +    </target>
  38.198 +    <target name="-init-macrodef-junit">
  38.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.200 +            <attribute default="${includes}" name="includes"/>
  38.201 +            <attribute default="${excludes}" name="excludes"/>
  38.202 +            <attribute default="**" name="testincludes"/>
  38.203 +            <sequential>
  38.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  38.205 +                    <batchtest todir="${build.test.results.dir}">
  38.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  38.207 +                            <filename name="@{testincludes}"/>
  38.208 +                        </fileset>
  38.209 +                    </batchtest>
  38.210 +                    <classpath>
  38.211 +                        <path path="${run.test.classpath}"/>
  38.212 +                    </classpath>
  38.213 +                    <syspropertyset>
  38.214 +                        <propertyref prefix="test-sys-prop."/>
  38.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  38.216 +                    </syspropertyset>
  38.217 +                    <formatter type="brief" usefile="false"/>
  38.218 +                    <formatter type="xml"/>
  38.219 +                    <jvmarg line="${run.jvmargs}"/>
  38.220 +                </junit>
  38.221 +            </sequential>
  38.222 +        </macrodef>
  38.223 +    </target>
  38.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  38.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.226 +            <attribute default="${main.class}" name="name"/>
  38.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  38.228 +            <attribute default="" name="stopclassname"/>
  38.229 +            <sequential>
  38.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  38.231 +                    <classpath>
  38.232 +                        <path path="@{classpath}"/>
  38.233 +                    </classpath>
  38.234 +                </nbjpdastart>
  38.235 +            </sequential>
  38.236 +        </macrodef>
  38.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  38.239 +            <sequential>
  38.240 +                <nbjpdareload>
  38.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  38.242 +                        <include name="${fix.includes}*.class"/>
  38.243 +                    </fileset>
  38.244 +                </nbjpdareload>
  38.245 +            </sequential>
  38.246 +        </macrodef>
  38.247 +    </target>
  38.248 +    <target name="-init-debug-args">
  38.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  38.250 +        <condition property="have-jdk-older-than-1.4">
  38.251 +            <or>
  38.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  38.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  38.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  38.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  38.256 +            </or>
  38.257 +        </condition>
  38.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  38.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  38.260 +        </condition>
  38.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  38.262 +            <os family="windows"/>
  38.263 +        </condition>
  38.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  38.265 +            <isset property="debug.transport"/>
  38.266 +        </condition>
  38.267 +    </target>
  38.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  38.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.270 +            <attribute default="${main.class}" name="classname"/>
  38.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  38.272 +            <element name="customize" optional="true"/>
  38.273 +            <sequential>
  38.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  38.275 +                    <jvmarg line="${debug-args-line}"/>
  38.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  38.277 +                    <jvmarg line="${run.jvmargs}"/>
  38.278 +                    <classpath>
  38.279 +                        <path path="@{classpath}"/>
  38.280 +                    </classpath>
  38.281 +                    <syspropertyset>
  38.282 +                        <propertyref prefix="run-sys-prop."/>
  38.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  38.284 +                    </syspropertyset>
  38.285 +                    <customize/>
  38.286 +                </java>
  38.287 +            </sequential>
  38.288 +        </macrodef>
  38.289 +    </target>
  38.290 +    <target name="-init-macrodef-java">
  38.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.292 +            <attribute default="${main.class}" name="classname"/>
  38.293 +            <element name="customize" optional="true"/>
  38.294 +            <sequential>
  38.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  38.296 +                    <jvmarg line="${run.jvmargs}"/>
  38.297 +                    <classpath>
  38.298 +                        <path path="${run.classpath}"/>
  38.299 +                    </classpath>
  38.300 +                    <syspropertyset>
  38.301 +                        <propertyref prefix="run-sys-prop."/>
  38.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  38.303 +                    </syspropertyset>
  38.304 +                    <customize/>
  38.305 +                </java>
  38.306 +            </sequential>
  38.307 +        </macrodef>
  38.308 +    </target>
  38.309 +    <target name="-init-presetdef-jar">
  38.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  38.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  38.313 +            </jar>
  38.314 +        </presetdef>
  38.315 +    </target>
  38.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  38.317 +    <!--
  38.318 +                ===================
  38.319 +                COMPILATION SECTION
  38.320 +                ===================
  38.321 +            -->
  38.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  38.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  38.324 +    <target depends="init" name="-check-automatic-build">
  38.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  38.326 +    </target>
  38.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  38.328 +        <antcall target="clean"/>
  38.329 +    </target>
  38.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  38.331 +        <mkdir dir="${build.classes.dir}"/>
  38.332 +    </target>
  38.333 +    <target name="-pre-compile">
  38.334 +        <!-- Empty placeholder for easier customization. -->
  38.335 +        <!-- You can override this target in the ../build.xml file. -->
  38.336 +    </target>
  38.337 +    <target if="do.depend.true" name="-compile-depend">
  38.338 +        <j2seproject3:depend/>
  38.339 +    </target>
  38.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  38.341 +        <j2seproject3:javac/>
  38.342 +        <copy todir="${build.classes.dir}">
  38.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.344 +        </copy>
  38.345 +    </target>
  38.346 +    <target name="-post-compile">
  38.347 +        <!-- Empty placeholder for easier customization. -->
  38.348 +        <!-- You can override this target in the ../build.xml file. -->
  38.349 +    </target>
  38.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  38.351 +    <target name="-pre-compile-single">
  38.352 +        <!-- Empty placeholder for easier customization. -->
  38.353 +        <!-- You can override this target in the ../build.xml file. -->
  38.354 +    </target>
  38.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  38.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  38.357 +        <j2seproject3:force-recompile/>
  38.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  38.359 +    </target>
  38.360 +    <target name="-post-compile-single">
  38.361 +        <!-- Empty placeholder for easier customization. -->
  38.362 +        <!-- You can override this target in the ../build.xml file. -->
  38.363 +    </target>
  38.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  38.365 +    <!--
  38.366 +                ====================
  38.367 +                JAR BUILDING SECTION
  38.368 +                ====================
  38.369 +            -->
  38.370 +    <target depends="init" name="-pre-pre-jar">
  38.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  38.372 +        <mkdir dir="${dist.jar.dir}"/>
  38.373 +    </target>
  38.374 +    <target name="-pre-jar">
  38.375 +        <!-- Empty placeholder for easier customization. -->
  38.376 +        <!-- You can override this target in the ../build.xml file. -->
  38.377 +    </target>
  38.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  38.379 +        <j2seproject1:jar/>
  38.380 +    </target>
  38.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  38.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  38.383 +    </target>
  38.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  38.385 +        <j2seproject1:jar manifest="${manifest.file}">
  38.386 +            <j2seproject1:manifest>
  38.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  38.388 +            </j2seproject1:manifest>
  38.389 +        </j2seproject1:jar>
  38.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  38.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  38.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  38.393 +        <pathconvert property="run.classpath.with.dist.jar">
  38.394 +            <path path="${run.classpath}"/>
  38.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  38.396 +        </pathconvert>
  38.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  38.398 +    </target>
  38.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  38.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  38.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  38.402 +            <path path="${run.classpath}"/>
  38.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  38.404 +        </pathconvert>
  38.405 +        <pathconvert pathsep=" " property="jar.classpath">
  38.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  38.407 +            <chainedmapper>
  38.408 +                <flattenmapper/>
  38.409 +                <globmapper from="*" to="lib/*"/>
  38.410 +            </chainedmapper>
  38.411 +        </pathconvert>
  38.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  38.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  38.414 +            <fileset dir="${build.classes.dir}"/>
  38.415 +            <manifest>
  38.416 +                <attribute name="Main-Class" value="${main.class}"/>
  38.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  38.418 +            </manifest>
  38.419 +        </copylibs>
  38.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  38.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  38.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  38.423 +    </target>
  38.424 +    <target name="-post-jar">
  38.425 +        <!-- Empty placeholder for easier customization. -->
  38.426 +        <!-- You can override this target in the ../build.xml file. -->
  38.427 +    </target>
  38.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  38.429 +    <!--
  38.430 +                =================
  38.431 +                EXECUTION SECTION
  38.432 +                =================
  38.433 +            -->
  38.434 +    <target depends="init,compile" description="Run a main class." name="run">
  38.435 +        <j2seproject1:java>
  38.436 +            <customize>
  38.437 +                <arg line="${application.args}"/>
  38.438 +            </customize>
  38.439 +        </j2seproject1:java>
  38.440 +    </target>
  38.441 +    <target name="-do-not-recompile">
  38.442 +        <property name="javac.includes.binary" value=""/>
  38.443 +    </target>
  38.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  38.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  38.446 +        <j2seproject1:java classname="${run.class}"/>
  38.447 +    </target>
  38.448 +    <!--
  38.449 +                =================
  38.450 +                DEBUGGING SECTION
  38.451 +                =================
  38.452 +            -->
  38.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  38.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  38.455 +    </target>
  38.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  38.457 +        <j2seproject3:debug>
  38.458 +            <customize>
  38.459 +                <arg line="${application.args}"/>
  38.460 +            </customize>
  38.461 +        </j2seproject3:debug>
  38.462 +    </target>
  38.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  38.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  38.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  38.466 +    </target>
  38.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  38.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  38.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  38.470 +        <j2seproject3:debug classname="${debug.class}"/>
  38.471 +    </target>
  38.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  38.473 +    <target depends="init" name="-pre-debug-fix">
  38.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  38.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  38.476 +    </target>
  38.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  38.478 +        <j2seproject1:nbjpdareload/>
  38.479 +    </target>
  38.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  38.481 +    <!--
  38.482 +                ===============
  38.483 +                JAVADOC SECTION
  38.484 +                ===============
  38.485 +            -->
  38.486 +    <target depends="init" name="-javadoc-build">
  38.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  38.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  38.489 +            <classpath>
  38.490 +                <path path="${javac.classpath}"/>
  38.491 +            </classpath>
  38.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  38.493 +                <filename name="**/*.java"/>
  38.494 +            </fileset>
  38.495 +        </javadoc>
  38.496 +    </target>
  38.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  38.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  38.499 +    </target>
  38.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  38.501 +    <!--
  38.502 +                =========================
  38.503 +                JUNIT COMPILATION SECTION
  38.504 +                =========================
  38.505 +            -->
  38.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  38.507 +        <mkdir dir="${build.test.classes.dir}"/>
  38.508 +    </target>
  38.509 +    <target name="-pre-compile-test">
  38.510 +        <!-- Empty placeholder for easier customization. -->
  38.511 +        <!-- You can override this target in the ../build.xml file. -->
  38.512 +    </target>
  38.513 +    <target if="do.depend.true" name="-compile-test-depend">
  38.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  38.515 +    </target>
  38.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  38.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  38.518 +        <copy todir="${build.test.classes.dir}">
  38.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.520 +        </copy>
  38.521 +    </target>
  38.522 +    <target name="-post-compile-test">
  38.523 +        <!-- Empty placeholder for easier customization. -->
  38.524 +        <!-- You can override this target in the ../build.xml file. -->
  38.525 +    </target>
  38.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  38.527 +    <target name="-pre-compile-test-single">
  38.528 +        <!-- Empty placeholder for easier customization. -->
  38.529 +        <!-- You can override this target in the ../build.xml file. -->
  38.530 +    </target>
  38.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  38.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  38.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  38.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  38.535 +        <copy todir="${build.test.classes.dir}">
  38.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.537 +        </copy>
  38.538 +    </target>
  38.539 +    <target name="-post-compile-test-single">
  38.540 +        <!-- Empty placeholder for easier customization. -->
  38.541 +        <!-- You can override this target in the ../build.xml file. -->
  38.542 +    </target>
  38.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  38.544 +    <!--
  38.545 +                =======================
  38.546 +                JUNIT EXECUTION SECTION
  38.547 +                =======================
  38.548 +            -->
  38.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  38.550 +        <mkdir dir="${build.test.results.dir}"/>
  38.551 +    </target>
  38.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  38.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  38.554 +    </target>
  38.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  38.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  38.557 +    </target>
  38.558 +    <target depends="init" if="have.tests" name="test-report"/>
  38.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  38.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  38.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  38.562 +        <mkdir dir="${build.test.results.dir}"/>
  38.563 +    </target>
  38.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  38.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  38.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  38.567 +    </target>
  38.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  38.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  38.570 +    </target>
  38.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  38.572 +    <!--
  38.573 +                =======================
  38.574 +                JUNIT DEBUGGING SECTION
  38.575 +                =======================
  38.576 +            -->
  38.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  38.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  38.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  38.580 +        <delete file="${test.report.file}"/>
  38.581 +        <mkdir dir="${build.test.results.dir}"/>
  38.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  38.583 +            <customize>
  38.584 +                <syspropertyset>
  38.585 +                    <propertyref prefix="test-sys-prop."/>
  38.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  38.587 +                </syspropertyset>
  38.588 +                <arg value="${test.class}"/>
  38.589 +                <arg value="showoutput=true"/>
  38.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  38.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  38.592 +            </customize>
  38.593 +        </j2seproject3:debug>
  38.594 +    </target>
  38.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  38.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  38.597 +    </target>
  38.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  38.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  38.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  38.601 +    </target>
  38.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  38.603 +    <!--
  38.604 +                =========================
  38.605 +                APPLET EXECUTION SECTION
  38.606 +                =========================
  38.607 +            -->
  38.608 +    <target depends="init,compile-single" name="run-applet">
  38.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  38.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  38.611 +            <customize>
  38.612 +                <arg value="${applet.url}"/>
  38.613 +            </customize>
  38.614 +        </j2seproject1:java>
  38.615 +    </target>
  38.616 +    <!--
  38.617 +                =========================
  38.618 +                APPLET DEBUGGING  SECTION
  38.619 +                =========================
  38.620 +            -->
  38.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  38.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  38.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  38.624 +            <customize>
  38.625 +                <arg value="${applet.url}"/>
  38.626 +            </customize>
  38.627 +        </j2seproject3:debug>
  38.628 +    </target>
  38.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  38.630 +    <!--
  38.631 +                ===============
  38.632 +                CLEANUP SECTION
  38.633 +                ===============
  38.634 +            -->
  38.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  38.636 +    <target depends="init" name="-do-clean">
  38.637 +        <delete dir="${build.dir}"/>
  38.638 +        <delete dir="${dist.dir}"/>
  38.639 +    </target>
  38.640 +    <target name="-post-clean">
  38.641 +        <!-- Empty placeholder for easier customization. -->
  38.642 +        <!-- You can override this target in the ../build.xml file. -->
  38.643 +    </target>
  38.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  38.645 +</project>
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/task1/solution03/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    39.3 @@ -0,0 +1,8 @@
    39.4 +build.xml.data.CRC32=2ab820eb
    39.5 +build.xml.script.CRC32=58a52595
    39.6 +build.xml.stylesheet.CRC32=be360661
    39.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    39.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    39.9 +nbproject/build-impl.xml.data.CRC32=ec91bd4b
   39.10 +nbproject/build-impl.xml.script.CRC32=593428f7
   39.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/task1/solution03/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    40.3 @@ -0,0 +1,68 @@
    40.4 +application.title=currency
    40.5 +application.vendor=apidesign.org
    40.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    40.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    40.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    40.9 +build.classes.dir=${build.dir}/classes
   40.10 +build.classes.excludes=**/*.java,**/*.form
   40.11 +# This directory is removed when the project is cleaned:
   40.12 +build.dir=build
   40.13 +build.generated.dir=${build.dir}/generated
   40.14 +# Only compile against the classpath explicitly listed here:
   40.15 +build.sysclasspath=ignore
   40.16 +build.test.classes.dir=${build.dir}/test/classes
   40.17 +build.test.results.dir=${build.dir}/test/results
   40.18 +debug.classpath=\
   40.19 +    ${run.classpath}
   40.20 +debug.test.classpath=\
   40.21 +    ${run.test.classpath}
   40.22 +# This directory is removed when the project is cleaned:
   40.23 +dist.dir=dist
   40.24 +dist.jar=${dist.dir}/currency.jar
   40.25 +dist.javadoc.dir=${dist.dir}/javadoc
   40.26 +excludes=
   40.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   40.28 +file.reference.src-apifest08=..
   40.29 +includes=**
   40.30 +jar.compress=false
   40.31 +javac.classpath=
   40.32 +# Space-separated list of extra javac options
   40.33 +javac.compilerargs=
   40.34 +javac.deprecation=false
   40.35 +javac.source=1.5
   40.36 +javac.target=1.5
   40.37 +javac.test.classpath=\
   40.38 +    ${javac.classpath}:\
   40.39 +    ${build.classes.dir}:\
   40.40 +    ${file.reference.junit-4.4.jar}
   40.41 +javadoc.additionalparam=
   40.42 +javadoc.author=false
   40.43 +javadoc.encoding=
   40.44 +javadoc.noindex=false
   40.45 +javadoc.nonavbar=false
   40.46 +javadoc.notree=false
   40.47 +javadoc.private=false
   40.48 +javadoc.splitindex=true
   40.49 +javadoc.use=true
   40.50 +javadoc.version=false
   40.51 +javadoc.windowtitle=
   40.52 +jnlp.codebase.type=local
   40.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   40.54 +jnlp.descriptor=application
   40.55 +jnlp.enabled=false
   40.56 +jnlp.offline-allowed=false
   40.57 +jnlp.signed=false
   40.58 +meta.inf.dir=${src.dir}/META-INF
   40.59 +platform.active=default_platform
   40.60 +run.classpath=\
   40.61 +    ${javac.classpath}:\
   40.62 +    ${build.classes.dir}
   40.63 +# Space-separated list of JVM arguments used when running the project
   40.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   40.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   40.66 +run.jvmargs=
   40.67 +run.test.classpath=\
   40.68 +    ${javac.test.classpath}:\
   40.69 +    ${build.test.classes.dir}
   40.70 +src.dir=src
   40.71 +test.src.dir=test
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/task1/solution03/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    41.3 @@ -0,0 +1,16 @@
    41.4 +<?xml version="1.0" encoding="UTF-8"?>
    41.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    41.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    41.7 +    <configuration>
    41.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    41.9 +            <name>Currency Convertor Solution 03</name>
   41.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   41.11 +            <source-roots>
   41.12 +                <root id="src.dir"/>
   41.13 +            </source-roots>
   41.14 +            <test-roots>
   41.15 +                <root id="test.src.dir"/>
   41.16 +            </test-roots>
   41.17 +        </data>
   41.18 +    </configuration>
   41.19 +</project>
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/task1/solution03/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    42.3 @@ -0,0 +1,41 @@
    42.4 +package org.apidesign.apifest08.currency;
    42.5 +
    42.6 +/** This is the skeleton class for your API. You need to make it public, so
    42.7 + * it is accessible to your client code (currently in Task1Test.java) file.
    42.8 + * <p>
    42.9 + * Feel free to create additional classes or rename this one, just keep all
   42.10 + * the API and its implementation in this package. Do not spread it outside
   42.11 + * to other packages.
   42.12 + */
   42.13 +public class Convertor {
   42.14 +
   42.15 +    public static final int FIRST_TO_SECOND = 1;
   42.16 +
   42.17 +    public static final int SECOND_TO_FIRST = 2;
   42.18 +
   42.19 +    private double first;
   42.20 +
   42.21 +    private double second;
   42.22 +
   42.23 +    public Convertor(double first, double second) {
   42.24 +        this.first = first;
   42.25 +        this.second = second;
   42.26 +    }
   42.27 +
   42.28 +    public double convertFirstToSecond(double value) {
   42.29 +        return (second / first) * value;
   42.30 +    }
   42.31 +
   42.32 +    public double convertSecondToFirst(double value) {
   42.33 +        return (first / second) * value;
   42.34 +    }
   42.35 +
   42.36 +    public double convert(double value, int typeOfConvert) {
   42.37 +        if (FIRST_TO_SECOND == typeOfConvert) {
   42.38 +            return convertFirstToSecond(value);
   42.39 +        } else if (SECOND_TO_FIRST == typeOfConvert) {
   42.40 +            return convertSecondToFirst(value);
   42.41 +        }
   42.42 +        throw new IllegalArgumentException("Unkown type of convert.");
   42.43 +    }
   42.44 +}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/task1/solution03/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    43.3 @@ -0,0 +1,82 @@
    43.4 +package org.apidesign.apifest08.test;
    43.5 +
    43.6 +import junit.framework.TestCase;
    43.7 +import org.apidesign.apifest08.currency.Convertor;
    43.8 +
    43.9 +/** Finish the Convertor API, and then write bodies of methods inside
   43.10 + * of this class to match the given tasks. To fullfil your task, use the
   43.11 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   43.12 + * Do not you reflection, or other hacks as your code
   43.13 + * shall run without any runtime permissions.
   43.14 + */
   43.15 +public class Task1Test extends TestCase {
   43.16 +
   43.17 +    public Task1Test(String testName) {
   43.18 +        super(testName);
   43.19 +    }
   43.20 +
   43.21 +    @Override
   43.22 +    protected void setUp() throws Exception {
   43.23 +    }
   43.24 +
   43.25 +    @Override
   43.26 +    protected void tearDown() throws Exception {
   43.27 +    }
   43.28 +
   43.29 +    /** Create convertor that understands two currencies, CZK and
   43.30 +     *  USD. Make 1 USD == 17 CZK.
   43.31 +     *
   43.32 +     * Creation of the convertor shall not require subclassing of any class
   43.33 +     * or interface on the client side.
   43.34 +     *
   43.35 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   43.36 +     */
   43.37 +    public static Convertor createCZKtoUSD() {
   43.38 +        return new Convertor(17, 1);
   43.39 +    }
   43.40 +
   43.41 +    /** Create convertor that understands two currencies, CZK and
   43.42 +     *  SKK. Make 100 SKK == 80 CZK.
   43.43 +     *
   43.44 +     * Creation of the convertor shall not require subclassing of any class
   43.45 +     * or interface on the client side.
   43.46 +     * 
   43.47 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   43.48 +     */
   43.49 +    public static Convertor createSKKtoCZK() {
   43.50 +        return new Convertor(100, 80);
   43.51 +    }
   43.52 +
   43.53 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   43.54 +     * with it.
   43.55 +     */
   43.56 +    public void testCurrencyCZKUSD() throws Exception {
   43.57 +        Convertor c = createCZKtoUSD();
   43.58 +        // convert $5 to CZK using c:
   43.59 +        // assertEquals("Result is 85 CZK");
   43.60 +        assertEquals(c.convert(5, Convertor.SECOND_TO_FIRST), (double) 85);
   43.61 +
   43.62 +        // convert $8 to CZK
   43.63 +        // assertEquals("Result is 136 CZK");
   43.64 +        assertEquals(c.convert(8, Convertor.SECOND_TO_FIRST), (double) 136);
   43.65 +
   43.66 +        // convert 1003CZK to USD
   43.67 +        // assertEquals("Result is 59 USD");
   43.68 +        assertEquals(c.convert(1003, Convertor.FIRST_TO_SECOND), (double) 59);
   43.69 +    }
   43.70 +
   43.71 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   43.72 +     * with it.
   43.73 +     */
   43.74 +    public void testCurrencySKKCZK() throws Exception {
   43.75 +        Convertor c = createSKKtoCZK();
   43.76 +        // convert 16CZK using c:
   43.77 +        // assertEquals("Result is 20 SKK");
   43.78 +        assertEquals(c.convert(16, Convertor.SECOND_TO_FIRST), (double) 20);
   43.79 +
   43.80 +        // convert 500SKK to CZK
   43.81 +        // assertEquals("Result is 400 CZK");
   43.82 +        assertEquals(c.convert(500, Convertor.FIRST_TO_SECOND), (double) 400);
   43.83 +    }
   43.84 +}
   43.85 +
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/task1/solution04/build.xml	Sun Sep 28 14:12:38 2008 +0200
    44.3 @@ -0,0 +1,69 @@
    44.4 +<?xml version="1.0" encoding="UTF-8"?>
    44.5 +<!-- You may freely edit this file. See commented blocks below for -->
    44.6 +<!-- some examples of how to customize the build. -->
    44.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    44.8 +<project name="currency" default="default" basedir=".">
    44.9 +    <description>Builds, tests, and runs the project.</description>
   44.10 +    <import file="nbproject/build-impl.xml"/>
   44.11 +    <!--
   44.12 +
   44.13 +    There exist several targets which are by default empty and which can be 
   44.14 +    used for execution of your tasks. These targets are usually executed 
   44.15 +    before and after some main targets. They are: 
   44.16 +
   44.17 +      -pre-init:                 called before initialization of project properties
   44.18 +      -post-init:                called after initialization of project properties
   44.19 +      -pre-compile:              called before javac compilation
   44.20 +      -post-compile:             called after javac compilation
   44.21 +      -pre-compile-single:       called before javac compilation of single file
   44.22 +      -post-compile-single:      called after javac compilation of single file
   44.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   44.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   44.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   44.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   44.27 +      -pre-jar:                  called before JAR building
   44.28 +      -post-jar:                 called after JAR building
   44.29 +      -post-clean:               called after cleaning build products
   44.30 +
   44.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   44.32 +
   44.33 +    Example of inserting an obfuscator after compilation could look like this:
   44.34 +
   44.35 +        <target name="-post-compile">
   44.36 +            <obfuscate>
   44.37 +                <fileset dir="${build.classes.dir}"/>
   44.38 +            </obfuscate>
   44.39 +        </target>
   44.40 +
   44.41 +    For list of available properties check the imported 
   44.42 +    nbproject/build-impl.xml file. 
   44.43 +
   44.44 +
   44.45 +    Another way to customize the build is by overriding existing main targets.
   44.46 +    The targets of interest are: 
   44.47 +
   44.48 +      -init-macrodef-javac:     defines macro for javac compilation
   44.49 +      -init-macrodef-junit:     defines macro for junit execution
   44.50 +      -init-macrodef-debug:     defines macro for class debugging
   44.51 +      -init-macrodef-java:      defines macro for class execution
   44.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   44.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   44.54 +      run:                      execution of project 
   44.55 +      -javadoc-build:           Javadoc generation
   44.56 +      test-report:              JUnit report generation
   44.57 +
   44.58 +    An example of overriding the target for project execution could look like this:
   44.59 +
   44.60 +        <target name="run" depends="currency-impl.jar">
   44.61 +            <exec dir="bin" executable="launcher.exe">
   44.62 +                <arg file="${dist.jar}"/>
   44.63 +            </exec>
   44.64 +        </target>
   44.65 +
   44.66 +    Notice that the overridden target depends on the jar target and not only on 
   44.67 +    the compile target as the regular run target does. Again, for a list of available 
   44.68 +    properties which you can use, check the target you are overriding in the
   44.69 +    nbproject/build-impl.xml file. 
   44.70 +
   44.71 +    -->
   44.72 +</project>
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/task1/solution04/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    45.3 @@ -0,0 +1,642 @@
    45.4 +<?xml version="1.0" encoding="UTF-8"?>
    45.5 +<!--
    45.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    45.7 +***         EDIT ../build.xml INSTEAD         ***
    45.8 +
    45.9 +For the purpose of easier reading the script
   45.10 +is divided into following sections:
   45.11 +
   45.12 +  - initialization
   45.13 +  - compilation
   45.14 +  - jar
   45.15 +  - execution
   45.16 +  - debugging
   45.17 +  - javadoc
   45.18 +  - junit compilation
   45.19 +  - junit execution
   45.20 +  - junit debugging
   45.21 +  - applet
   45.22 +  - cleanup
   45.23 +
   45.24 +        -->
   45.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_04-impl">
   45.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   45.27 +    <!-- 
   45.28 +                ======================
   45.29 +                INITIALIZATION SECTION 
   45.30 +                ======================
   45.31 +            -->
   45.32 +    <target name="-pre-init">
   45.33 +        <!-- Empty placeholder for easier customization. -->
   45.34 +        <!-- You can override this target in the ../build.xml file. -->
   45.35 +    </target>
   45.36 +    <target depends="-pre-init" name="-init-private">
   45.37 +        <property file="nbproject/private/config.properties"/>
   45.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   45.39 +        <property file="nbproject/private/private.properties"/>
   45.40 +    </target>
   45.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   45.42 +        <property file="${user.properties.file}"/>
   45.43 +        <!-- The two properties below are usually overridden -->
   45.44 +        <!-- by the active platform. Just a fallback. -->
   45.45 +        <property name="default.javac.source" value="1.4"/>
   45.46 +        <property name="default.javac.target" value="1.4"/>
   45.47 +    </target>
   45.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   45.49 +        <property file="nbproject/configs/${config}.properties"/>
   45.50 +        <property file="nbproject/project.properties"/>
   45.51 +    </target>
   45.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   45.53 +        <available file="${manifest.file}" property="manifest.available"/>
   45.54 +        <condition property="manifest.available+main.class">
   45.55 +            <and>
   45.56 +                <isset property="manifest.available"/>
   45.57 +                <isset property="main.class"/>
   45.58 +                <not>
   45.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   45.60 +                </not>
   45.61 +            </and>
   45.62 +        </condition>
   45.63 +        <condition property="manifest.available+main.class+mkdist.available">
   45.64 +            <and>
   45.65 +                <istrue value="${manifest.available+main.class}"/>
   45.66 +                <isset property="libs.CopyLibs.classpath"/>
   45.67 +            </and>
   45.68 +        </condition>
   45.69 +        <condition property="have.tests">
   45.70 +            <or>
   45.71 +                <available file="${test.src.dir}"/>
   45.72 +            </or>
   45.73 +        </condition>
   45.74 +        <condition property="have.sources">
   45.75 +            <or>
   45.76 +                <available file="${src.dir}"/>
   45.77 +            </or>
   45.78 +        </condition>
   45.79 +        <condition property="netbeans.home+have.tests">
   45.80 +            <and>
   45.81 +                <isset property="netbeans.home"/>
   45.82 +                <isset property="have.tests"/>
   45.83 +            </and>
   45.84 +        </condition>
   45.85 +        <condition property="no.javadoc.preview">
   45.86 +            <and>
   45.87 +                <isset property="javadoc.preview"/>
   45.88 +                <isfalse value="${javadoc.preview}"/>
   45.89 +            </and>
   45.90 +        </condition>
   45.91 +        <property name="run.jvmargs" value=""/>
   45.92 +        <property name="javac.compilerargs" value=""/>
   45.93 +        <property name="work.dir" value="${basedir}"/>
   45.94 +        <condition property="no.deps">
   45.95 +            <and>
   45.96 +                <istrue value="${no.dependencies}"/>
   45.97 +            </and>
   45.98 +        </condition>
   45.99 +        <property name="javac.debug" value="true"/>
  45.100 +        <property name="javadoc.preview" value="true"/>
  45.101 +        <property name="application.args" value=""/>
  45.102 +        <property name="source.encoding" value="${file.encoding}"/>
  45.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  45.104 +            <and>
  45.105 +                <isset property="javadoc.encoding"/>
  45.106 +                <not>
  45.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  45.108 +                </not>
  45.109 +            </and>
  45.110 +        </condition>
  45.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  45.112 +        <property name="includes" value="**"/>
  45.113 +        <property name="excludes" value=""/>
  45.114 +        <property name="do.depend" value="false"/>
  45.115 +        <condition property="do.depend.true">
  45.116 +            <istrue value="${do.depend}"/>
  45.117 +        </condition>
  45.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  45.119 +            <and>
  45.120 +                <isset property="jaxws.endorsed.dir"/>
  45.121 +                <available file="nbproject/jaxws-build.xml"/>
  45.122 +            </and>
  45.123 +        </condition>
  45.124 +    </target>
  45.125 +    <target name="-post-init">
  45.126 +        <!-- Empty placeholder for easier customization. -->
  45.127 +        <!-- You can override this target in the ../build.xml file. -->
  45.128 +    </target>
  45.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  45.130 +        <fail unless="src.dir">Must set src.dir</fail>
  45.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  45.132 +        <fail unless="build.dir">Must set build.dir</fail>
  45.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  45.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  45.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  45.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  45.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  45.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  45.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  45.140 +    </target>
  45.141 +    <target name="-init-macrodef-property">
  45.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.143 +            <attribute name="name"/>
  45.144 +            <attribute name="value"/>
  45.145 +            <sequential>
  45.146 +                <property name="@{name}" value="${@{value}}"/>
  45.147 +            </sequential>
  45.148 +        </macrodef>
  45.149 +    </target>
  45.150 +    <target name="-init-macrodef-javac">
  45.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.152 +            <attribute default="${src.dir}" name="srcdir"/>
  45.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  45.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  45.155 +            <attribute default="${includes}" name="includes"/>
  45.156 +            <attribute default="${excludes}" name="excludes"/>
  45.157 +            <attribute default="${javac.debug}" name="debug"/>
  45.158 +            <attribute default="" name="sourcepath"/>
  45.159 +            <element name="customize" optional="true"/>
  45.160 +            <sequential>
  45.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  45.162 +                    <classpath>
  45.163 +                        <path path="@{classpath}"/>
  45.164 +                    </classpath>
  45.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  45.166 +                    <customize/>
  45.167 +                </javac>
  45.168 +            </sequential>
  45.169 +        </macrodef>
  45.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.171 +            <attribute default="${src.dir}" name="srcdir"/>
  45.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  45.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  45.174 +            <sequential>
  45.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  45.176 +                    <classpath>
  45.177 +                        <path path="@{classpath}"/>
  45.178 +                    </classpath>
  45.179 +                </depend>
  45.180 +            </sequential>
  45.181 +        </macrodef>
  45.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  45.184 +            <sequential>
  45.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  45.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  45.187 +                    <path>
  45.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  45.189 +                    </path>
  45.190 +                    <globmapper from="*.java" to="*.class"/>
  45.191 +                </pathconvert>
  45.192 +                <delete>
  45.193 +                    <files includes="${javac.includes.binary}"/>
  45.194 +                </delete>
  45.195 +            </sequential>
  45.196 +        </macrodef>
  45.197 +    </target>
  45.198 +    <target name="-init-macrodef-junit">
  45.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.200 +            <attribute default="${includes}" name="includes"/>
  45.201 +            <attribute default="${excludes}" name="excludes"/>
  45.202 +            <attribute default="**" name="testincludes"/>
  45.203 +            <sequential>
  45.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  45.205 +                    <batchtest todir="${build.test.results.dir}">
  45.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  45.207 +                            <filename name="@{testincludes}"/>
  45.208 +                        </fileset>
  45.209 +                    </batchtest>
  45.210 +                    <classpath>
  45.211 +                        <path path="${run.test.classpath}"/>
  45.212 +                    </classpath>
  45.213 +                    <syspropertyset>
  45.214 +                        <propertyref prefix="test-sys-prop."/>
  45.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  45.216 +                    </syspropertyset>
  45.217 +                    <formatter type="brief" usefile="false"/>
  45.218 +                    <formatter type="xml"/>
  45.219 +                    <jvmarg line="${run.jvmargs}"/>
  45.220 +                </junit>
  45.221 +            </sequential>
  45.222 +        </macrodef>
  45.223 +    </target>
  45.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  45.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.226 +            <attribute default="${main.class}" name="name"/>
  45.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  45.228 +            <attribute default="" name="stopclassname"/>
  45.229 +            <sequential>
  45.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  45.231 +                    <classpath>
  45.232 +                        <path path="@{classpath}"/>
  45.233 +                    </classpath>
  45.234 +                </nbjpdastart>
  45.235 +            </sequential>
  45.236 +        </macrodef>
  45.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  45.239 +            <sequential>
  45.240 +                <nbjpdareload>
  45.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  45.242 +                        <include name="${fix.includes}*.class"/>
  45.243 +                    </fileset>
  45.244 +                </nbjpdareload>
  45.245 +            </sequential>
  45.246 +        </macrodef>
  45.247 +    </target>
  45.248 +    <target name="-init-debug-args">
  45.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  45.250 +        <condition property="have-jdk-older-than-1.4">
  45.251 +            <or>
  45.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  45.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  45.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  45.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  45.256 +            </or>
  45.257 +        </condition>
  45.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  45.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  45.260 +        </condition>
  45.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  45.262 +            <os family="windows"/>
  45.263 +        </condition>
  45.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  45.265 +            <isset property="debug.transport"/>
  45.266 +        </condition>
  45.267 +    </target>
  45.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  45.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.270 +            <attribute default="${main.class}" name="classname"/>
  45.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  45.272 +            <element name="customize" optional="true"/>
  45.273 +            <sequential>
  45.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  45.275 +                    <jvmarg line="${debug-args-line}"/>
  45.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  45.277 +                    <jvmarg line="${run.jvmargs}"/>
  45.278 +                    <classpath>
  45.279 +                        <path path="@{classpath}"/>
  45.280 +                    </classpath>
  45.281 +                    <syspropertyset>
  45.282 +                        <propertyref prefix="run-sys-prop."/>
  45.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  45.284 +                    </syspropertyset>
  45.285 +                    <customize/>
  45.286 +                </java>
  45.287 +            </sequential>
  45.288 +        </macrodef>
  45.289 +    </target>
  45.290 +    <target name="-init-macrodef-java">
  45.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.292 +            <attribute default="${main.class}" name="classname"/>
  45.293 +            <element name="customize" optional="true"/>
  45.294 +            <sequential>
  45.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  45.296 +                    <jvmarg line="${run.jvmargs}"/>
  45.297 +                    <classpath>
  45.298 +                        <path path="${run.classpath}"/>
  45.299 +                    </classpath>
  45.300 +                    <syspropertyset>
  45.301 +                        <propertyref prefix="run-sys-prop."/>
  45.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  45.303 +                    </syspropertyset>
  45.304 +                    <customize/>
  45.305 +                </java>
  45.306 +            </sequential>
  45.307 +        </macrodef>
  45.308 +    </target>
  45.309 +    <target name="-init-presetdef-jar">
  45.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  45.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  45.313 +            </jar>
  45.314 +        </presetdef>
  45.315 +    </target>
  45.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  45.317 +    <!--
  45.318 +                ===================
  45.319 +                COMPILATION SECTION
  45.320 +                ===================
  45.321 +            -->
  45.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  45.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  45.324 +    <target depends="init" name="-check-automatic-build">
  45.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  45.326 +    </target>
  45.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  45.328 +        <antcall target="clean"/>
  45.329 +    </target>
  45.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  45.331 +        <mkdir dir="${build.classes.dir}"/>
  45.332 +    </target>
  45.333 +    <target name="-pre-compile">
  45.334 +        <!-- Empty placeholder for easier customization. -->
  45.335 +        <!-- You can override this target in the ../build.xml file. -->
  45.336 +    </target>
  45.337 +    <target if="do.depend.true" name="-compile-depend">
  45.338 +        <j2seproject3:depend/>
  45.339 +    </target>
  45.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  45.341 +        <j2seproject3:javac/>
  45.342 +        <copy todir="${build.classes.dir}">
  45.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.344 +        </copy>
  45.345 +    </target>
  45.346 +    <target name="-post-compile">
  45.347 +        <!-- Empty placeholder for easier customization. -->
  45.348 +        <!-- You can override this target in the ../build.xml file. -->
  45.349 +    </target>
  45.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  45.351 +    <target name="-pre-compile-single">
  45.352 +        <!-- Empty placeholder for easier customization. -->
  45.353 +        <!-- You can override this target in the ../build.xml file. -->
  45.354 +    </target>
  45.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  45.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  45.357 +        <j2seproject3:force-recompile/>
  45.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  45.359 +    </target>
  45.360 +    <target name="-post-compile-single">
  45.361 +        <!-- Empty placeholder for easier customization. -->
  45.362 +        <!-- You can override this target in the ../build.xml file. -->
  45.363 +    </target>
  45.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  45.365 +    <!--
  45.366 +                ====================
  45.367 +                JAR BUILDING SECTION
  45.368 +                ====================
  45.369 +            -->
  45.370 +    <target depends="init" name="-pre-pre-jar">
  45.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  45.372 +        <mkdir dir="${dist.jar.dir}"/>
  45.373 +    </target>
  45.374 +    <target name="-pre-jar">
  45.375 +        <!-- Empty placeholder for easier customization. -->
  45.376 +        <!-- You can override this target in the ../build.xml file. -->
  45.377 +    </target>
  45.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  45.379 +        <j2seproject1:jar/>
  45.380 +    </target>
  45.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  45.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  45.383 +    </target>
  45.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  45.385 +        <j2seproject1:jar manifest="${manifest.file}">
  45.386 +            <j2seproject1:manifest>
  45.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  45.388 +            </j2seproject1:manifest>
  45.389 +        </j2seproject1:jar>
  45.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  45.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  45.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  45.393 +        <pathconvert property="run.classpath.with.dist.jar">
  45.394 +            <path path="${run.classpath}"/>
  45.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  45.396 +        </pathconvert>
  45.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  45.398 +    </target>
  45.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  45.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  45.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  45.402 +            <path path="${run.classpath}"/>
  45.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  45.404 +        </pathconvert>
  45.405 +        <pathconvert pathsep=" " property="jar.classpath">
  45.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  45.407 +            <chainedmapper>
  45.408 +                <flattenmapper/>
  45.409 +                <globmapper from="*" to="lib/*"/>
  45.410 +            </chainedmapper>
  45.411 +        </pathconvert>
  45.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  45.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  45.414 +            <fileset dir="${build.classes.dir}"/>
  45.415 +            <manifest>
  45.416 +                <attribute name="Main-Class" value="${main.class}"/>
  45.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  45.418 +            </manifest>
  45.419 +        </copylibs>
  45.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  45.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  45.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  45.423 +    </target>
  45.424 +    <target name="-post-jar">
  45.425 +        <!-- Empty placeholder for easier customization. -->
  45.426 +        <!-- You can override this target in the ../build.xml file. -->
  45.427 +    </target>
  45.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  45.429 +    <!--
  45.430 +                =================
  45.431 +                EXECUTION SECTION
  45.432 +                =================
  45.433 +            -->
  45.434 +    <target depends="init,compile" description="Run a main class." name="run">
  45.435 +        <j2seproject1:java>
  45.436 +            <customize>
  45.437 +                <arg line="${application.args}"/>
  45.438 +            </customize>
  45.439 +        </j2seproject1:java>
  45.440 +    </target>
  45.441 +    <target name="-do-not-recompile">
  45.442 +        <property name="javac.includes.binary" value=""/>
  45.443 +    </target>
  45.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  45.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  45.446 +        <j2seproject1:java classname="${run.class}"/>
  45.447 +    </target>
  45.448 +    <!--
  45.449 +                =================
  45.450 +                DEBUGGING SECTION
  45.451 +                =================
  45.452 +            -->
  45.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  45.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  45.455 +    </target>
  45.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  45.457 +        <j2seproject3:debug>
  45.458 +            <customize>
  45.459 +                <arg line="${application.args}"/>
  45.460 +            </customize>
  45.461 +        </j2seproject3:debug>
  45.462 +    </target>
  45.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  45.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  45.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  45.466 +    </target>
  45.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  45.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  45.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  45.470 +        <j2seproject3:debug classname="${debug.class}"/>
  45.471 +    </target>
  45.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  45.473 +    <target depends="init" name="-pre-debug-fix">
  45.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  45.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  45.476 +    </target>
  45.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  45.478 +        <j2seproject1:nbjpdareload/>
  45.479 +    </target>
  45.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  45.481 +    <!--
  45.482 +                ===============
  45.483 +                JAVADOC SECTION
  45.484 +                ===============
  45.485 +            -->
  45.486 +    <target depends="init" name="-javadoc-build">
  45.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  45.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  45.489 +            <classpath>
  45.490 +                <path path="${javac.classpath}"/>
  45.491 +            </classpath>
  45.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  45.493 +                <filename name="**/*.java"/>
  45.494 +            </fileset>
  45.495 +        </javadoc>
  45.496 +    </target>
  45.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  45.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  45.499 +    </target>
  45.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  45.501 +    <!--
  45.502 +                =========================
  45.503 +                JUNIT COMPILATION SECTION
  45.504 +                =========================
  45.505 +            -->
  45.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  45.507 +        <mkdir dir="${build.test.classes.dir}"/>
  45.508 +    </target>
  45.509 +    <target name="-pre-compile-test">
  45.510 +        <!-- Empty placeholder for easier customization. -->
  45.511 +        <!-- You can override this target in the ../build.xml file. -->
  45.512 +    </target>
  45.513 +    <target if="do.depend.true" name="-compile-test-depend">
  45.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  45.515 +    </target>
  45.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  45.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  45.518 +        <copy todir="${build.test.classes.dir}">
  45.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.520 +        </copy>
  45.521 +    </target>
  45.522 +    <target name="-post-compile-test">
  45.523 +        <!-- Empty placeholder for easier customization. -->
  45.524 +        <!-- You can override this target in the ../build.xml file. -->
  45.525 +    </target>
  45.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  45.527 +    <target name="-pre-compile-test-single">
  45.528 +        <!-- Empty placeholder for easier customization. -->
  45.529 +        <!-- You can override this target in the ../build.xml file. -->
  45.530 +    </target>
  45.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  45.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  45.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  45.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  45.535 +        <copy todir="${build.test.classes.dir}">
  45.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.537 +        </copy>
  45.538 +    </target>
  45.539 +    <target name="-post-compile-test-single">
  45.540 +        <!-- Empty placeholder for easier customization. -->
  45.541 +        <!-- You can override this target in the ../build.xml file. -->
  45.542 +    </target>
  45.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  45.544 +    <!--
  45.545 +                =======================
  45.546 +                JUNIT EXECUTION SECTION
  45.547 +                =======================
  45.548 +            -->
  45.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  45.550 +        <mkdir dir="${build.test.results.dir}"/>
  45.551 +    </target>
  45.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  45.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  45.554 +    </target>
  45.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  45.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  45.557 +    </target>
  45.558 +    <target depends="init" if="have.tests" name="test-report"/>
  45.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  45.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  45.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  45.562 +        <mkdir dir="${build.test.results.dir}"/>
  45.563 +    </target>
  45.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  45.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  45.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  45.567 +    </target>
  45.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  45.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  45.570 +    </target>
  45.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  45.572 +    <!--
  45.573 +                =======================
  45.574 +                JUNIT DEBUGGING SECTION
  45.575 +                =======================
  45.576 +            -->
  45.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  45.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  45.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  45.580 +        <delete file="${test.report.file}"/>
  45.581 +        <mkdir dir="${build.test.results.dir}"/>
  45.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  45.583 +            <customize>
  45.584 +                <syspropertyset>
  45.585 +                    <propertyref prefix="test-sys-prop."/>
  45.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  45.587 +                </syspropertyset>
  45.588 +                <arg value="${test.class}"/>
  45.589 +                <arg value="showoutput=true"/>
  45.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  45.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  45.592 +            </customize>
  45.593 +        </j2seproject3:debug>
  45.594 +    </target>
  45.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  45.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  45.597 +    </target>
  45.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  45.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  45.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  45.601 +    </target>
  45.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  45.603 +    <!--
  45.604 +                =========================
  45.605 +                APPLET EXECUTION SECTION
  45.606 +                =========================
  45.607 +            -->
  45.608 +    <target depends="init,compile-single" name="run-applet">
  45.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  45.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  45.611 +            <customize>
  45.612 +                <arg value="${applet.url}"/>
  45.613 +            </customize>
  45.614 +        </j2seproject1:java>
  45.615 +    </target>
  45.616 +    <!--
  45.617 +                =========================
  45.618 +                APPLET DEBUGGING  SECTION
  45.619 +                =========================
  45.620 +            -->
  45.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  45.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  45.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  45.624 +            <customize>
  45.625 +                <arg value="${applet.url}"/>
  45.626 +            </customize>
  45.627 +        </j2seproject3:debug>
  45.628 +    </target>
  45.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  45.630 +    <!--
  45.631 +                ===============
  45.632 +                CLEANUP SECTION
  45.633 +                ===============
  45.634 +            -->
  45.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  45.636 +    <target depends="init" name="-do-clean">
  45.637 +        <delete dir="${build.dir}"/>
  45.638 +        <delete dir="${dist.dir}"/>
  45.639 +    </target>
  45.640 +    <target name="-post-clean">
  45.641 +        <!-- Empty placeholder for easier customization. -->
  45.642 +        <!-- You can override this target in the ../build.xml file. -->
  45.643 +    </target>
  45.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  45.645 +</project>
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/task1/solution04/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    46.3 @@ -0,0 +1,8 @@
    46.4 +build.xml.data.CRC32=2ab820eb
    46.5 +build.xml.script.CRC32=58a52595
    46.6 +build.xml.stylesheet.CRC32=be360661
    46.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    46.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    46.9 +nbproject/build-impl.xml.data.CRC32=2fbfa6ce
   46.10 +nbproject/build-impl.xml.script.CRC32=c521eea7
   46.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/task1/solution04/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    47.3 @@ -0,0 +1,68 @@
    47.4 +application.title=currency
    47.5 +application.vendor=apidesign.org
    47.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    47.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    47.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    47.9 +build.classes.dir=${build.dir}/classes
   47.10 +build.classes.excludes=**/*.java,**/*.form
   47.11 +# This directory is removed when the project is cleaned:
   47.12 +build.dir=build
   47.13 +build.generated.dir=${build.dir}/generated
   47.14 +# Only compile against the classpath explicitly listed here:
   47.15 +build.sysclasspath=ignore
   47.16 +build.test.classes.dir=${build.dir}/test/classes
   47.17 +build.test.results.dir=${build.dir}/test/results
   47.18 +debug.classpath=\
   47.19 +    ${run.classpath}
   47.20 +debug.test.classpath=\
   47.21 +    ${run.test.classpath}
   47.22 +# This directory is removed when the project is cleaned:
   47.23 +dist.dir=dist
   47.24 +dist.jar=${dist.dir}/currency.jar
   47.25 +dist.javadoc.dir=${dist.dir}/javadoc
   47.26 +excludes=
   47.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   47.28 +file.reference.src-apifest08=..
   47.29 +includes=**
   47.30 +jar.compress=false
   47.31 +javac.classpath=
   47.32 +# Space-separated list of extra javac options
   47.33 +javac.compilerargs=
   47.34 +javac.deprecation=false
   47.35 +javac.source=1.5
   47.36 +javac.target=1.5
   47.37 +javac.test.classpath=\
   47.38 +    ${javac.classpath}:\
   47.39 +    ${build.classes.dir}:\
   47.40 +    ${file.reference.junit-4.4.jar}
   47.41 +javadoc.additionalparam=
   47.42 +javadoc.author=false
   47.43 +javadoc.encoding=
   47.44 +javadoc.noindex=false
   47.45 +javadoc.nonavbar=false
   47.46 +javadoc.notree=false
   47.47 +javadoc.private=false
   47.48 +javadoc.splitindex=true
   47.49 +javadoc.use=true
   47.50 +javadoc.version=false
   47.51 +javadoc.windowtitle=
   47.52 +jnlp.codebase.type=local
   47.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   47.54 +jnlp.descriptor=application
   47.55 +jnlp.enabled=false
   47.56 +jnlp.offline-allowed=false
   47.57 +jnlp.signed=false
   47.58 +meta.inf.dir=${src.dir}/META-INF
   47.59 +platform.active=default_platform
   47.60 +run.classpath=\
   47.61 +    ${javac.classpath}:\
   47.62 +    ${build.classes.dir}
   47.63 +# Space-separated list of JVM arguments used when running the project
   47.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   47.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   47.66 +run.jvmargs=
   47.67 +run.test.classpath=\
   47.68 +    ${javac.test.classpath}:\
   47.69 +    ${build.test.classes.dir}
   47.70 +src.dir=src
   47.71 +test.src.dir=test
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/task1/solution04/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    48.3 @@ -0,0 +1,16 @@
    48.4 +<?xml version="1.0" encoding="UTF-8"?>
    48.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    48.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    48.7 +    <configuration>
    48.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    48.9 +            <name>Currency Convertor Solution 04</name>
   48.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   48.11 +            <source-roots>
   48.12 +                <root id="src.dir"/>
   48.13 +            </source-roots>
   48.14 +            <test-roots>
   48.15 +                <root id="test.src.dir"/>
   48.16 +            </test-roots>
   48.17 +        </data>
   48.18 +    </configuration>
   48.19 +</project>
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/task1/solution04/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    49.3 @@ -0,0 +1,105 @@
    49.4 +package org.apidesign.apifest08.currency;
    49.5 +
    49.6 +
    49.7 +import java.math.BigDecimal;
    49.8 +import java.math.MathContext;
    49.9 +import java.math.RoundingMode;
   49.10 +import java.util.Currency;
   49.11 +
   49.12 +
   49.13 +/**
   49.14 + * Convert between two currencies.
   49.15 + *
   49.16 + * @author D'Arcy Smith
   49.17 + * @version 1.0
   49.18 + */
   49.19 +public final class Convertor
   49.20 +{
   49.21 +    /**
   49.22 +     * The currency to cvonvert from.
   49.23 +     */
   49.24 +    private final Currency currencyA;
   49.25 +
   49.26 +    /**
   49.27 +     * The currency to cvonvert from.
   49.28 +     */
   49.29 +    private final Currency currencyB;
   49.30 +    
   49.31 +    /**
   49.32 +     * Constructs a convertor with the specified currencies.
   49.33 +     * 
   49.34 +     * @param a the currency to convert from.
   49.35 +     * @param b the currency to convert to.
   49.36 +     * @throws IllegalArgumentException if either a or b are null.
   49.37 +     */
   49.38 +    public Convertor(final Currency a,
   49.39 +                     final Currency b)
   49.40 +    {
   49.41 +        if(a == null)
   49.42 +        {
   49.43 +            throw new IllegalArgumentException("a cannot be null");
   49.44 +        }
   49.45 +
   49.46 +        if(b == null)
   49.47 +        {
   49.48 +            throw new IllegalArgumentException("a cannot be null");
   49.49 +        }
   49.50 +
   49.51 +        currencyA = a;
   49.52 +        currencyB = b;
   49.53 +    }
   49.54 +    
   49.55 +    /**
   49.56 +     * Convert from currency "b" to currency "a".
   49.57 +     * 
   49.58 +     * @param amount the amount to convert.
   49.59 +     * @return the converted amount.
   49.60 +     * @throws IllegalArgumentException if amount is null.
   49.61 +     */
   49.62 +    public BigDecimal convertFrom(final BigDecimal amount)
   49.63 +    {
   49.64 +        final BigDecimal aInUSD;
   49.65 +        final BigDecimal bInUSD;
   49.66 +        final BigDecimal temp;
   49.67 +        final BigDecimal result;
   49.68 +        
   49.69 +        if(amount == null)
   49.70 +        {
   49.71 +            throw new IllegalArgumentException("amount cannot be null");
   49.72 +        }
   49.73 +        
   49.74 +        aInUSD = CurrencyValues.getValue(currencyA);
   49.75 +        bInUSD = CurrencyValues.getValue(currencyB);
   49.76 +        temp   = amount.divide(bInUSD, MathContext.DECIMAL32);
   49.77 +        result = temp.multiply(aInUSD);
   49.78 +        
   49.79 +        return (result.setScale(2, RoundingMode.HALF_DOWN));
   49.80 +    }
   49.81 +    
   49.82 +    /**
   49.83 +     * Convert from currency "a" to currency "b".
   49.84 +     * 
   49.85 +     * @param amount the amount to convert.
   49.86 +     * @return the converted amount.
   49.87 +     * @throws IllegalArgumentException if amount is null.
   49.88 +     */
   49.89 +    public BigDecimal convertTo(final BigDecimal amount)
   49.90 +    {
   49.91 +        final BigDecimal aInUSD;
   49.92 +        final BigDecimal bInUSD;
   49.93 +        final BigDecimal temp;
   49.94 +        final BigDecimal result;
   49.95 +        
   49.96 +        if(amount == null)
   49.97 +        {
   49.98 +            throw new IllegalArgumentException("amount cannot be null");
   49.99 +        }
  49.100 +        
  49.101 +        aInUSD = CurrencyValues.getValue(currencyA);
  49.102 +        bInUSD = CurrencyValues.getValue(currencyB);
  49.103 +        temp      = amount.divide(aInUSD, MathContext.DECIMAL32);
  49.104 +        result = temp.multiply(bInUSD);
  49.105 +        
  49.106 +        return (result.setScale(2, RoundingMode.HALF_DOWN));
  49.107 +    }
  49.108 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/task1/solution04/src/org/apidesign/apifest08/currency/ConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    50.3 @@ -0,0 +1,95 @@
    50.4 +package org.apidesign.apifest08.currency;
    50.5 +
    50.6 +import java.lang.ref.WeakReference;
    50.7 +import java.util.Currency;
    50.8 +import java.util.Map;
    50.9 +import java.util.WeakHashMap;
   50.10 +
   50.11 +
   50.12 +/**
   50.13 + * Create convertors using a flyweight to reduce the number of repetative creations of the same convertor.
   50.14 + * 
   50.15 + * @author D'Arcy Smith
   50.16 + * @version 1.0
   50.17 + */
   50.18 +public final class ConvertorFactory
   50.19 +{
   50.20 +    /**
   50.21 +     * flyweight so that only one vestion of each converter is created at a time.
   50.22 +     */
   50.23 +    private final static Map<String, WeakReference<Convertor>> convertors;
   50.24 +    
   50.25 +    static
   50.26 +    {
   50.27 +        convertors = new WeakHashMap<String, WeakReference<Convertor>>();
   50.28 +    }
   50.29 +    
   50.30 +    /** 
   50.31 +     * Prevent accidental construction.
   50.32 +     */
   50.33 +    private ConvertorFactory()
   50.34 +    {        
   50.35 +    }
   50.36 +    
   50.37 +    /**
   50.38 +     * Get the convertor for the specified currencies.  The currency name format
   50.39 +     * must be acceptable to java.util.Currency.getInstance(String)
   50.40 +     * 
   50.41 +     * @param a the currency to convert from.
   50.42 +     * @param b the currency to convert to.
   50.43 +     * @return the convertor for the specified currencies.
   50.44 +     */
   50.45 +    public static Convertor getConvertor(final String a,
   50.46 +                                         final String b)
   50.47 +    {
   50.48 +        final Currency  currencyA;
   50.49 +        final Currency  currencyB;
   50.50 +        final Convertor convertor;
   50.51 +        
   50.52 +        currencyA = Currency.getInstance(a);
   50.53 +        currencyB = Currency.getInstance(b);        
   50.54 +        convertor = getConvertor(currencyA, currencyB);
   50.55 +        
   50.56 +        return (convertor);
   50.57 +    }
   50.58 +    
   50.59 +    /**
   50.60 +     * Get the convertor for the specified currencies.
   50.61 +     * 
   50.62 +     * @param a the currency to convert from.
   50.63 +     * @param b the currency to convert to.
   50.64 +     * @return the convertor for the specified currencies.
   50.65 +     */
   50.66 +    public static Convertor getConvertor(final Currency a,
   50.67 +                                         final Currency b)
   50.68 +    {
   50.69 +        final String key;        
   50.70 +        Convertor    convertor;
   50.71 +
   50.72 +        if(a == null)
   50.73 +        {
   50.74 +            throw new IllegalArgumentException("a cannot be null");
   50.75 +        }
   50.76 +
   50.77 +        if(b == null)
   50.78 +        {
   50.79 +            throw new IllegalArgumentException("b cannot be null");
   50.80 +        }
   50.81 +
   50.82 +        key = a.getCurrencyCode() + b.getCurrencyCode();
   50.83 +
   50.84 +        // make sure that we don't try to overwrite one
   50.85 +        synchronized(convertors)
   50.86 +        {
   50.87 +            if(!(convertors.containsKey(key)))
   50.88 +            {        
   50.89 +                convertor = new Convertor(a, b);
   50.90 +                convertors.put(key, new WeakReference(convertor));
   50.91 +            }
   50.92 +        }
   50.93 +
   50.94 +        convertor = convertors.get(key).get();
   50.95 +        
   50.96 +        return (convertor);
   50.97 +    }
   50.98 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/task1/solution04/src/org/apidesign/apifest08/currency/CurrencyValues.java	Sun Sep 28 14:12:38 2008 +0200
    51.3 @@ -0,0 +1,122 @@
    51.4 +package org.apidesign.apifest08.currency;
    51.5 +
    51.6 +
    51.7 +import java.math.BigDecimal;
    51.8 +import java.util.Currency;
    51.9 +import java.util.HashMap;
   51.10 +import java.util.Map;
   51.11 +import java.util.Timer;
   51.12 +import java.util.TimerTask;
   51.13 +
   51.14 +
   51.15 +/**
   51.16 + * Keeps track of the current value for each currency as USD.  
   51.17 + * 
   51.18 + * @author D'Arcy Smith
   51.19 + * @version 1.0
   51.20 + */
   51.21 +class CurrencyValues
   51.22 +{
   51.23 +    /**
   51.24 +     * The values expressed in USD.
   51.25 +     */
   51.26 +    private static Map<Currency, BigDecimal> values;
   51.27 +    
   51.28 +    /**
   51.29 +     * Update the values periodically
   51.30 +     */
   51.31 +    private static final Timer refresher;
   51.32 +
   51.33 +    static
   51.34 +    {
   51.35 +        final Refresher refresherTask;
   51.36 +        final long delay;
   51.37 +
   51.38 +        // load the map NOW! (don't use the scheduler to do it just because we want
   51.39 +        // to be 100% certain it is loaded before anything else can be called.
   51.40 +        refresh();
   51.41 +
   51.42 +        refresherTask = new Refresher();
   51.43 +        refresher = new Timer("CurrencyValues Refresher", true);
   51.44 +
   51.45 +        // update once an hour
   51.46 +        delay = 1000 * 60 * 60;
   51.47 +        refresher.scheduleAtFixedRate(refresherTask, delay, delay);
   51.48 +    }
   51.49 +    
   51.50 +    /**
   51.51 +     * Prevent accidental creation.
   51.52 +     */
   51.53 +    private CurrencyValues()
   51.54 +    {
   51.55 +    }
   51.56 +        
   51.57 +    /**
   51.58 +     * Refresh the currency values.
   51.59 +     */
   51.60 +    static void refresh()
   51.61 +    {
   51.62 +        Map<Currency, BigDecimal> newValues;    
   51.63 +        Currency                  currency;
   51.64 +        
   51.65 +        newValues = new HashMap<Currency, BigDecimal>();
   51.66 +
   51.67 +        // these would update from a data source, database, web service, something...
   51.68 +        currency = Currency.getInstance("USD");
   51.69 +        newValues.put(currency, BigDecimal.valueOf(1.0).setScale(2));
   51.70 +        
   51.71 +        currency = Currency.getInstance("CZK");
   51.72 +        newValues.put(currency, BigDecimal.valueOf(17.0));
   51.73 +        
   51.74 +        currency = Currency.getInstance("SKK");
   51.75 +        newValues.put(currency, BigDecimal.valueOf(21.25));
   51.76 +        
   51.77 +        // don't sycnhronize all of it because clients can use slightly out of
   51.78 +        // date information.
   51.79 +        synchronized(CurrencyValues.class)
   51.80 +        {
   51.81 +            values = newValues;
   51.82 +        }
   51.83 +    }
   51.84 +
   51.85 +    /**
   51.86 +     * Get the value of the specified currency in USD.
   51.87 +     * 
   51.88 +     * @param currency the corrency to get.
   51.89 +     * @return the value of the currency in USD.
   51.90 +     * @throws IllegalArgumentException if currency is null.
   51.91 +     */
   51.92 +    static BigDecimal getValue(final Currency currency)
   51.93 +    {
   51.94 +        final BigDecimal value;
   51.95 +
   51.96 +        if(currency == null)
   51.97 +        {
   51.98 +            throw new IllegalArgumentException("currencyName cannot be null");
   51.99 +        }
  51.100 +
  51.101 +        // make sure we are not updating the map right now
  51.102 +        synchronized(CurrencyValues.class)
  51.103 +        {
  51.104 +            value = values.get(currency);
  51.105 +        }
  51.106 +
  51.107 +        return (value);
  51.108 +    }
  51.109 +    
  51.110 +    /**
  51.111 +     * Used to update the currency map periodically.
  51.112 +     */
  51.113 +    private static class Refresher
  51.114 +        extends TimerTask
  51.115 +    {
  51.116 +        /**
  51.117 +         * call the refresh method.
  51.118 +         */
  51.119 +        @Override
  51.120 +        public void run() 
  51.121 +        {
  51.122 +            refresh();
  51.123 +        }
  51.124 +    }
  51.125 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/task1/solution04/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    52.3 @@ -0,0 +1,118 @@
    52.4 +package org.apidesign.apifest08.test;
    52.5 +
    52.6 +import java.math.BigDecimal;
    52.7 +import java.util.Currency;
    52.8 +import junit.framework.TestCase;
    52.9 +import org.apidesign.apifest08.currency.Convertor;
   52.10 +import org.apidesign.apifest08.currency.ConvertorFactory;
   52.11 +
   52.12 +/** Finish the Convertor API, and then write bodies of methods inside
   52.13 + * of this class to match the given tasks. To fullfil your task, use the
   52.14 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   52.15 + * Do not you reflection, or other hacks as your code
   52.16 + * shall run without any runtime permissions.
   52.17 + */
   52.18 +public class Task1Test extends TestCase {
   52.19 +    public Task1Test(String testName) {
   52.20 +        super(testName);
   52.21 +    }
   52.22 +
   52.23 +    @Override
   52.24 +    protected void setUp() throws Exception {
   52.25 +    }
   52.26 +
   52.27 +    @Override
   52.28 +    protected void tearDown() throws Exception {
   52.29 +    }
   52.30 +
   52.31 +    /** Create convertor that understands two currencies, CZK and
   52.32 +     *  USD. Make 1 USD == 17 CZK.
   52.33 +     *
   52.34 +     * Creation of the convertor shall not require subclassing of any class
   52.35 +     * or interface on the client side.
   52.36 +     *
   52.37 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   52.38 +     */
   52.39 +    public static Convertor createCZKtoUSD()
   52.40 +    {
   52.41 +        return (ConvertorFactory.getConvertor("CZK", "USD"));
   52.42 +    }
   52.43 +
   52.44 +    /** Create convertor that understands two currencies, CZK and
   52.45 +     *  SKK. Make 100 SKK == 80 CZK.
   52.46 +     *
   52.47 +     * Creation of the convertor shall not require subclassing of any class
   52.48 +     * or interface on the client side.
   52.49 +     * 
   52.50 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   52.51 +     */
   52.52 +    public static Convertor createSKKtoCZK()
   52.53 +    {
   52.54 +        return (ConvertorFactory.getConvertor(Currency.getInstance("SKK"), Currency.getInstance("CZK")));
   52.55 +    }
   52.56 +    
   52.57 +    public static Convertor createUSDtoUSD()
   52.58 +    {
   52.59 +        return (ConvertorFactory.getConvertor(Currency.getInstance("USD"), Currency.getInstance("USD")));
   52.60 +    }
   52.61 +    
   52.62 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   52.63 +     * with it.
   52.64 +     */
   52.65 +    public void testCurrencyCZKUSD() throws Exception {
   52.66 +        Convertor  c = createCZKtoUSD();
   52.67 +        BigDecimal result;
   52.68 +        
   52.69 +        // convert $5 to CZK using c:
   52.70 +        // assertEquals("Result is 85 CZK");
   52.71 +        result = c.convertFrom(BigDecimal.valueOf(5));
   52.72 +        assertEquals(new BigDecimal("85.00"), result);
   52.73 +
   52.74 +        // convert $8 to CZK
   52.75 +        // assertEquals("Result is 136 CZK");
   52.76 +        result = c.convertFrom(BigDecimal.valueOf(8));
   52.77 +        assertEquals(new BigDecimal("136.00"), result);
   52.78 +
   52.79 +        // convert 1003CZK to USD
   52.80 +        // assertEquals("Result is 59 USD");
   52.81 +        result = c.convertTo(BigDecimal.valueOf(1003));
   52.82 +        assertEquals(new BigDecimal("59.00"), result);
   52.83 +    }
   52.84 +
   52.85 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   52.86 +     * with it.
   52.87 +     */
   52.88 +    public void testCurrencySKKCZK() throws Exception {
   52.89 +        Convertor c = createSKKtoCZK();
   52.90 +        BigDecimal result;
   52.91 +        
   52.92 +        // convert 16CZK using c:
   52.93 +        // assertEquals("Result is 20 SKK");
   52.94 +        result = c.convertFrom(BigDecimal.valueOf(16));
   52.95 +        assertEquals(new BigDecimal("20.00"), result);
   52.96 +                        
   52.97 +        // convert 500SKK to CZK
   52.98 +        // assertEquals("Result is 400 CZK");
   52.99 +        result = c.convertTo(BigDecimal.valueOf(500));
  52.100 +        assertEquals(new BigDecimal("400.00"), result);
  52.101 +   }
  52.102 +
  52.103 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
  52.104 +     * with it.
  52.105 +     */
  52.106 +    public void testCurrencyUSDUSD() throws Exception {
  52.107 +        Convertor c = createUSDtoUSD();
  52.108 +        BigDecimal result;
  52.109 +        
  52.110 +        // convert 1USD using c:
  52.111 +        // assertEquals("Result is 1 USD");
  52.112 +        result = c.convertFrom(BigDecimal.valueOf(1));
  52.113 +        assertEquals(new BigDecimal("1.00"), result);
  52.114 +                        
  52.115 +        // convert 500USD to USD
  52.116 +        // assertEquals("Result is 500 USD");
  52.117 +        result = c.convertTo(BigDecimal.valueOf(500));
  52.118 +        assertEquals(new BigDecimal("500.00"), result);
  52.119 +   }
  52.120 +}
  52.121 +
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/task1/solution05/build.xml	Sun Sep 28 14:12:38 2008 +0200
    53.3 @@ -0,0 +1,69 @@
    53.4 +<?xml version="1.0" encoding="UTF-8"?>
    53.5 +<!-- You may freely edit this file. See commented blocks below for -->
    53.6 +<!-- some examples of how to customize the build. -->
    53.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    53.8 +<project name="currency" default="default" basedir=".">
    53.9 +    <description>Builds, tests, and runs the project.</description>
   53.10 +    <import file="nbproject/build-impl.xml"/>
   53.11 +    <!--
   53.12 +
   53.13 +    There exist several targets which are by default empty and which can be 
   53.14 +    used for execution of your tasks. These targets are usually executed 
   53.15 +    before and after some main targets. They are: 
   53.16 +
   53.17 +      -pre-init:                 called before initialization of project properties
   53.18 +      -post-init:                called after initialization of project properties
   53.19 +      -pre-compile:              called before javac compilation
   53.20 +      -post-compile:             called after javac compilation
   53.21 +      -pre-compile-single:       called before javac compilation of single file
   53.22 +      -post-compile-single:      called after javac compilation of single file
   53.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   53.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   53.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   53.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   53.27 +      -pre-jar:                  called before JAR building
   53.28 +      -post-jar:                 called after JAR building
   53.29 +      -post-clean:               called after cleaning build products
   53.30 +
   53.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   53.32 +
   53.33 +    Example of inserting an obfuscator after compilation could look like this:
   53.34 +
   53.35 +        <target name="-post-compile">
   53.36 +            <obfuscate>
   53.37 +                <fileset dir="${build.classes.dir}"/>
   53.38 +            </obfuscate>
   53.39 +        </target>
   53.40 +
   53.41 +    For list of available properties check the imported 
   53.42 +    nbproject/build-impl.xml file. 
   53.43 +
   53.44 +
   53.45 +    Another way to customize the build is by overriding existing main targets.
   53.46 +    The targets of interest are: 
   53.47 +
   53.48 +      -init-macrodef-javac:     defines macro for javac compilation
   53.49 +      -init-macrodef-junit:     defines macro for junit execution
   53.50 +      -init-macrodef-debug:     defines macro for class debugging
   53.51 +      -init-macrodef-java:      defines macro for class execution
   53.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   53.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   53.54 +      run:                      execution of project 
   53.55 +      -javadoc-build:           Javadoc generation
   53.56 +      test-report:              JUnit report generation
   53.57 +
   53.58 +    An example of overriding the target for project execution could look like this:
   53.59 +
   53.60 +        <target name="run" depends="currency-impl.jar">
   53.61 +            <exec dir="bin" executable="launcher.exe">
   53.62 +                <arg file="${dist.jar}"/>
   53.63 +            </exec>
   53.64 +        </target>
   53.65 +
   53.66 +    Notice that the overridden target depends on the jar target and not only on 
   53.67 +    the compile target as the regular run target does. Again, for a list of available 
   53.68 +    properties which you can use, check the target you are overriding in the
   53.69 +    nbproject/build-impl.xml file. 
   53.70 +
   53.71 +    -->
   53.72 +</project>
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/task1/solution05/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    54.3 @@ -0,0 +1,642 @@
    54.4 +<?xml version="1.0" encoding="UTF-8"?>
    54.5 +<!--
    54.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    54.7 +***         EDIT ../build.xml INSTEAD         ***
    54.8 +
    54.9 +For the purpose of easier reading the script
   54.10 +is divided into following sections:
   54.11 +
   54.12 +  - initialization
   54.13 +  - compilation
   54.14 +  - jar
   54.15 +  - execution
   54.16 +  - debugging
   54.17 +  - javadoc
   54.18 +  - junit compilation
   54.19 +  - junit execution
   54.20 +  - junit debugging
   54.21 +  - applet
   54.22 +  - cleanup
   54.23 +
   54.24 +        -->
   54.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_05-impl">
   54.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   54.27 +    <!-- 
   54.28 +                ======================
   54.29 +                INITIALIZATION SECTION 
   54.30 +                ======================
   54.31 +            -->
   54.32 +    <target name="-pre-init">
   54.33 +        <!-- Empty placeholder for easier customization. -->
   54.34 +        <!-- You can override this target in the ../build.xml file. -->
   54.35 +    </target>
   54.36 +    <target depends="-pre-init" name="-init-private">
   54.37 +        <property file="nbproject/private/config.properties"/>
   54.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   54.39 +        <property file="nbproject/private/private.properties"/>
   54.40 +    </target>
   54.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   54.42 +        <property file="${user.properties.file}"/>
   54.43 +        <!-- The two properties below are usually overridden -->
   54.44 +        <!-- by the active platform. Just a fallback. -->
   54.45 +        <property name="default.javac.source" value="1.4"/>
   54.46 +        <property name="default.javac.target" value="1.4"/>
   54.47 +    </target>
   54.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   54.49 +        <property file="nbproject/configs/${config}.properties"/>
   54.50 +        <property file="nbproject/project.properties"/>
   54.51 +    </target>
   54.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   54.53 +        <available file="${manifest.file}" property="manifest.available"/>
   54.54 +        <condition property="manifest.available+main.class">
   54.55 +            <and>
   54.56 +                <isset property="manifest.available"/>
   54.57 +                <isset property="main.class"/>
   54.58 +                <not>
   54.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   54.60 +                </not>
   54.61 +            </and>
   54.62 +        </condition>
   54.63 +        <condition property="manifest.available+main.class+mkdist.available">
   54.64 +            <and>
   54.65 +                <istrue value="${manifest.available+main.class}"/>
   54.66 +                <isset property="libs.CopyLibs.classpath"/>
   54.67 +            </and>
   54.68 +        </condition>
   54.69 +        <condition property="have.tests">
   54.70 +            <or>
   54.71 +                <available file="${test.src.dir}"/>
   54.72 +            </or>
   54.73 +        </condition>
   54.74 +        <condition property="have.sources">
   54.75 +            <or>
   54.76 +                <available file="${src.dir}"/>
   54.77 +            </or>
   54.78 +        </condition>
   54.79 +        <condition property="netbeans.home+have.tests">
   54.80 +            <and>
   54.81 +                <isset property="netbeans.home"/>
   54.82 +                <isset property="have.tests"/>
   54.83 +            </and>
   54.84 +        </condition>
   54.85 +        <condition property="no.javadoc.preview">
   54.86 +            <and>
   54.87 +                <isset property="javadoc.preview"/>
   54.88 +                <isfalse value="${javadoc.preview}"/>
   54.89 +            </and>
   54.90 +        </condition>
   54.91 +        <property name="run.jvmargs" value=""/>
   54.92 +        <property name="javac.compilerargs" value=""/>
   54.93 +        <property name="work.dir" value="${basedir}"/>
   54.94 +        <condition property="no.deps">
   54.95 +            <and>
   54.96 +                <istrue value="${no.dependencies}"/>
   54.97 +            </and>
   54.98 +        </condition>
   54.99 +        <property name="javac.debug" value="true"/>
  54.100 +        <property name="javadoc.preview" value="true"/>
  54.101 +        <property name="application.args" value=""/>
  54.102 +        <property name="source.encoding" value="${file.encoding}"/>
  54.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  54.104 +            <and>
  54.105 +                <isset property="javadoc.encoding"/>
  54.106 +                <not>
  54.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  54.108 +                </not>
  54.109 +            </and>
  54.110 +        </condition>
  54.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  54.112 +        <property name="includes" value="**"/>
  54.113 +        <property name="excludes" value=""/>
  54.114 +        <property name="do.depend" value="false"/>
  54.115 +        <condition property="do.depend.true">
  54.116 +            <istrue value="${do.depend}"/>
  54.117 +        </condition>
  54.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  54.119 +            <and>
  54.120 +                <isset property="jaxws.endorsed.dir"/>
  54.121 +                <available file="nbproject/jaxws-build.xml"/>
  54.122 +            </and>
  54.123 +        </condition>
  54.124 +    </target>
  54.125 +    <target name="-post-init">
  54.126 +        <!-- Empty placeholder for easier customization. -->
  54.127 +        <!-- You can override this target in the ../build.xml file. -->
  54.128 +    </target>
  54.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  54.130 +        <fail unless="src.dir">Must set src.dir</fail>
  54.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  54.132 +        <fail unless="build.dir">Must set build.dir</fail>
  54.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  54.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  54.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  54.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  54.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  54.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  54.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  54.140 +    </target>
  54.141 +    <target name="-init-macrodef-property">
  54.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.143 +            <attribute name="name"/>
  54.144 +            <attribute name="value"/>
  54.145 +            <sequential>
  54.146 +                <property name="@{name}" value="${@{value}}"/>
  54.147 +            </sequential>
  54.148 +        </macrodef>
  54.149 +    </target>
  54.150 +    <target name="-init-macrodef-javac">
  54.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.152 +            <attribute default="${src.dir}" name="srcdir"/>
  54.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  54.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  54.155 +            <attribute default="${includes}" name="includes"/>
  54.156 +            <attribute default="${excludes}" name="excludes"/>
  54.157 +            <attribute default="${javac.debug}" name="debug"/>
  54.158 +            <attribute default="" name="sourcepath"/>
  54.159 +            <element name="customize" optional="true"/>
  54.160 +            <sequential>
  54.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  54.162 +                    <classpath>
  54.163 +                        <path path="@{classpath}"/>
  54.164 +                    </classpath>
  54.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  54.166 +                    <customize/>
  54.167 +                </javac>
  54.168 +            </sequential>
  54.169 +        </macrodef>
  54.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.171 +            <attribute default="${src.dir}" name="srcdir"/>
  54.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  54.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  54.174 +            <sequential>
  54.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  54.176 +                    <classpath>
  54.177 +                        <path path="@{classpath}"/>
  54.178 +                    </classpath>
  54.179 +                </depend>
  54.180 +            </sequential>
  54.181 +        </macrodef>
  54.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  54.184 +            <sequential>
  54.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  54.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  54.187 +                    <path>
  54.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  54.189 +                    </path>
  54.190 +                    <globmapper from="*.java" to="*.class"/>
  54.191 +                </pathconvert>
  54.192 +                <delete>
  54.193 +                    <files includes="${javac.includes.binary}"/>
  54.194 +                </delete>
  54.195 +            </sequential>
  54.196 +        </macrodef>
  54.197 +    </target>
  54.198 +    <target name="-init-macrodef-junit">
  54.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.200 +            <attribute default="${includes}" name="includes"/>
  54.201 +            <attribute default="${excludes}" name="excludes"/>
  54.202 +            <attribute default="**" name="testincludes"/>
  54.203 +            <sequential>
  54.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  54.205 +                    <batchtest todir="${build.test.results.dir}">
  54.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  54.207 +                            <filename name="@{testincludes}"/>
  54.208 +                        </fileset>
  54.209 +                    </batchtest>
  54.210 +                    <classpath>
  54.211 +                        <path path="${run.test.classpath}"/>
  54.212 +                    </classpath>
  54.213 +                    <syspropertyset>
  54.214 +                        <propertyref prefix="test-sys-prop."/>
  54.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  54.216 +                    </syspropertyset>
  54.217 +                    <formatter type="brief" usefile="false"/>
  54.218 +                    <formatter type="xml"/>
  54.219 +                    <jvmarg line="${run.jvmargs}"/>
  54.220 +                </junit>
  54.221 +            </sequential>
  54.222 +        </macrodef>
  54.223 +    </target>
  54.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  54.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.226 +            <attribute default="${main.class}" name="name"/>
  54.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  54.228 +            <attribute default="" name="stopclassname"/>
  54.229 +            <sequential>
  54.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  54.231 +                    <classpath>
  54.232 +                        <path path="@{classpath}"/>
  54.233 +                    </classpath>
  54.234 +                </nbjpdastart>
  54.235 +            </sequential>
  54.236 +        </macrodef>
  54.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  54.239 +            <sequential>
  54.240 +                <nbjpdareload>
  54.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  54.242 +                        <include name="${fix.includes}*.class"/>
  54.243 +                    </fileset>
  54.244 +                </nbjpdareload>
  54.245 +            </sequential>
  54.246 +        </macrodef>
  54.247 +    </target>
  54.248 +    <target name="-init-debug-args">
  54.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  54.250 +        <condition property="have-jdk-older-than-1.4">
  54.251 +            <or>
  54.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  54.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  54.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  54.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  54.256 +            </or>
  54.257 +        </condition>
  54.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  54.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  54.260 +        </condition>
  54.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  54.262 +            <os family="windows"/>
  54.263 +        </condition>
  54.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  54.265 +            <isset property="debug.transport"/>
  54.266 +        </condition>
  54.267 +    </target>
  54.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  54.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.270 +            <attribute default="${main.class}" name="classname"/>
  54.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  54.272 +            <element name="customize" optional="true"/>
  54.273 +            <sequential>
  54.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  54.275 +                    <jvmarg line="${debug-args-line}"/>
  54.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  54.277 +                    <jvmarg line="${run.jvmargs}"/>
  54.278 +                    <classpath>
  54.279 +                        <path path="@{classpath}"/>
  54.280 +                    </classpath>
  54.281 +                    <syspropertyset>
  54.282 +                        <propertyref prefix="run-sys-prop."/>
  54.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  54.284 +                    </syspropertyset>
  54.285 +                    <customize/>
  54.286 +                </java>
  54.287 +            </sequential>
  54.288 +        </macrodef>
  54.289 +    </target>
  54.290 +    <target name="-init-macrodef-java">
  54.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.292 +            <attribute default="${main.class}" name="classname"/>
  54.293 +            <element name="customize" optional="true"/>
  54.294 +            <sequential>
  54.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  54.296 +                    <jvmarg line="${run.jvmargs}"/>
  54.297 +                    <classpath>
  54.298 +                        <path path="${run.classpath}"/>
  54.299 +                    </classpath>
  54.300 +                    <syspropertyset>
  54.301 +                        <propertyref prefix="run-sys-prop."/>
  54.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  54.303 +                    </syspropertyset>
  54.304 +                    <customize/>
  54.305 +                </java>
  54.306 +            </sequential>
  54.307 +        </macrodef>
  54.308 +    </target>
  54.309 +    <target name="-init-presetdef-jar">
  54.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  54.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  54.313 +            </jar>
  54.314 +        </presetdef>
  54.315 +    </target>
  54.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  54.317 +    <!--
  54.318 +                ===================
  54.319 +                COMPILATION SECTION
  54.320 +                ===================
  54.321 +            -->
  54.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  54.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  54.324 +    <target depends="init" name="-check-automatic-build">
  54.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  54.326 +    </target>
  54.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  54.328 +        <antcall target="clean"/>
  54.329 +    </target>
  54.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  54.331 +        <mkdir dir="${build.classes.dir}"/>
  54.332 +    </target>
  54.333 +    <target name="-pre-compile">
  54.334 +        <!-- Empty placeholder for easier customization. -->
  54.335 +        <!-- You can override this target in the ../build.xml file. -->
  54.336 +    </target>
  54.337 +    <target if="do.depend.true" name="-compile-depend">
  54.338 +        <j2seproject3:depend/>
  54.339 +    </target>
  54.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  54.341 +        <j2seproject3:javac/>
  54.342 +        <copy todir="${build.classes.dir}">
  54.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.344 +        </copy>
  54.345 +    </target>
  54.346 +    <target name="-post-compile">
  54.347 +        <!-- Empty placeholder for easier customization. -->
  54.348 +        <!-- You can override this target in the ../build.xml file. -->
  54.349 +    </target>
  54.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  54.351 +    <target name="-pre-compile-single">
  54.352 +        <!-- Empty placeholder for easier customization. -->
  54.353 +        <!-- You can override this target in the ../build.xml file. -->
  54.354 +    </target>
  54.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  54.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  54.357 +        <j2seproject3:force-recompile/>
  54.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  54.359 +    </target>
  54.360 +    <target name="-post-compile-single">
  54.361 +        <!-- Empty placeholder for easier customization. -->
  54.362 +        <!-- You can override this target in the ../build.xml file. -->
  54.363 +    </target>
  54.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  54.365 +    <!--
  54.366 +                ====================
  54.367 +                JAR BUILDING SECTION
  54.368 +                ====================
  54.369 +            -->
  54.370 +    <target depends="init" name="-pre-pre-jar">
  54.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  54.372 +        <mkdir dir="${dist.jar.dir}"/>
  54.373 +    </target>
  54.374 +    <target name="-pre-jar">
  54.375 +        <!-- Empty placeholder for easier customization. -->
  54.376 +        <!-- You can override this target in the ../build.xml file. -->
  54.377 +    </target>
  54.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  54.379 +        <j2seproject1:jar/>
  54.380 +    </target>
  54.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  54.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  54.383 +    </target>
  54.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  54.385 +        <j2seproject1:jar manifest="${manifest.file}">
  54.386 +            <j2seproject1:manifest>
  54.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  54.388 +            </j2seproject1:manifest>
  54.389 +        </j2seproject1:jar>
  54.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  54.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  54.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  54.393 +        <pathconvert property="run.classpath.with.dist.jar">
  54.394 +            <path path="${run.classpath}"/>
  54.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  54.396 +        </pathconvert>
  54.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  54.398 +    </target>
  54.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  54.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  54.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  54.402 +            <path path="${run.classpath}"/>
  54.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  54.404 +        </pathconvert>
  54.405 +        <pathconvert pathsep=" " property="jar.classpath">
  54.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  54.407 +            <chainedmapper>
  54.408 +                <flattenmapper/>
  54.409 +                <globmapper from="*" to="lib/*"/>
  54.410 +            </chainedmapper>
  54.411 +        </pathconvert>
  54.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  54.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  54.414 +            <fileset dir="${build.classes.dir}"/>
  54.415 +            <manifest>
  54.416 +                <attribute name="Main-Class" value="${main.class}"/>
  54.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  54.418 +            </manifest>
  54.419 +        </copylibs>
  54.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  54.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  54.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  54.423 +    </target>
  54.424 +    <target name="-post-jar">
  54.425 +        <!-- Empty placeholder for easier customization. -->
  54.426 +        <!-- You can override this target in the ../build.xml file. -->
  54.427 +    </target>
  54.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  54.429 +    <!--
  54.430 +                =================
  54.431 +                EXECUTION SECTION
  54.432 +                =================
  54.433 +            -->
  54.434 +    <target depends="init,compile" description="Run a main class." name="run">
  54.435 +        <j2seproject1:java>
  54.436 +            <customize>
  54.437 +                <arg line="${application.args}"/>
  54.438 +            </customize>
  54.439 +        </j2seproject1:java>
  54.440 +    </target>
  54.441 +    <target name="-do-not-recompile">
  54.442 +        <property name="javac.includes.binary" value=""/>
  54.443 +    </target>
  54.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  54.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  54.446 +        <j2seproject1:java classname="${run.class}"/>
  54.447 +    </target>
  54.448 +    <!--
  54.449 +                =================
  54.450 +                DEBUGGING SECTION
  54.451 +                =================
  54.452 +            -->
  54.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  54.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  54.455 +    </target>
  54.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  54.457 +        <j2seproject3:debug>
  54.458 +            <customize>
  54.459 +                <arg line="${application.args}"/>
  54.460 +            </customize>
  54.461 +        </j2seproject3:debug>
  54.462 +    </target>
  54.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  54.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  54.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  54.466 +    </target>
  54.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  54.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  54.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  54.470 +        <j2seproject3:debug classname="${debug.class}"/>
  54.471 +    </target>
  54.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  54.473 +    <target depends="init" name="-pre-debug-fix">
  54.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  54.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  54.476 +    </target>
  54.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  54.478 +        <j2seproject1:nbjpdareload/>
  54.479 +    </target>
  54.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  54.481 +    <!--
  54.482 +                ===============
  54.483 +                JAVADOC SECTION
  54.484 +                ===============
  54.485 +            -->
  54.486 +    <target depends="init" name="-javadoc-build">
  54.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  54.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  54.489 +            <classpath>
  54.490 +                <path path="${javac.classpath}"/>
  54.491 +            </classpath>
  54.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  54.493 +                <filename name="**/*.java"/>
  54.494 +            </fileset>
  54.495 +        </javadoc>
  54.496 +    </target>
  54.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  54.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  54.499 +    </target>
  54.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  54.501 +    <!--
  54.502 +                =========================
  54.503 +                JUNIT COMPILATION SECTION
  54.504 +                =========================
  54.505 +            -->
  54.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  54.507 +        <mkdir dir="${build.test.classes.dir}"/>
  54.508 +    </target>
  54.509 +    <target name="-pre-compile-test">
  54.510 +        <!-- Empty placeholder for easier customization. -->
  54.511 +        <!-- You can override this target in the ../build.xml file. -->
  54.512 +    </target>
  54.513 +    <target if="do.depend.true" name="-compile-test-depend">
  54.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  54.515 +    </target>
  54.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  54.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  54.518 +        <copy todir="${build.test.classes.dir}">
  54.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.520 +        </copy>
  54.521 +    </target>
  54.522 +    <target name="-post-compile-test">
  54.523 +        <!-- Empty placeholder for easier customization. -->
  54.524 +        <!-- You can override this target in the ../build.xml file. -->
  54.525 +    </target>
  54.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  54.527 +    <target name="-pre-compile-test-single">
  54.528 +        <!-- Empty placeholder for easier customization. -->
  54.529 +        <!-- You can override this target in the ../build.xml file. -->
  54.530 +    </target>
  54.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  54.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  54.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  54.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  54.535 +        <copy todir="${build.test.classes.dir}">
  54.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.537 +        </copy>
  54.538 +    </target>
  54.539 +    <target name="-post-compile-test-single">
  54.540 +        <!-- Empty placeholder for easier customization. -->
  54.541 +        <!-- You can override this target in the ../build.xml file. -->
  54.542 +    </target>
  54.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  54.544 +    <!--
  54.545 +                =======================
  54.546 +                JUNIT EXECUTION SECTION
  54.547 +                =======================
  54.548 +            -->
  54.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  54.550 +        <mkdir dir="${build.test.results.dir}"/>
  54.551 +    </target>
  54.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  54.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  54.554 +    </target>
  54.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  54.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  54.557 +    </target>
  54.558 +    <target depends="init" if="have.tests" name="test-report"/>
  54.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  54.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  54.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  54.562 +        <mkdir dir="${build.test.results.dir}"/>
  54.563 +    </target>
  54.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  54.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  54.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  54.567 +    </target>
  54.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  54.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  54.570 +    </target>
  54.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  54.572 +    <!--
  54.573 +                =======================
  54.574 +                JUNIT DEBUGGING SECTION
  54.575 +                =======================
  54.576 +            -->
  54.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  54.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  54.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  54.580 +        <delete file="${test.report.file}"/>
  54.581 +        <mkdir dir="${build.test.results.dir}"/>
  54.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  54.583 +            <customize>
  54.584 +                <syspropertyset>
  54.585 +                    <propertyref prefix="test-sys-prop."/>
  54.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  54.587 +                </syspropertyset>
  54.588 +                <arg value="${test.class}"/>
  54.589 +                <arg value="showoutput=true"/>
  54.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  54.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  54.592 +            </customize>
  54.593 +        </j2seproject3:debug>
  54.594 +    </target>
  54.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  54.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  54.597 +    </target>
  54.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  54.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  54.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  54.601 +    </target>
  54.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  54.603 +    <!--
  54.604 +                =========================
  54.605 +                APPLET EXECUTION SECTION
  54.606 +                =========================
  54.607 +            -->
  54.608 +    <target depends="init,compile-single" name="run-applet">
  54.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  54.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  54.611 +            <customize>
  54.612 +                <arg value="${applet.url}"/>
  54.613 +            </customize>
  54.614 +        </j2seproject1:java>
  54.615 +    </target>
  54.616 +    <!--
  54.617 +                =========================
  54.618 +                APPLET DEBUGGING  SECTION
  54.619 +                =========================
  54.620 +            -->
  54.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  54.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  54.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  54.624 +            <customize>
  54.625 +                <arg value="${applet.url}"/>
  54.626 +            </customize>
  54.627 +        </j2seproject3:debug>
  54.628 +    </target>
  54.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  54.630 +    <!--
  54.631 +                ===============
  54.632 +                CLEANUP SECTION
  54.633 +                ===============
  54.634 +            -->
  54.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  54.636 +    <target depends="init" name="-do-clean">
  54.637 +        <delete dir="${build.dir}"/>
  54.638 +        <delete dir="${dist.dir}"/>
  54.639 +    </target>
  54.640 +    <target name="-post-clean">
  54.641 +        <!-- Empty placeholder for easier customization. -->
  54.642 +        <!-- You can override this target in the ../build.xml file. -->
  54.643 +    </target>
  54.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  54.645 +</project>
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/task1/solution05/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    55.3 @@ -0,0 +1,8 @@
    55.4 +build.xml.data.CRC32=2ab820eb
    55.5 +build.xml.script.CRC32=58a52595
    55.6 +build.xml.stylesheet.CRC32=be360661
    55.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    55.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    55.9 +nbproject/build-impl.xml.data.CRC32=47a079e2
   55.10 +nbproject/build-impl.xml.script.CRC32=f7fdafd7
   55.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/task1/solution05/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    56.3 @@ -0,0 +1,68 @@
    56.4 +application.title=currency
    56.5 +application.vendor=apidesign.org
    56.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    56.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    56.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    56.9 +build.classes.dir=${build.dir}/classes
   56.10 +build.classes.excludes=**/*.java,**/*.form
   56.11 +# This directory is removed when the project is cleaned:
   56.12 +build.dir=build
   56.13 +build.generated.dir=${build.dir}/generated
   56.14 +# Only compile against the classpath explicitly listed here:
   56.15 +build.sysclasspath=ignore
   56.16 +build.test.classes.dir=${build.dir}/test/classes
   56.17 +build.test.results.dir=${build.dir}/test/results
   56.18 +debug.classpath=\
   56.19 +    ${run.classpath}
   56.20 +debug.test.classpath=\
   56.21 +    ${run.test.classpath}
   56.22 +# This directory is removed when the project is cleaned:
   56.23 +dist.dir=dist
   56.24 +dist.jar=${dist.dir}/currency.jar
   56.25 +dist.javadoc.dir=${dist.dir}/javadoc
   56.26 +excludes=
   56.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   56.28 +file.reference.src-apifest08=..
   56.29 +includes=**
   56.30 +jar.compress=false
   56.31 +javac.classpath=
   56.32 +# Space-separated list of extra javac options
   56.33 +javac.compilerargs=
   56.34 +javac.deprecation=false
   56.35 +javac.source=1.5
   56.36 +javac.target=1.5
   56.37 +javac.test.classpath=\
   56.38 +    ${javac.classpath}:\
   56.39 +    ${build.classes.dir}:\
   56.40 +    ${file.reference.junit-4.4.jar}
   56.41 +javadoc.additionalparam=
   56.42 +javadoc.author=false
   56.43 +javadoc.encoding=
   56.44 +javadoc.noindex=false
   56.45 +javadoc.nonavbar=false
   56.46 +javadoc.notree=false
   56.47 +javadoc.private=false
   56.48 +javadoc.splitindex=true
   56.49 +javadoc.use=true
   56.50 +javadoc.version=false
   56.51 +javadoc.windowtitle=
   56.52 +jnlp.codebase.type=local
   56.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   56.54 +jnlp.descriptor=application
   56.55 +jnlp.enabled=false
   56.56 +jnlp.offline-allowed=false
   56.57 +jnlp.signed=false
   56.58 +meta.inf.dir=${src.dir}/META-INF
   56.59 +platform.active=default_platform
   56.60 +run.classpath=\
   56.61 +    ${javac.classpath}:\
   56.62 +    ${build.classes.dir}
   56.63 +# Space-separated list of JVM arguments used when running the project
   56.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   56.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   56.66 +run.jvmargs=
   56.67 +run.test.classpath=\
   56.68 +    ${javac.test.classpath}:\
   56.69 +    ${build.test.classes.dir}
   56.70 +src.dir=src
   56.71 +test.src.dir=test
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/task1/solution05/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    57.3 @@ -0,0 +1,16 @@
    57.4 +<?xml version="1.0" encoding="UTF-8"?>
    57.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    57.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    57.7 +    <configuration>
    57.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    57.9 +            <name>Currency Convertor Solution 05</name>
   57.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   57.11 +            <source-roots>
   57.12 +                <root id="src.dir"/>
   57.13 +            </source-roots>
   57.14 +            <test-roots>
   57.15 +                <root id="test.src.dir"/>
   57.16 +            </test-roots>
   57.17 +        </data>
   57.18 +    </configuration>
   57.19 +</project>
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/task1/solution05/src/org/apidesign/apifest08/currency/Amount.java	Sun Sep 28 14:12:38 2008 +0200
    58.3 @@ -0,0 +1,92 @@
    58.4 +package org.apidesign.apifest08.currency;
    58.5 +
    58.6 +/**
    58.7 + * Amount is a class reprezenting an amount of many. It consist of
    58.8 + * whole currency amount and of pence amount. Both items are long values
    58.9 + * and it's not defined that the 100 pences = 1 amount. It's up to the converter
   58.10 + * to verify such invariants.
   58.11 + *
   58.12 + * @author jindra
   58.13 + */
   58.14 +public final class Amount {
   58.15 +
   58.16 +    private long amount;
   58.17 +    private long pence;
   58.18 +
   58.19 +    /**
   58.20 +     * Construct Amount with no pences.
   58.21 +     *
   58.22 +     * @param amount the amount in some currency
   58.23 +     *
   58.24 +     */
   58.25 +    public Amount(long amount) {
   58.26 +        this.amount = amount;
   58.27 +        this.pence = 0;
   58.28 +    }
   58.29 +
   58.30 +    /**
   58.31 +     * Construct Amount with the pences.
   58.32 +     *
   58.33 +     * @param amount the amount in some currency
   58.34 +     * @param pence the pence count
   58.35 +     */
   58.36 +    public Amount(long amount, long pence) {
   58.37 +        this.amount = amount;
   58.38 +        this.pence = pence;
   58.39 +    }
   58.40 +
   58.41 +    /**
   58.42 +     * @return the amount
   58.43 +     */
   58.44 +    public long getAmount() {
   58.45 +        return amount;
   58.46 +    }
   58.47 +
   58.48 +    /**
   58.49 +     * @param amount the amount to set
   58.50 +     */
   58.51 +    public void setAmount(long amount) {
   58.52 +        this.amount = amount;
   58.53 +    }
   58.54 +
   58.55 +    /**
   58.56 +     * @return the pence
   58.57 +     */
   58.58 +    public long getPence() {
   58.59 +        return pence;
   58.60 +    }
   58.61 +
   58.62 +    /**
   58.63 +     * @param pence the pence to set
   58.64 +     */
   58.65 +    public void setPence(long pence) {
   58.66 +        this.pence = pence;
   58.67 +    }
   58.68 +
   58.69 +    @Override
   58.70 +    public boolean equals(Object obj) {
   58.71 +        if (obj == null) {
   58.72 +            return false;
   58.73 +        }
   58.74 +        if (!(obj instanceof Amount)) {
   58.75 +            return false;
   58.76 +        }
   58.77 +        Amount other = (Amount) obj;
   58.78 +        return (amount == other.amount) && (pence == other.pence);
   58.79 +    }
   58.80 +
   58.81 +    @Override
   58.82 +    public int hashCode() {
   58.83 +        int hash = 7;
   58.84 +        hash = 79 * hash + (int) (this.amount ^ (this.amount >>> 32));
   58.85 +        hash = 79 * hash + (int) (this.pence ^ (this.pence >>> 32));
   58.86 +        return hash;
   58.87 +    }
   58.88 +
   58.89 +    @Override
   58.90 +    public String toString() {
   58.91 +        return amount + "." + pence;
   58.92 +    }
   58.93 +
   58.94 +
   58.95 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/task1/solution05/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    59.3 @@ -0,0 +1,25 @@
    59.4 +package org.apidesign.apifest08.currency;
    59.5 +
    59.6 +/**
    59.7 + * Convertor is an interface reprezenting a convertor between currencies.
    59.8 + * It's able to convert one currency to the second one and back from the second one
    59.9 + * to the primary.
   59.10 + */
   59.11 +public interface Convertor {
   59.12 +
   59.13 +    /**
   59.14 +     * Convert amount of primary currency into secondary currency
   59.15 +     *
   59.16 +     * @param amount the amount in the primary currency
   59.17 +     * @return an amount in the secondary currency
   59.18 +     */
   59.19 +    Amount convert(Amount primaryAmount);
   59.20 +
   59.21 +    /**
   59.22 +     * Convert amount of secondary currency back into primary currency
   59.23 +     *
   59.24 +     * @param amount the amount in the secondary currency
   59.25 +     * @return an amount in the primary currency
   59.26 +     */
   59.27 +    Amount convertBack(Amount secondaryAmount);
   59.28 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/task1/solution05/src/org/apidesign/apifest08/currency/ConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    60.3 @@ -0,0 +1,30 @@
    60.4 +package org.apidesign.apifest08.currency;
    60.5 +
    60.6 +/**
    60.7 + * Convertor factory is a factory class for creating {@link Convertor Convertor}
    60.8 + * instances.
    60.9 + *
   60.10 + * @author jindra
   60.11 + */
   60.12 +public final class ConvertorFactory {
   60.13 +
   60.14 +    // this class needs no instances
   60.15 +    private ConvertorFactory() {
   60.16 +    }
   60.17 +
   60.18 +
   60.19 +    /**
   60.20 +     * Create a {@link Convertor Convertor} with given exchange rate
   60.21 +     *
   60.22 +     * @param exchangeRate double reprezenting the exchange rate from primary currency into
   60.23 +     * the secundary currecny
   60.24 +     * @return {@link Convertor Convertor} instance with given exchange rate
   60.25 +     */
   60.26 +    public static Convertor createConvertor(double exchangeRate) {
   60.27 +        if (exchangeRate == 0) {
   60.28 +            throw new IllegalArgumentException("Zero exchange rate is not allowed.");
   60.29 +        }
   60.30 +        return new ConvertorImpl(exchangeRate);
   60.31 +
   60.32 +    }
   60.33 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/task1/solution05/src/org/apidesign/apifest08/currency/ConvertorImpl.java	Sun Sep 28 14:12:38 2008 +0200
    61.3 @@ -0,0 +1,56 @@
    61.4 +package org.apidesign.apifest08.currency;
    61.5 +
    61.6 +/**
    61.7 + * ConvetorImpl it the basic implementaion of Convertor interface.
    61.8 + * @see Convertor Convertor for more details.
    61.9 + * The 100 pences makes 1 amount of the currency.
   61.10 + *
   61.11 + * @author jindra
   61.12 + */
   61.13 +final class ConvertorImpl implements Convertor {
   61.14 +
   61.15 +    private static final double P_TO_AM = 100;
   61.16 +    private double exchangeRate;
   61.17 +
   61.18 +    ConvertorImpl(double exchangeRate) {
   61.19 +        this.exchangeRate = exchangeRate;
   61.20 +    }
   61.21 +
   61.22 +    public Amount convert(Amount amount) {
   61.23 +        verifyInput(amount);
   61.24 +        double result = convertToDouble(amount) * exchangeRate;
   61.25 +        return convertToAmount(result);
   61.26 +    }
   61.27 +
   61.28 +    public Amount convertBack(Amount amount) {
   61.29 +        if (amount == null) {
   61.30 +            throw new IllegalArgumentException("Amount must be not null");
   61.31 +        }
   61.32 +        double result = convertToDouble(amount) / exchangeRate;
   61.33 +        return convertToAmount(result);
   61.34 +    }
   61.35 +
   61.36 +    private double convertToDouble(Amount amount) {
   61.37 +        double am = amount.getAmount();
   61.38 +        double pc = amount.getPence();
   61.39 +        return am + (pc / P_TO_AM);
   61.40 +    }
   61.41 +
   61.42 +    private Amount convertToAmount(double result) {
   61.43 +        long resultAm = Math.round(Math.floor(result));
   61.44 +        long resultPc = Math.round(Math.floor((result * P_TO_AM - resultAm * P_TO_AM)));
   61.45 +        return new Amount(resultAm, resultPc);
   61.46 +    }
   61.47 +
   61.48 +    private void verifyInput(Amount amount) {
   61.49 +        if (amount == null) {
   61.50 +            throw new IllegalArgumentException("Amount must be not null");
   61.51 +        }
   61.52 +        if (amount.getPence() < 0) {
   61.53 +            throw new IllegalArgumentException("Pences must not be negative");
   61.54 +        }
   61.55 +        if (amount.getPence() > P_TO_AM) {
   61.56 +            throw new IllegalArgumentException("Pences must not be over P_TO_AM");
   61.57 +        }
   61.58 +    }
   61.59 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/task1/solution05/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    62.3 @@ -0,0 +1,104 @@
    62.4 +package org.apidesign.apifest08.test;
    62.5 +
    62.6 +import junit.framework.TestCase;
    62.7 +import org.apidesign.apifest08.currency.Amount;
    62.8 +import org.apidesign.apifest08.currency.Convertor;
    62.9 +import org.apidesign.apifest08.currency.ConvertorFactory;
   62.10 +
   62.11 +/** Finish the Convertor API, and then write bodies of methods inside
   62.12 + * of this class to match the given tasks. To fullfil your task, use the
   62.13 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   62.14 + * Do not you reflection, or other hacks as your code
   62.15 + * shall run without any runtime permissions.
   62.16 + */
   62.17 +public class Task1Test extends TestCase {
   62.18 +    public Task1Test(String testName) {
   62.19 +        super(testName);
   62.20 +    }
   62.21 +
   62.22 +    @Override
   62.23 +    protected void setUp() throws Exception {
   62.24 +    }
   62.25 +
   62.26 +    @Override
   62.27 +    protected void tearDown() throws Exception {
   62.28 +    }
   62.29 +
   62.30 +    /** Create convertor that understands two currencies, CZK and
   62.31 +     *  USD. Make 1 USD == 17 CZK.
   62.32 +     *
   62.33 +     * Creation of the convertor shall not require subclassing of any class
   62.34 +     * or interface on the client side.
   62.35 +     *
   62.36 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   62.37 +     */
   62.38 +    public static Convertor createCZKtoUSD() {
   62.39 +        return ConvertorFactory.createConvertor(17);
   62.40 +    }
   62.41 +
   62.42 +    /** Create convertor that understands two currencies, CZK and
   62.43 +     *  SKK. Make 100 SKK == 80 CZK.
   62.44 +     *
   62.45 +     * Creation of the convertor shall not require subclassing of any class
   62.46 +     * or interface on the client side.
   62.47 +     * 
   62.48 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   62.49 +     */
   62.50 +    public static Convertor createSKKtoCZK() {
   62.51 +        return ConvertorFactory.createConvertor(0.8);
   62.52 +    }
   62.53 +    
   62.54 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   62.55 +     * with it.
   62.56 +     */
   62.57 +    public void testCurrencyCZKUSD() throws Exception {
   62.58 +        Convertor c = createCZKtoUSD();
   62.59 +        // convert $5 to CZK using c:
   62.60 +        assertEquals("Result is 85 CZK", 85l, c.convert(new Amount(5)).getAmount());
   62.61 +
   62.62 +        // convert $8 to CZK
   62.63 +        assertEquals("Result is 136 CZK", 136l, c.convert(new Amount(8)).getAmount());
   62.64 +
   62.65 +        // convert 1003CZK to USD
   62.66 +        assertEquals("Result is 136 CZK", 59l, c.convertBack(new Amount(1003)).getAmount());
   62.67 +        // assertEquals("Result is 59 USD");
   62.68 +    }
   62.69 +
   62.70 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   62.71 +     * with it.
   62.72 +     */
   62.73 +    public void testCurrencySKKCZK() throws Exception {
   62.74 +        Convertor c = createSKKtoCZK();
   62.75 +        // convert 16CZK using c:
   62.76 +        assertEquals("Result is 20 SKK", 20l, c.convertBack(new Amount(16)).getAmount());
   62.77 +
   62.78 +        // convert 500SKK to CZK
   62.79 +        assertEquals("Result is 400 CZK", 400l, c.convert(new Amount(500)).getAmount());
   62.80 +    }
   62.81 +
   62.82 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   62.83 +     * with it.
   62.84 +     */
   62.85 +    public void testCurrencySKKCZKwithPences() throws Exception {
   62.86 +        Convertor c = createSKKtoCZK();
   62.87 +        // convert 16CZK 16h using c:
   62.88 +        assertEquals("Result is 20 SKK 20h", new Amount(20, 20), c.convertBack(new Amount(16, 16)));
   62.89 +
   62.90 +        // convert 500SKK 80h to CZK
   62.91 +        assertEquals("Result is 400 CZK 64h", new Amount(400, 64), c.convert(new Amount(500, 80)));
   62.92 +
   62.93 +        // convert 400CZK 80h to SKK
   62.94 +        assertEquals("Result is 501 CZK", new Amount(501), c.convertBack(new Amount(400, 80)));
   62.95 +    }
   62.96 +
   62.97 +    public void testNegativeSKKCZ() throws Exception{
   62.98 +        Convertor c = createSKKtoCZK();
   62.99 +        // convert -16CZK using c:
  62.100 +        assertEquals("Result is -20", new Amount(-20), c.convertBack(new Amount(-16)));
  62.101 +
  62.102 +        // convert -500SKK 80h to CZK
  62.103 +        assertEquals("Result is -400CZK 64h", new Amount(-400, 64), c.convert(new Amount(-500, 80)));
  62.104 +
  62.105 +    }
  62.106 +}
  62.107 +
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/task1/solution06/build.xml	Sun Sep 28 14:12:38 2008 +0200
    63.3 @@ -0,0 +1,69 @@
    63.4 +<?xml version="1.0" encoding="UTF-8"?>
    63.5 +<!-- You may freely edit this file. See commented blocks below for -->
    63.6 +<!-- some examples of how to customize the build. -->
    63.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    63.8 +<project name="currency" default="default" basedir=".">
    63.9 +    <description>Builds, tests, and runs the project.</description>
   63.10 +    <import file="nbproject/build-impl.xml"/>
   63.11 +    <!--
   63.12 +
   63.13 +    There exist several targets which are by default empty and which can be 
   63.14 +    used for execution of your tasks. These targets are usually executed 
   63.15 +    before and after some main targets. They are: 
   63.16 +
   63.17 +      -pre-init:                 called before initialization of project properties
   63.18 +      -post-init:                called after initialization of project properties
   63.19 +      -pre-compile:              called before javac compilation
   63.20 +      -post-compile:             called after javac compilation
   63.21 +      -pre-compile-single:       called before javac compilation of single file
   63.22 +      -post-compile-single:      called after javac compilation of single file
   63.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   63.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   63.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   63.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   63.27 +      -pre-jar:                  called before JAR building
   63.28 +      -post-jar:                 called after JAR building
   63.29 +      -post-clean:               called after cleaning build products
   63.30 +
   63.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   63.32 +
   63.33 +    Example of inserting an obfuscator after compilation could look like this:
   63.34 +
   63.35 +        <target name="-post-compile">
   63.36 +            <obfuscate>
   63.37 +                <fileset dir="${build.classes.dir}"/>
   63.38 +            </obfuscate>
   63.39 +        </target>
   63.40 +
   63.41 +    For list of available properties check the imported 
   63.42 +    nbproject/build-impl.xml file. 
   63.43 +
   63.44 +
   63.45 +    Another way to customize the build is by overriding existing main targets.
   63.46 +    The targets of interest are: 
   63.47 +
   63.48 +      -init-macrodef-javac:     defines macro for javac compilation
   63.49 +      -init-macrodef-junit:     defines macro for junit execution
   63.50 +      -init-macrodef-debug:     defines macro for class debugging
   63.51 +      -init-macrodef-java:      defines macro for class execution
   63.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   63.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   63.54 +      run:                      execution of project 
   63.55 +      -javadoc-build:           Javadoc generation
   63.56 +      test-report:              JUnit report generation
   63.57 +
   63.58 +    An example of overriding the target for project execution could look like this:
   63.59 +
   63.60 +        <target name="run" depends="currency-impl.jar">
   63.61 +            <exec dir="bin" executable="launcher.exe">
   63.62 +                <arg file="${dist.jar}"/>
   63.63 +            </exec>
   63.64 +        </target>
   63.65 +
   63.66 +    Notice that the overridden target depends on the jar target and not only on 
   63.67 +    the compile target as the regular run target does. Again, for a list of available 
   63.68 +    properties which you can use, check the target you are overriding in the
   63.69 +    nbproject/build-impl.xml file. 
   63.70 +
   63.71 +    -->
   63.72 +</project>
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/task1/solution06/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    64.3 @@ -0,0 +1,642 @@
    64.4 +<?xml version="1.0" encoding="UTF-8"?>
    64.5 +<!--
    64.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    64.7 +***         EDIT ../build.xml INSTEAD         ***
    64.8 +
    64.9 +For the purpose of easier reading the script
   64.10 +is divided into following sections:
   64.11 +
   64.12 +  - initialization
   64.13 +  - compilation
   64.14 +  - jar
   64.15 +  - execution
   64.16 +  - debugging
   64.17 +  - javadoc
   64.18 +  - junit compilation
   64.19 +  - junit execution
   64.20 +  - junit debugging
   64.21 +  - applet
   64.22 +  - cleanup
   64.23 +
   64.24 +        -->
   64.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_06-impl">
   64.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   64.27 +    <!-- 
   64.28 +                ======================
   64.29 +                INITIALIZATION SECTION 
   64.30 +                ======================
   64.31 +            -->
   64.32 +    <target name="-pre-init">
   64.33 +        <!-- Empty placeholder for easier customization. -->
   64.34 +        <!-- You can override this target in the ../build.xml file. -->
   64.35 +    </target>
   64.36 +    <target depends="-pre-init" name="-init-private">
   64.37 +        <property file="nbproject/private/config.properties"/>
   64.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   64.39 +        <property file="nbproject/private/private.properties"/>
   64.40 +    </target>
   64.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   64.42 +        <property file="${user.properties.file}"/>
   64.43 +        <!-- The two properties below are usually overridden -->
   64.44 +        <!-- by the active platform. Just a fallback. -->
   64.45 +        <property name="default.javac.source" value="1.4"/>
   64.46 +        <property name="default.javac.target" value="1.4"/>
   64.47 +    </target>
   64.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   64.49 +        <property file="nbproject/configs/${config}.properties"/>
   64.50 +        <property file="nbproject/project.properties"/>
   64.51 +    </target>
   64.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   64.53 +        <available file="${manifest.file}" property="manifest.available"/>
   64.54 +        <condition property="manifest.available+main.class">
   64.55 +            <and>
   64.56 +                <isset property="manifest.available"/>
   64.57 +                <isset property="main.class"/>
   64.58 +                <not>
   64.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   64.60 +                </not>
   64.61 +            </and>
   64.62 +        </condition>
   64.63 +        <condition property="manifest.available+main.class+mkdist.available">
   64.64 +            <and>
   64.65 +                <istrue value="${manifest.available+main.class}"/>
   64.66 +                <isset property="libs.CopyLibs.classpath"/>
   64.67 +            </and>
   64.68 +        </condition>
   64.69 +        <condition property="have.tests">
   64.70 +            <or>
   64.71 +                <available file="${test.src.dir}"/>
   64.72 +            </or>
   64.73 +        </condition>
   64.74 +        <condition property="have.sources">
   64.75 +            <or>
   64.76 +                <available file="${src.dir}"/>
   64.77 +            </or>
   64.78 +        </condition>
   64.79 +        <condition property="netbeans.home+have.tests">
   64.80 +            <and>
   64.81 +                <isset property="netbeans.home"/>
   64.82 +                <isset property="have.tests"/>
   64.83 +            </and>
   64.84 +        </condition>
   64.85 +        <condition property="no.javadoc.preview">
   64.86 +            <and>
   64.87 +                <isset property="javadoc.preview"/>
   64.88 +                <isfalse value="${javadoc.preview}"/>
   64.89 +            </and>
   64.90 +        </condition>
   64.91 +        <property name="run.jvmargs" value=""/>
   64.92 +        <property name="javac.compilerargs" value=""/>
   64.93 +        <property name="work.dir" value="${basedir}"/>
   64.94 +        <condition property="no.deps">
   64.95 +            <and>
   64.96 +                <istrue value="${no.dependencies}"/>
   64.97 +            </and>
   64.98 +        </condition>
   64.99 +        <property name="javac.debug" value="true"/>
  64.100 +        <property name="javadoc.preview" value="true"/>
  64.101 +        <property name="application.args" value=""/>
  64.102 +        <property name="source.encoding" value="${file.encoding}"/>
  64.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  64.104 +            <and>
  64.105 +                <isset property="javadoc.encoding"/>
  64.106 +                <not>
  64.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  64.108 +                </not>
  64.109 +            </and>
  64.110 +        </condition>
  64.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  64.112 +        <property name="includes" value="**"/>
  64.113 +        <property name="excludes" value=""/>
  64.114 +        <property name="do.depend" value="false"/>
  64.115 +        <condition property="do.depend.true">
  64.116 +            <istrue value="${do.depend}"/>
  64.117 +        </condition>
  64.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  64.119 +            <and>
  64.120 +                <isset property="jaxws.endorsed.dir"/>
  64.121 +                <available file="nbproject/jaxws-build.xml"/>
  64.122 +            </and>
  64.123 +        </condition>
  64.124 +    </target>
  64.125 +    <target name="-post-init">
  64.126 +        <!-- Empty placeholder for easier customization. -->
  64.127 +        <!-- You can override this target in the ../build.xml file. -->
  64.128 +    </target>
  64.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  64.130 +        <fail unless="src.dir">Must set src.dir</fail>
  64.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  64.132 +        <fail unless="build.dir">Must set build.dir</fail>
  64.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  64.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  64.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  64.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  64.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  64.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  64.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  64.140 +    </target>
  64.141 +    <target name="-init-macrodef-property">
  64.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  64.143 +            <attribute name="name"/>
  64.144 +            <attribute name="value"/>
  64.145 +            <sequential>
  64.146 +                <property name="@{name}" value="${@{value}}"/>
  64.147 +            </sequential>
  64.148 +        </macrodef>
  64.149 +    </target>
  64.150 +    <target name="-init-macrodef-javac">
  64.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  64.152 +            <attribute default="${src.dir}" name="srcdir"/>
  64.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  64.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  64.155 +            <attribute default="${includes}" name="includes"/>
  64.156 +            <attribute default="${excludes}" name="excludes"/>
  64.157 +            <attribute default="${javac.debug}" name="debug"/>
  64.158 +            <attribute default="" name="sourcepath"/>
  64.159 +            <element name="customize" optional="true"/>
  64.160 +            <sequential>
  64.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  64.162 +                    <classpath>
  64.163 +                        <path path="@{classpath}"/>
  64.164 +                    </classpath>
  64.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  64.166 +                    <customize/>
  64.167 +                </javac>
  64.168 +            </sequential>
  64.169 +        </macrodef>
  64.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  64.171 +            <attribute default="${src.dir}" name="srcdir"/>
  64.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  64.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  64.174 +            <sequential>
  64.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  64.176 +                    <classpath>
  64.177 +                        <path path="@{classpath}"/>
  64.178 +                    </classpath>
  64.179 +                </depend>
  64.180 +            </sequential>
  64.181 +        </macrodef>
  64.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  64.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  64.184 +            <sequential>
  64.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  64.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  64.187 +                    <path>
  64.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  64.189 +                    </path>
  64.190 +                    <globmapper from="*.java" to="*.class"/>
  64.191 +                </pathconvert>
  64.192 +                <delete>
  64.193 +                    <files includes="${javac.includes.binary}"/>
  64.194 +                </delete>
  64.195 +            </sequential>
  64.196 +        </macrodef>
  64.197 +    </target>
  64.198 +    <target name="-init-macrodef-junit">
  64.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  64.200 +            <attribute default="${includes}" name="includes"/>
  64.201 +            <attribute default="${excludes}" name="excludes"/>
  64.202 +            <attribute default="**" name="testincludes"/>
  64.203 +            <sequential>
  64.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  64.205 +                    <batchtest todir="${build.test.results.dir}">
  64.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  64.207 +                            <filename name="@{testincludes}"/>
  64.208 +                        </fileset>
  64.209 +                    </batchtest>
  64.210 +                    <classpath>
  64.211 +                        <path path="${run.test.classpath}"/>
  64.212 +                    </classpath>
  64.213 +                    <syspropertyset>
  64.214 +                        <propertyref prefix="test-sys-prop."/>
  64.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  64.216 +                    </syspropertyset>
  64.217 +                    <formatter type="brief" usefile="false"/>
  64.218 +                    <formatter type="xml"/>
  64.219 +                    <jvmarg line="${run.jvmargs}"/>
  64.220 +                </junit>
  64.221 +            </sequential>
  64.222 +        </macrodef>
  64.223 +    </target>
  64.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  64.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  64.226 +            <attribute default="${main.class}" name="name"/>
  64.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  64.228 +            <attribute default="" name="stopclassname"/>
  64.229 +            <sequential>
  64.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  64.231 +                    <classpath>
  64.232 +                        <path path="@{classpath}"/>
  64.233 +                    </classpath>
  64.234 +                </nbjpdastart>
  64.235 +            </sequential>
  64.236 +        </macrodef>
  64.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  64.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  64.239 +            <sequential>
  64.240 +                <nbjpdareload>
  64.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  64.242 +                        <include name="${fix.includes}*.class"/>
  64.243 +                    </fileset>
  64.244 +                </nbjpdareload>
  64.245 +            </sequential>
  64.246 +        </macrodef>
  64.247 +    </target>
  64.248 +    <target name="-init-debug-args">
  64.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  64.250 +        <condition property="have-jdk-older-than-1.4">
  64.251 +            <or>
  64.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  64.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  64.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  64.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  64.256 +            </or>
  64.257 +        </condition>
  64.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  64.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  64.260 +        </condition>
  64.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  64.262 +            <os family="windows"/>
  64.263 +        </condition>
  64.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  64.265 +            <isset property="debug.transport"/>
  64.266 +        </condition>
  64.267 +    </target>
  64.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  64.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  64.270 +            <attribute default="${main.class}" name="classname"/>
  64.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  64.272 +            <element name="customize" optional="true"/>
  64.273 +            <sequential>
  64.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  64.275 +                    <jvmarg line="${debug-args-line}"/>
  64.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  64.277 +                    <jvmarg line="${run.jvmargs}"/>
  64.278 +                    <classpath>
  64.279 +                        <path path="@{classpath}"/>
  64.280 +                    </classpath>
  64.281 +                    <syspropertyset>
  64.282 +                        <propertyref prefix="run-sys-prop."/>
  64.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  64.284 +                    </syspropertyset>
  64.285 +                    <customize/>
  64.286 +                </java>
  64.287 +            </sequential>
  64.288 +        </macrodef>
  64.289 +    </target>
  64.290 +    <target name="-init-macrodef-java">
  64.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  64.292 +            <attribute default="${main.class}" name="classname"/>
  64.293 +            <element name="customize" optional="true"/>
  64.294 +            <sequential>
  64.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  64.296 +                    <jvmarg line="${run.jvmargs}"/>
  64.297 +                    <classpath>
  64.298 +                        <path path="${run.classpath}"/>
  64.299 +                    </classpath>
  64.300 +                    <syspropertyset>
  64.301 +                        <propertyref prefix="run-sys-prop."/>
  64.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  64.303 +                    </syspropertyset>
  64.304 +                    <customize/>
  64.305 +                </java>
  64.306 +            </sequential>
  64.307 +        </macrodef>
  64.308 +    </target>
  64.309 +    <target name="-init-presetdef-jar">
  64.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  64.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  64.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  64.313 +            </jar>
  64.314 +        </presetdef>
  64.315 +    </target>
  64.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  64.317 +    <!--
  64.318 +                ===================
  64.319 +                COMPILATION SECTION
  64.320 +                ===================
  64.321 +            -->
  64.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  64.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  64.324 +    <target depends="init" name="-check-automatic-build">
  64.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  64.326 +    </target>
  64.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  64.328 +        <antcall target="clean"/>
  64.329 +    </target>
  64.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  64.331 +        <mkdir dir="${build.classes.dir}"/>
  64.332 +    </target>
  64.333 +    <target name="-pre-compile">
  64.334 +        <!-- Empty placeholder for easier customization. -->
  64.335 +        <!-- You can override this target in the ../build.xml file. -->
  64.336 +    </target>
  64.337 +    <target if="do.depend.true" name="-compile-depend">
  64.338 +        <j2seproject3:depend/>
  64.339 +    </target>
  64.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  64.341 +        <j2seproject3:javac/>
  64.342 +        <copy todir="${build.classes.dir}">
  64.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  64.344 +        </copy>
  64.345 +    </target>
  64.346 +    <target name="-post-compile">
  64.347 +        <!-- Empty placeholder for easier customization. -->
  64.348 +        <!-- You can override this target in the ../build.xml file. -->
  64.349 +    </target>
  64.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  64.351 +    <target name="-pre-compile-single">
  64.352 +        <!-- Empty placeholder for easier customization. -->
  64.353 +        <!-- You can override this target in the ../build.xml file. -->
  64.354 +    </target>
  64.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  64.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  64.357 +        <j2seproject3:force-recompile/>
  64.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  64.359 +    </target>
  64.360 +    <target name="-post-compile-single">
  64.361 +        <!-- Empty placeholder for easier customization. -->
  64.362 +        <!-- You can override this target in the ../build.xml file. -->
  64.363 +    </target>
  64.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  64.365 +    <!--
  64.366 +                ====================
  64.367 +                JAR BUILDING SECTION
  64.368 +                ====================
  64.369 +            -->
  64.370 +    <target depends="init" name="-pre-pre-jar">
  64.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  64.372 +        <mkdir dir="${dist.jar.dir}"/>
  64.373 +    </target>
  64.374 +    <target name="-pre-jar">
  64.375 +        <!-- Empty placeholder for easier customization. -->
  64.376 +        <!-- You can override this target in the ../build.xml file. -->
  64.377 +    </target>
  64.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  64.379 +        <j2seproject1:jar/>
  64.380 +    </target>
  64.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  64.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  64.383 +    </target>
  64.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  64.385 +        <j2seproject1:jar manifest="${manifest.file}">
  64.386 +            <j2seproject1:manifest>
  64.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  64.388 +            </j2seproject1:manifest>
  64.389 +        </j2seproject1:jar>
  64.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  64.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  64.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  64.393 +        <pathconvert property="run.classpath.with.dist.jar">
  64.394 +            <path path="${run.classpath}"/>
  64.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  64.396 +        </pathconvert>
  64.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  64.398 +    </target>
  64.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  64.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  64.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  64.402 +            <path path="${run.classpath}"/>
  64.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  64.404 +        </pathconvert>
  64.405 +        <pathconvert pathsep=" " property="jar.classpath">
  64.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  64.407 +            <chainedmapper>
  64.408 +                <flattenmapper/>
  64.409 +                <globmapper from="*" to="lib/*"/>
  64.410 +            </chainedmapper>
  64.411 +        </pathconvert>
  64.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  64.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  64.414 +            <fileset dir="${build.classes.dir}"/>
  64.415 +            <manifest>
  64.416 +                <attribute name="Main-Class" value="${main.class}"/>
  64.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  64.418 +            </manifest>
  64.419 +        </copylibs>
  64.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  64.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  64.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  64.423 +    </target>
  64.424 +    <target name="-post-jar">
  64.425 +        <!-- Empty placeholder for easier customization. -->
  64.426 +        <!-- You can override this target in the ../build.xml file. -->
  64.427 +    </target>
  64.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  64.429 +    <!--
  64.430 +                =================
  64.431 +                EXECUTION SECTION
  64.432 +                =================
  64.433 +            -->
  64.434 +    <target depends="init,compile" description="Run a main class." name="run">
  64.435 +        <j2seproject1:java>
  64.436 +            <customize>
  64.437 +                <arg line="${application.args}"/>
  64.438 +            </customize>
  64.439 +        </j2seproject1:java>
  64.440 +    </target>
  64.441 +    <target name="-do-not-recompile">
  64.442 +        <property name="javac.includes.binary" value=""/>
  64.443 +    </target>
  64.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  64.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  64.446 +        <j2seproject1:java classname="${run.class}"/>
  64.447 +    </target>
  64.448 +    <!--
  64.449 +                =================
  64.450 +                DEBUGGING SECTION
  64.451 +                =================
  64.452 +            -->
  64.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  64.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  64.455 +    </target>
  64.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  64.457 +        <j2seproject3:debug>
  64.458 +            <customize>
  64.459 +                <arg line="${application.args}"/>
  64.460 +            </customize>
  64.461 +        </j2seproject3:debug>
  64.462 +    </target>
  64.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  64.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  64.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  64.466 +    </target>
  64.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  64.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  64.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  64.470 +        <j2seproject3:debug classname="${debug.class}"/>
  64.471 +    </target>
  64.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  64.473 +    <target depends="init" name="-pre-debug-fix">
  64.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  64.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  64.476 +    </target>
  64.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  64.478 +        <j2seproject1:nbjpdareload/>
  64.479 +    </target>
  64.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  64.481 +    <!--
  64.482 +                ===============
  64.483 +                JAVADOC SECTION
  64.484 +                ===============
  64.485 +            -->
  64.486 +    <target depends="init" name="-javadoc-build">
  64.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  64.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  64.489 +            <classpath>
  64.490 +                <path path="${javac.classpath}"/>
  64.491 +            </classpath>
  64.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  64.493 +                <filename name="**/*.java"/>
  64.494 +            </fileset>
  64.495 +        </javadoc>
  64.496 +    </target>
  64.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  64.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  64.499 +    </target>
  64.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  64.501 +    <!--
  64.502 +                =========================
  64.503 +                JUNIT COMPILATION SECTION
  64.504 +                =========================
  64.505 +            -->
  64.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  64.507 +        <mkdir dir="${build.test.classes.dir}"/>
  64.508 +    </target>
  64.509 +    <target name="-pre-compile-test">
  64.510 +        <!-- Empty placeholder for easier customization. -->
  64.511 +        <!-- You can override this target in the ../build.xml file. -->
  64.512 +    </target>
  64.513 +    <target if="do.depend.true" name="-compile-test-depend">
  64.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  64.515 +    </target>
  64.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  64.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  64.518 +        <copy todir="${build.test.classes.dir}">
  64.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  64.520 +        </copy>
  64.521 +    </target>
  64.522 +    <target name="-post-compile-test">
  64.523 +        <!-- Empty placeholder for easier customization. -->
  64.524 +        <!-- You can override this target in the ../build.xml file. -->
  64.525 +    </target>
  64.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  64.527 +    <target name="-pre-compile-test-single">
  64.528 +        <!-- Empty placeholder for easier customization. -->
  64.529 +        <!-- You can override this target in the ../build.xml file. -->
  64.530 +    </target>
  64.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  64.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  64.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  64.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  64.535 +        <copy todir="${build.test.classes.dir}">
  64.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  64.537 +        </copy>
  64.538 +    </target>
  64.539 +    <target name="-post-compile-test-single">
  64.540 +        <!-- Empty placeholder for easier customization. -->
  64.541 +        <!-- You can override this target in the ../build.xml file. -->
  64.542 +    </target>
  64.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  64.544 +    <!--
  64.545 +                =======================
  64.546 +                JUNIT EXECUTION SECTION
  64.547 +                =======================
  64.548 +            -->
  64.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  64.550 +        <mkdir dir="${build.test.results.dir}"/>
  64.551 +    </target>
  64.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  64.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  64.554 +    </target>
  64.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  64.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  64.557 +    </target>
  64.558 +    <target depends="init" if="have.tests" name="test-report"/>
  64.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  64.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  64.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  64.562 +        <mkdir dir="${build.test.results.dir}"/>
  64.563 +    </target>
  64.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  64.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  64.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  64.567 +    </target>
  64.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  64.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  64.570 +    </target>
  64.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  64.572 +    <!--
  64.573 +                =======================
  64.574 +                JUNIT DEBUGGING SECTION
  64.575 +                =======================
  64.576 +            -->
  64.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  64.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  64.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  64.580 +        <delete file="${test.report.file}"/>
  64.581 +        <mkdir dir="${build.test.results.dir}"/>
  64.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  64.583 +            <customize>
  64.584 +                <syspropertyset>
  64.585 +                    <propertyref prefix="test-sys-prop."/>
  64.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  64.587 +                </syspropertyset>
  64.588 +                <arg value="${test.class}"/>
  64.589 +                <arg value="showoutput=true"/>
  64.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  64.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  64.592 +            </customize>
  64.593 +        </j2seproject3:debug>
  64.594 +    </target>
  64.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  64.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  64.597 +    </target>
  64.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  64.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  64.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  64.601 +    </target>
  64.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  64.603 +    <!--
  64.604 +                =========================
  64.605 +                APPLET EXECUTION SECTION
  64.606 +                =========================
  64.607 +            -->
  64.608 +    <target depends="init,compile-single" name="run-applet">
  64.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  64.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  64.611 +            <customize>
  64.612 +                <arg value="${applet.url}"/>
  64.613 +            </customize>
  64.614 +        </j2seproject1:java>
  64.615 +    </target>
  64.616 +    <!--
  64.617 +                =========================
  64.618 +                APPLET DEBUGGING  SECTION
  64.619 +                =========================
  64.620 +            -->
  64.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  64.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  64.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  64.624 +            <customize>
  64.625 +                <arg value="${applet.url}"/>
  64.626 +            </customize>
  64.627 +        </j2seproject3:debug>
  64.628 +    </target>
  64.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  64.630 +    <!--
  64.631 +                ===============
  64.632 +                CLEANUP SECTION
  64.633 +                ===============
  64.634 +            -->
  64.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  64.636 +    <target depends="init" name="-do-clean">
  64.637 +        <delete dir="${build.dir}"/>
  64.638 +        <delete dir="${dist.dir}"/>
  64.639 +    </target>
  64.640 +    <target name="-post-clean">
  64.641 +        <!-- Empty placeholder for easier customization. -->
  64.642 +        <!-- You can override this target in the ../build.xml file. -->
  64.643 +    </target>
  64.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  64.645 +</project>
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/task1/solution06/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    65.3 @@ -0,0 +1,8 @@
    65.4 +build.xml.data.CRC32=2ab820eb
    65.5 +build.xml.script.CRC32=58a52595
    65.6 +build.xml.stylesheet.CRC32=be360661
    65.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    65.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    65.9 +nbproject/build-impl.xml.data.CRC32=ff801896
   65.10 +nbproject/build-impl.xml.script.CRC32=a0996c47
   65.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/task1/solution06/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    66.3 @@ -0,0 +1,68 @@
    66.4 +application.title=currency
    66.5 +application.vendor=apidesign.org
    66.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    66.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    66.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    66.9 +build.classes.dir=${build.dir}/classes
   66.10 +build.classes.excludes=**/*.java,**/*.form
   66.11 +# This directory is removed when the project is cleaned:
   66.12 +build.dir=build
   66.13 +build.generated.dir=${build.dir}/generated
   66.14 +# Only compile against the classpath explicitly listed here:
   66.15 +build.sysclasspath=ignore
   66.16 +build.test.classes.dir=${build.dir}/test/classes
   66.17 +build.test.results.dir=${build.dir}/test/results
   66.18 +debug.classpath=\
   66.19 +    ${run.classpath}
   66.20 +debug.test.classpath=\
   66.21 +    ${run.test.classpath}
   66.22 +# This directory is removed when the project is cleaned:
   66.23 +dist.dir=dist
   66.24 +dist.jar=${dist.dir}/currency.jar
   66.25 +dist.javadoc.dir=${dist.dir}/javadoc
   66.26 +excludes=
   66.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   66.28 +file.reference.src-apifest08=..
   66.29 +includes=**
   66.30 +jar.compress=false
   66.31 +javac.classpath=
   66.32 +# Space-separated list of extra javac options
   66.33 +javac.compilerargs=
   66.34 +javac.deprecation=false
   66.35 +javac.source=1.5
   66.36 +javac.target=1.5
   66.37 +javac.test.classpath=\
   66.38 +    ${javac.classpath}:\
   66.39 +    ${build.classes.dir}:\
   66.40 +    ${file.reference.junit-4.4.jar}
   66.41 +javadoc.additionalparam=
   66.42 +javadoc.author=false
   66.43 +javadoc.encoding=
   66.44 +javadoc.noindex=false
   66.45 +javadoc.nonavbar=false
   66.46 +javadoc.notree=false
   66.47 +javadoc.private=false
   66.48 +javadoc.splitindex=true
   66.49 +javadoc.use=true
   66.50 +javadoc.version=false
   66.51 +javadoc.windowtitle=
   66.52 +jnlp.codebase.type=local
   66.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   66.54 +jnlp.descriptor=application
   66.55 +jnlp.enabled=false
   66.56 +jnlp.offline-allowed=false
   66.57 +jnlp.signed=false
   66.58 +meta.inf.dir=${src.dir}/META-INF
   66.59 +platform.active=default_platform
   66.60 +run.classpath=\
   66.61 +    ${javac.classpath}:\
   66.62 +    ${build.classes.dir}
   66.63 +# Space-separated list of JVM arguments used when running the project
   66.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   66.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   66.66 +run.jvmargs=
   66.67 +run.test.classpath=\
   66.68 +    ${javac.test.classpath}:\
   66.69 +    ${build.test.classes.dir}
   66.70 +src.dir=src
   66.71 +test.src.dir=test
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/task1/solution06/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    67.3 @@ -0,0 +1,16 @@
    67.4 +<?xml version="1.0" encoding="UTF-8"?>
    67.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    67.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    67.7 +    <configuration>
    67.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    67.9 +            <name>Currency Convertor Solution 06</name>
   67.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   67.11 +            <source-roots>
   67.12 +                <root id="src.dir"/>
   67.13 +            </source-roots>
   67.14 +            <test-roots>
   67.15 +                <root id="test.src.dir"/>
   67.16 +            </test-roots>
   67.17 +        </data>
   67.18 +    </configuration>
   67.19 +</project>
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Amount.java	Sun Sep 28 14:12:38 2008 +0200
    68.3 @@ -0,0 +1,80 @@
    68.4 +package org.apidesign.apifest08.currency;
    68.5 +
    68.6 +import java.math.BigDecimal;
    68.7 +import java.math.RoundingMode;
    68.8 +import java.util.Currency;
    68.9 +import static org.apidesign.apifest08.currency.Assert.*;
   68.10 +
   68.11 +/**
   68.12 + * An amount representation. Amount is represented as composition of a value and 
   68.13 + * a currency.
   68.14 + */
   68.15 +public final class Amount {
   68.16 +	
   68.17 +	private final BigDecimal value;
   68.18 +	private final Currency currency;
   68.19 +	private final int scale;
   68.20 +	private final RoundingMode roundingMode;
   68.21 +	
   68.22 +	public static final RoundingMode DEFAULT_ROUNDING = RoundingMode.HALF_EVEN; 
   68.23 +	
   68.24 +	public Amount(final BigDecimal value, final Currency currency) {
   68.25 +		notNull(value, "value");
   68.26 +		notNull(currency, "currency");
   68.27 +		this.value = value;
   68.28 +		this.currency = currency;
   68.29 +		this.scale = currency.getDefaultFractionDigits();
   68.30 +		this.roundingMode = DEFAULT_ROUNDING;
   68.31 +	}
   68.32 +	
   68.33 +	public Amount(final BigDecimal value, final Currency currency, final RoundingMode roundingMode) {
   68.34 +		notNull(value, "value");
   68.35 +		notNull(currency, "currency");
   68.36 +		notNull(roundingMode, "roundingMode");
   68.37 +		
   68.38 +		this.value = value;
   68.39 +		this.currency = currency;
   68.40 +		this.scale = currency.getDefaultFractionDigits();
   68.41 +		this.roundingMode = roundingMode;
   68.42 +	}
   68.43 +	
   68.44 +	public Amount(final long value, final Currency currency) {
   68.45 +		this(BigDecimal.valueOf(value), currency);
   68.46 +	}
   68.47 +	
   68.48 +	public Amount(final String value, final Currency currency) {
   68.49 +		this(new BigDecimal(value), currency);
   68.50 +	}
   68.51 +	
   68.52 +	/**
   68.53 +	 * @return the value with scale of the associated currency and rounded by 
   68.54 +	 * the rounding mode. 
   68.55 +	 */
   68.56 +	public BigDecimal getValue() {
   68.57 +		return value.setScale(scale, roundingMode);
   68.58 +	}
   68.59 +	
   68.60 +	/**
   68.61 +	 * @return the raw (no explicit scale, no explicit rounding) value 
   68.62 +	 */
   68.63 +	public BigDecimal getRawValue() {
   68.64 +		return value;
   68.65 +	}
   68.66 +	
   68.67 +	public Currency getCurrency() {
   68.68 +		return currency;
   68.69 +	}
   68.70 +
   68.71 +	public int getScale() {
   68.72 +		return scale;
   68.73 +	}
   68.74 +
   68.75 +	public RoundingMode getRoundingMode() {
   68.76 +		return roundingMode;
   68.77 +	}
   68.78 +
   68.79 +	@Override
   68.80 +	public String toString() {
   68.81 +		return value + ",- " + currency.toString();
   68.82 +	}	
   68.83 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Assert.java	Sun Sep 28 14:12:38 2008 +0200
    69.3 @@ -0,0 +1,9 @@
    69.4 +package org.apidesign.apifest08.currency;
    69.5 +
    69.6 +public class Assert {
    69.7 +	static void notNull(Object value, String argumentName) {
    69.8 +		if(value == null) {
    69.9 +			throw new IllegalArgumentException("The argument '" + argumentName + "' connot not be null");
   69.10 +		}
   69.11 +	}
   69.12 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Bid.java	Sun Sep 28 14:12:38 2008 +0200
    70.3 @@ -0,0 +1,74 @@
    70.4 +package org.apidesign.apifest08.currency;
    70.5 +
    70.6 +import java.math.BigDecimal;
    70.7 +import java.math.RoundingMode;
    70.8 +import java.util.Currency;
    70.9 +import static org.apidesign.apifest08.currency.Assert.*;
   70.10 +
   70.11 +
   70.12 +/**
   70.13 + * A bid representation. A did is defined as two currenncies and its value. 
   70.14 + */
   70.15 +public final class Bid {
   70.16 +	private final Currency first;
   70.17 +	private final Currency second;
   70.18 +	private final BigDecimal bidValue; // a bid between the first currency and the second currency
   70.19 +	public static final BigDecimal one = new BigDecimal(1);		
   70.20 +	
   70.21 +	Bid(Currency first, Currency second, BigDecimal bid) {
   70.22 +		notNull(first, "first");
   70.23 +		notNull(second, "second");
   70.24 +		this.first = first;
   70.25 +		this.bidValue = bid;
   70.26 +		this.second = second;	
   70.27 +	}
   70.28 +	
   70.29 +	Bid(Currency first, Currency second) {
   70.30 +		notNull(first, "first");
   70.31 +		notNull(second, "second");
   70.32 +		this.first = first;
   70.33 +		this.second = second;
   70.34 +		this.bidValue = null;
   70.35 +	}
   70.36 +	
   70.37 +			
   70.38 +	BigDecimal getBidValue(Currency from, Currency to) {
   70.39 +		if((from != first || from != second) || (to != first || to != second)) {
   70.40 +			new IllegalArgumentException("This bid can be used only for: " + first + " " + second);
   70.41 +		}
   70.42 +		
   70.43 +		notNull(bidValue, "bidValue");
   70.44 +		
   70.45 +		BigDecimal retVal;
   70.46 +		
   70.47 +		if(first == from) {
   70.48 +			retVal = bidValue;
   70.49 +		} else {	
   70.50 +			//reverse bid		
   70.51 +			retVal = one.divide(bidValue, 10 ,RoundingMode.HALF_UP);
   70.52 +		}
   70.53 +		
   70.54 +		return retVal;
   70.55 +	}
   70.56 +
   70.57 +	@Override
   70.58 +	public int hashCode() {
   70.59 +		final int prime = 31;
   70.60 +		int result = 1;
   70.61 +		result = prime * result + first.hashCode() +  second.hashCode();
   70.62 +		return result;
   70.63 +	}
   70.64 +	
   70.65 +	@Override
   70.66 +	public boolean equals(Object obj) {
   70.67 +		if (this == obj)
   70.68 +			return true;
   70.69 +		if (obj == null)
   70.70 +			return false;
   70.71 +		if (getClass() != obj.getClass())
   70.72 +			return false;
   70.73 +		Bid other = (Bid) obj;
   70.74 +		
   70.75 +		return (this.first == other.first || this.first == other.second) && (this.second == other.second || this.second == other.first) ;
   70.76 +	}		
   70.77 +}
   70.78 \ No newline at end of file
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/ConversionException.java	Sun Sep 28 14:12:38 2008 +0200
    71.3 @@ -0,0 +1,26 @@
    71.4 +package org.apidesign.apifest08.currency;
    71.5 +
    71.6 +/**
    71.7 + * Indicates that a desired conversion cannot be performed.
    71.8 + */
    71.9 +public class ConversionException extends CurrencyException {
   71.10 +	
   71.11 +	private static final long serialVersionUID = 1L;
   71.12 +
   71.13 +	public ConversionException() {
   71.14 +		super();
   71.15 +	}
   71.16 +
   71.17 +	public ConversionException(String message, Throwable cause) {
   71.18 +		super(message, cause);		
   71.19 +	}
   71.20 +
   71.21 +	public ConversionException(String message) {
   71.22 +		super(message);
   71.23 +	}
   71.24 +
   71.25 +	public ConversionException(Throwable cause) {
   71.26 +		super(cause);
   71.27 +	}
   71.28 +	
   71.29 +}
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    72.3 @@ -0,0 +1,32 @@
    72.4 +package org.apidesign.apifest08.currency;
    72.5 +
    72.6 +import java.math.BigDecimal;
    72.7 +import java.util.Currency;
    72.8 +
    72.9 +public abstract class Convertor {
   72.10 +    
   72.11 +   /**
   72.12 +    * Converts an amount to another amount according to a given currency.
   72.13 +    *  
   72.14 +	* @param from a source 
   72.15 +	* @param toCurrency a target currency
   72.16 +	* @return a converted amount
   72.17 +	* @throws ConversionException if the conversion fails
   72.18 +	* @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
   72.19 +	*/
   72.20 +	public abstract Amount convert(Amount from, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
   72.21 +	
   72.22 +	/**
   72.23 +	 * Converts an amount value between two currencies.
   72.24 +	 *  
   72.25 +	 * @param amount an amount
   72.26 +	 * @param fromCurrency an amount currency
   72.27 +	 * @param toCurrency to a target currency
   72.28 +	 * @return a converted amount value
   72.29 +	 * 
   72.30 +	 * @throws ConversionException if the conversion fails
   72.31 +	 * @throws UnsupportedConversionException if the conversion between a given currencies is not supported.
   72.32 +	 */
   72.33 +	public abstract Amount convert(BigDecimal amount, Currency fromCurrency, Currency toCurrency) throws ConversionException, UnsupportedConversionException;
   72.34 +
   72.35 +}
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/ConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
    73.3 @@ -0,0 +1,65 @@
    73.4 +package org.apidesign.apifest08.currency;
    73.5 +
    73.6 +import static org.apidesign.apifest08.currency.Assert.notNull;
    73.7 +
    73.8 +import java.math.BigDecimal;
    73.9 +import java.math.RoundingMode;
   73.10 +import java.util.ArrayList;
   73.11 +import java.util.Currency;
   73.12 +import java.util.List;
   73.13 +
   73.14 +/**
   73.15 + * The factory for {@link Convertor}.
   73.16 + * 
   73.17 + * @see #newInstance()
   73.18 + */
   73.19 +public final class ConvertorFactory {
   73.20 +	//do not expose constructor
   73.21 +	private ConvertorFactory(){}
   73.22 +	
   73.23 +	/**
   73.24 +	 * @return a convertor instance. 
   73.25 +	 *  
   73.26 +	 * @throws CurrencyException in a convertor cannot be instantiated
   73.27 +	 */
   73.28 +	public static Convertor newInstance() throws CurrencyException{
   73.29 +		return new DefaultConvertor();
   73.30 +	}
   73.31 +	
   73.32 +	private static final class DefaultConvertor extends  Convertor {
   73.33 +		private List<Bid> bids;
   73.34 +		
   73.35 +		private DefaultConvertor() {
   73.36 +			bids = new ArrayList<Bid>();
   73.37 +			Bid usdCzk = new Bid(Currencies.USD, Currencies.CZK, new BigDecimal("17"));
   73.38 +			bids.add(usdCzk);
   73.39 +			Bid skCzk = new Bid(Currencies.SKK, Currencies.CZK, new BigDecimal("0.8"));
   73.40 +			bids.add(skCzk);
   73.41 +		}
   73.42 +		
   73.43 +		@Override
   73.44 +		public Amount convert(Amount from, Currency targetCurrency)
   73.45 +				throws CurrencyException {
   73.46 +			return convert(from.getValue(), from.getCurrency(), targetCurrency);
   73.47 +			
   73.48 +		}
   73.49 +
   73.50 +		@Override
   73.51 +		public Amount convert(BigDecimal amount, Currency from,
   73.52 +				Currency targetCurrency) throws ConversionException,
   73.53 +				UnsupportedConversionException {
   73.54 +			notNull(from, "from");
   73.55 +			notNull(targetCurrency, "targetCurrency");
   73.56 +			
   73.57 +			int index = bids.indexOf(new Bid(from, targetCurrency));
   73.58 +			if(index == -1) {
   73.59 +				throw new UnsupportedConversionException(from, targetCurrency);
   73.60 +			}
   73.61 +			Bid bid = bids.get(index);
   73.62 +			BigDecimal bidValue = bid.getBidValue(from, targetCurrency);
   73.63 +			BigDecimal result = bidValue.multiply(amount);			
   73.64 +			return new Amount(result, targetCurrency);
   73.65 +		}
   73.66 +
   73.67 +   }
   73.68 +}
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/Currencies.java	Sun Sep 28 14:12:38 2008 +0200
    74.3 @@ -0,0 +1,9 @@
    74.4 +package org.apidesign.apifest08.currency;
    74.5 +
    74.6 +import java.util.Currency;
    74.7 +
    74.8 +public class Currencies {
    74.9 +	public static final Currency CZK = Currency.getInstance("CZK");
   74.10 +	public static final Currency SKK = Currency.getInstance("SKK");
   74.11 +	public static final Currency USD = Currency.getInstance("USD");
   74.12 +}
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/CurrencyException.java	Sun Sep 28 14:12:38 2008 +0200
    75.3 @@ -0,0 +1,25 @@
    75.4 +package org.apidesign.apifest08.currency;
    75.5 +
    75.6 +/**
    75.7 + * Top level runtime exception for 'currency' API.
    75.8 + */
    75.9 +public class CurrencyException extends RuntimeException{
   75.10 +
   75.11 +	private static final long serialVersionUID = 1L;
   75.12 +
   75.13 +	public CurrencyException() {
   75.14 +		super();		
   75.15 +	}
   75.16 +
   75.17 +	public CurrencyException(String message, Throwable cause) {
   75.18 +		super(message, cause);		
   75.19 +	}
   75.20 +
   75.21 +	public CurrencyException(String message) {
   75.22 +		super(message);		
   75.23 +	}
   75.24 +
   75.25 +	public CurrencyException(Throwable cause) {
   75.26 +		super(cause);		
   75.27 +	}
   75.28 +}
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/task1/solution06/src/org/apidesign/apifest08/currency/UnsupportedConversionException.java	Sun Sep 28 14:12:38 2008 +0200
    76.3 @@ -0,0 +1,27 @@
    76.4 +package org.apidesign.apifest08.currency;
    76.5 +
    76.6 +import java.util.Currency;
    76.7 +
    76.8 +public class UnsupportedConversionException extends ConversionException{
    76.9 +
   76.10 +	private static final long serialVersionUID = 1L; 
   76.11 +	
   76.12 +	private Currency from;
   76.13 +	private Currency to;
   76.14 +
   76.15 +	public UnsupportedConversionException(Currency from, Currency to) {
   76.16 +		super("Conversion from  the currency " + from + " to the currency " + to + " or vice versa in not supported yet. Missing bid.");
   76.17 +		this.from = from;
   76.18 +		this.to = to;
   76.19 +	}
   76.20 +
   76.21 +	public Currency getFrom() {
   76.22 +		return from;
   76.23 +	}
   76.24 +
   76.25 +	public Currency getTo() {
   76.26 +		return to;
   76.27 +	}
   76.28 +	
   76.29 +	
   76.30 +}
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/task1/solution06/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    77.3 @@ -0,0 +1,101 @@
    77.4 +package org.apidesign.apifest08.test;
    77.5 +
    77.6 +import static org.apidesign.apifest08.currency.Currencies.CZK;
    77.7 +import static org.apidesign.apifest08.currency.Currencies.SKK;
    77.8 +import static org.apidesign.apifest08.currency.Currencies.USD;
    77.9 +
   77.10 +import java.math.BigDecimal;
   77.11 +
   77.12 +import junit.framework.TestCase;
   77.13 +
   77.14 +import org.apidesign.apifest08.currency.Amount;
   77.15 +import org.apidesign.apifest08.currency.Convertor;
   77.16 +import org.apidesign.apifest08.currency.ConvertorFactory;
   77.17 +import org.apidesign.apifest08.currency.UnsupportedConversionException;
   77.18 +
   77.19 +/** Finish the Convertor API, and then write bodies of methods inside
   77.20 + * of this class to match the given tasks. To fullfil your task, use the
   77.21 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   77.22 + * Do not you reflection, or other hacks as your code
   77.23 + * shall run without any runtime permissions.
   77.24 + */
   77.25 +public class Task1Test extends TestCase {
   77.26 +    public Task1Test(String testName) {
   77.27 +        super(testName);
   77.28 +    }
   77.29 +
   77.30 +    @Override
   77.31 +    protected void setUp() throws Exception {
   77.32 +    }
   77.33 +
   77.34 +    @Override
   77.35 +    protected void tearDown() throws Exception {
   77.36 +    }
   77.37 +
   77.38 +    /** Create convertor that understands two currencies, CZK and
   77.39 +     *  USD. Make 1 USD == 17 CZK.
   77.40 +     *
   77.41 +     * Creation of the convertor shall not require subclassing of any class
   77.42 +     * or interface on the client side.
   77.43 +     *
   77.44 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   77.45 +     */
   77.46 +    public static Convertor createCZKtoUSD() {
   77.47 +        return ConvertorFactory.newInstance();
   77.48 +    }
   77.49 +
   77.50 +    /** Create convertor that understands two currencies, CZK and
   77.51 +     *  SKK. Make 100 SKK == 80 CZK.
   77.52 +     *
   77.53 +     * Creation of the convertor shall not require subclassing of any class
   77.54 +     * or interface on the client side.
   77.55 +     * 
   77.56 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   77.57 +     */
   77.58 +    public static Convertor createSKKtoCZK() {
   77.59 +    	return ConvertorFactory.newInstance();
   77.60 +    }
   77.61 +    
   77.62 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   77.63 +     * with it.
   77.64 +     */
   77.65 +    public void testCurrencyCZKUSD() throws Exception {
   77.66 +        Convertor c = createCZKtoUSD();
   77.67 +        // convert $5 to CZK using c:
   77.68 +        Amount result =  c.convert(new BigDecimal(5), USD, CZK);
   77.69 +        assertEquals("Result is 85 CZK", 85, result.getValue().intValue());
   77.70 +
   77.71 +        // convert $8 to CZK
   77.72 +        result =  c.convert(new BigDecimal(8), USD, CZK);        
   77.73 +        assertEquals("Result is 136 CZK", 136, result.getValue().intValue());
   77.74 +
   77.75 +        // convert 1003CZK to USD
   77.76 +        result =  c.convert(new BigDecimal(1003), CZK, USD);
   77.77 +        assertEquals("Result is 59 USD", 59, result.getValue().intValue());
   77.78 +    }
   77.79 +
   77.80 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   77.81 +     * with it.
   77.82 +     */
   77.83 +    public void testCurrencySKKCZK() throws Exception {
   77.84 +        Convertor c = createSKKtoCZK();
   77.85 +        // convert 16CZK using c:
   77.86 +        Amount result =  c.convert(new BigDecimal(16), CZK, SKK);
   77.87 +        assertEquals("Result is 20 SKK", 20, result.getValue().intValue());
   77.88 +
   77.89 +        // convert 500SKK to CZK
   77.90 +        result =  c.convert(new BigDecimal(500), SKK, CZK);
   77.91 +        assertEquals("Result is 400 CZK", 400, result.getValue().intValue());
   77.92 +    }
   77.93 +    
   77.94 +    public void testUnssuportedConversion(){
   77.95 +    	Convertor c = ConvertorFactory.newInstance();
   77.96 +    	try {
   77.97 +    		c.convert(new BigDecimal(5), USD, SKK);
   77.98 +    		fail();
   77.99 +    	} catch(UnsupportedConversionException e) {
  77.100 +    		//expected    		
  77.101 +    	}    	
  77.102 +    }
  77.103 +}
  77.104 +
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/task1/solution07/build.xml	Sun Sep 28 14:12:38 2008 +0200
    78.3 @@ -0,0 +1,69 @@
    78.4 +<?xml version="1.0" encoding="UTF-8"?>
    78.5 +<!-- You may freely edit this file. See commented blocks below for -->
    78.6 +<!-- some examples of how to customize the build. -->
    78.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    78.8 +<project name="currency" default="default" basedir=".">
    78.9 +    <description>Builds, tests, and runs the project.</description>
   78.10 +    <import file="nbproject/build-impl.xml"/>
   78.11 +    <!--
   78.12 +
   78.13 +    There exist several targets which are by default empty and which can be 
   78.14 +    used for execution of your tasks. These targets are usually executed 
   78.15 +    before and after some main targets. They are: 
   78.16 +
   78.17 +      -pre-init:                 called before initialization of project properties
   78.18 +      -post-init:                called after initialization of project properties
   78.19 +      -pre-compile:              called before javac compilation
   78.20 +      -post-compile:             called after javac compilation
   78.21 +      -pre-compile-single:       called before javac compilation of single file
   78.22 +      -post-compile-single:      called after javac compilation of single file
   78.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   78.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   78.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   78.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   78.27 +      -pre-jar:                  called before JAR building
   78.28 +      -post-jar:                 called after JAR building
   78.29 +      -post-clean:               called after cleaning build products
   78.30 +
   78.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   78.32 +
   78.33 +    Example of inserting an obfuscator after compilation could look like this:
   78.34 +
   78.35 +        <target name="-post-compile">
   78.36 +            <obfuscate>
   78.37 +                <fileset dir="${build.classes.dir}"/>
   78.38 +            </obfuscate>
   78.39 +        </target>
   78.40 +
   78.41 +    For list of available properties check the imported 
   78.42 +    nbproject/build-impl.xml file. 
   78.43 +
   78.44 +
   78.45 +    Another way to customize the build is by overriding existing main targets.
   78.46 +    The targets of interest are: 
   78.47 +
   78.48 +      -init-macrodef-javac:     defines macro for javac compilation
   78.49 +      -init-macrodef-junit:     defines macro for junit execution
   78.50 +      -init-macrodef-debug:     defines macro for class debugging
   78.51 +      -init-macrodef-java:      defines macro for class execution
   78.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   78.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   78.54 +      run:                      execution of project 
   78.55 +      -javadoc-build:           Javadoc generation
   78.56 +      test-report:              JUnit report generation
   78.57 +
   78.58 +    An example of overriding the target for project execution could look like this:
   78.59 +
   78.60 +        <target name="run" depends="currency-impl.jar">
   78.61 +            <exec dir="bin" executable="launcher.exe">
   78.62 +                <arg file="${dist.jar}"/>
   78.63 +            </exec>
   78.64 +        </target>
   78.65 +
   78.66 +    Notice that the overridden target depends on the jar target and not only on 
   78.67 +    the compile target as the regular run target does. Again, for a list of available 
   78.68 +    properties which you can use, check the target you are overriding in the
   78.69 +    nbproject/build-impl.xml file. 
   78.70 +
   78.71 +    -->
   78.72 +</project>
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/task1/solution07/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    79.3 @@ -0,0 +1,642 @@
    79.4 +<?xml version="1.0" encoding="UTF-8"?>
    79.5 +<!--
    79.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    79.7 +***         EDIT ../build.xml INSTEAD         ***
    79.8 +
    79.9 +For the purpose of easier reading the script
   79.10 +is divided into following sections:
   79.11 +
   79.12 +  - initialization
   79.13 +  - compilation
   79.14 +  - jar
   79.15 +  - execution
   79.16 +  - debugging
   79.17 +  - javadoc
   79.18 +  - junit compilation
   79.19 +  - junit execution
   79.20 +  - junit debugging
   79.21 +  - applet
   79.22 +  - cleanup
   79.23 +
   79.24 +        -->
   79.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_07-impl">
   79.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   79.27 +    <!-- 
   79.28 +                ======================
   79.29 +                INITIALIZATION SECTION 
   79.30 +                ======================
   79.31 +            -->
   79.32 +    <target name="-pre-init">
   79.33 +        <!-- Empty placeholder for easier customization. -->
   79.34 +        <!-- You can override this target in the ../build.xml file. -->
   79.35 +    </target>
   79.36 +    <target depends="-pre-init" name="-init-private">
   79.37 +        <property file="nbproject/private/config.properties"/>
   79.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   79.39 +        <property file="nbproject/private/private.properties"/>
   79.40 +    </target>
   79.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   79.42 +        <property file="${user.properties.file}"/>
   79.43 +        <!-- The two properties below are usually overridden -->
   79.44 +        <!-- by the active platform. Just a fallback. -->
   79.45 +        <property name="default.javac.source" value="1.4"/>
   79.46 +        <property name="default.javac.target" value="1.4"/>
   79.47 +    </target>
   79.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   79.49 +        <property file="nbproject/configs/${config}.properties"/>
   79.50 +        <property file="nbproject/project.properties"/>
   79.51 +    </target>
   79.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   79.53 +        <available file="${manifest.file}" property="manifest.available"/>
   79.54 +        <condition property="manifest.available+main.class">
   79.55 +            <and>
   79.56 +                <isset property="manifest.available"/>
   79.57 +                <isset property="main.class"/>
   79.58 +                <not>
   79.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   79.60 +                </not>
   79.61 +            </and>
   79.62 +        </condition>
   79.63 +        <condition property="manifest.available+main.class+mkdist.available">
   79.64 +            <and>
   79.65 +                <istrue value="${manifest.available+main.class}"/>
   79.66 +                <isset property="libs.CopyLibs.classpath"/>
   79.67 +            </and>
   79.68 +        </condition>
   79.69 +        <condition property="have.tests">
   79.70 +            <or>
   79.71 +                <available file="${test.src.dir}"/>
   79.72 +            </or>
   79.73 +        </condition>
   79.74 +        <condition property="have.sources">
   79.75 +            <or>
   79.76 +                <available file="${src.dir}"/>
   79.77 +            </or>
   79.78 +        </condition>
   79.79 +        <condition property="netbeans.home+have.tests">
   79.80 +            <and>
   79.81 +                <isset property="netbeans.home"/>
   79.82 +                <isset property="have.tests"/>
   79.83 +            </and>
   79.84 +        </condition>
   79.85 +        <condition property="no.javadoc.preview">
   79.86 +            <and>
   79.87 +                <isset property="javadoc.preview"/>
   79.88 +                <isfalse value="${javadoc.preview}"/>
   79.89 +            </and>
   79.90 +        </condition>
   79.91 +        <property name="run.jvmargs" value=""/>
   79.92 +        <property name="javac.compilerargs" value=""/>
   79.93 +        <property name="work.dir" value="${basedir}"/>
   79.94 +        <condition property="no.deps">
   79.95 +            <and>
   79.96 +                <istrue value="${no.dependencies}"/>
   79.97 +            </and>
   79.98 +        </condition>
   79.99 +        <property name="javac.debug" value="true"/>
  79.100 +        <property name="javadoc.preview" value="true"/>
  79.101 +        <property name="application.args" value=""/>
  79.102 +        <property name="source.encoding" value="${file.encoding}"/>
  79.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  79.104 +            <and>
  79.105 +                <isset property="javadoc.encoding"/>
  79.106 +                <not>
  79.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  79.108 +                </not>
  79.109 +            </and>
  79.110 +        </condition>
  79.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  79.112 +        <property name="includes" value="**"/>
  79.113 +        <property name="excludes" value=""/>
  79.114 +        <property name="do.depend" value="false"/>
  79.115 +        <condition property="do.depend.true">
  79.116 +            <istrue value="${do.depend}"/>
  79.117 +        </condition>
  79.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  79.119 +            <and>
  79.120 +                <isset property="jaxws.endorsed.dir"/>
  79.121 +                <available file="nbproject/jaxws-build.xml"/>
  79.122 +            </and>
  79.123 +        </condition>
  79.124 +    </target>
  79.125 +    <target name="-post-init">
  79.126 +        <!-- Empty placeholder for easier customization. -->
  79.127 +        <!-- You can override this target in the ../build.xml file. -->
  79.128 +    </target>
  79.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  79.130 +        <fail unless="src.dir">Must set src.dir</fail>
  79.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  79.132 +        <fail unless="build.dir">Must set build.dir</fail>
  79.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  79.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  79.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  79.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  79.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  79.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  79.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  79.140 +    </target>
  79.141 +    <target name="-init-macrodef-property">
  79.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  79.143 +            <attribute name="name"/>
  79.144 +            <attribute name="value"/>
  79.145 +            <sequential>
  79.146 +                <property name="@{name}" value="${@{value}}"/>
  79.147 +            </sequential>
  79.148 +        </macrodef>
  79.149 +    </target>
  79.150 +    <target name="-init-macrodef-javac">
  79.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  79.152 +            <attribute default="${src.dir}" name="srcdir"/>
  79.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  79.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  79.155 +            <attribute default="${includes}" name="includes"/>
  79.156 +            <attribute default="${excludes}" name="excludes"/>
  79.157 +            <attribute default="${javac.debug}" name="debug"/>
  79.158 +            <attribute default="" name="sourcepath"/>
  79.159 +            <element name="customize" optional="true"/>
  79.160 +            <sequential>
  79.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  79.162 +                    <classpath>
  79.163 +                        <path path="@{classpath}"/>
  79.164 +                    </classpath>
  79.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  79.166 +                    <customize/>
  79.167 +                </javac>
  79.168 +            </sequential>
  79.169 +        </macrodef>
  79.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  79.171 +            <attribute default="${src.dir}" name="srcdir"/>
  79.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  79.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  79.174 +            <sequential>
  79.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  79.176 +                    <classpath>
  79.177 +                        <path path="@{classpath}"/>
  79.178 +                    </classpath>
  79.179 +                </depend>
  79.180 +            </sequential>
  79.181 +        </macrodef>
  79.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  79.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  79.184 +            <sequential>
  79.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  79.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  79.187 +                    <path>
  79.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  79.189 +                    </path>
  79.190 +                    <globmapper from="*.java" to="*.class"/>
  79.191 +                </pathconvert>
  79.192 +                <delete>
  79.193 +                    <files includes="${javac.includes.binary}"/>
  79.194 +                </delete>
  79.195 +            </sequential>
  79.196 +        </macrodef>
  79.197 +    </target>
  79.198 +    <target name="-init-macrodef-junit">
  79.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  79.200 +            <attribute default="${includes}" name="includes"/>
  79.201 +            <attribute default="${excludes}" name="excludes"/>
  79.202 +            <attribute default="**" name="testincludes"/>
  79.203 +            <sequential>
  79.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  79.205 +                    <batchtest todir="${build.test.results.dir}">
  79.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  79.207 +                            <filename name="@{testincludes}"/>
  79.208 +                        </fileset>
  79.209 +                    </batchtest>
  79.210 +                    <classpath>
  79.211 +                        <path path="${run.test.classpath}"/>
  79.212 +                    </classpath>
  79.213 +                    <syspropertyset>
  79.214 +                        <propertyref prefix="test-sys-prop."/>
  79.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  79.216 +                    </syspropertyset>
  79.217 +                    <formatter type="brief" usefile="false"/>
  79.218 +                    <formatter type="xml"/>
  79.219 +                    <jvmarg line="${run.jvmargs}"/>
  79.220 +                </junit>
  79.221 +            </sequential>
  79.222 +        </macrodef>
  79.223 +    </target>
  79.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  79.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  79.226 +            <attribute default="${main.class}" name="name"/>
  79.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  79.228 +            <attribute default="" name="stopclassname"/>
  79.229 +            <sequential>
  79.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  79.231 +                    <classpath>
  79.232 +                        <path path="@{classpath}"/>
  79.233 +                    </classpath>
  79.234 +                </nbjpdastart>
  79.235 +            </sequential>
  79.236 +        </macrodef>
  79.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  79.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  79.239 +            <sequential>
  79.240 +                <nbjpdareload>
  79.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  79.242 +                        <include name="${fix.includes}*.class"/>
  79.243 +                    </fileset>
  79.244 +                </nbjpdareload>
  79.245 +            </sequential>
  79.246 +        </macrodef>
  79.247 +    </target>
  79.248 +    <target name="-init-debug-args">
  79.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  79.250 +        <condition property="have-jdk-older-than-1.4">
  79.251 +            <or>
  79.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  79.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  79.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  79.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  79.256 +            </or>
  79.257 +        </condition>
  79.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  79.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  79.260 +        </condition>
  79.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  79.262 +            <os family="windows"/>
  79.263 +        </condition>
  79.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  79.265 +            <isset property="debug.transport"/>
  79.266 +        </condition>
  79.267 +    </target>
  79.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  79.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  79.270 +            <attribute default="${main.class}" name="classname"/>
  79.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  79.272 +            <element name="customize" optional="true"/>
  79.273 +            <sequential>
  79.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  79.275 +                    <jvmarg line="${debug-args-line}"/>
  79.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  79.277 +                    <jvmarg line="${run.jvmargs}"/>
  79.278 +                    <classpath>
  79.279 +                        <path path="@{classpath}"/>
  79.280 +                    </classpath>
  79.281 +                    <syspropertyset>
  79.282 +                        <propertyref prefix="run-sys-prop."/>
  79.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  79.284 +                    </syspropertyset>
  79.285 +                    <customize/>
  79.286 +                </java>
  79.287 +            </sequential>
  79.288 +        </macrodef>
  79.289 +    </target>
  79.290 +    <target name="-init-macrodef-java">
  79.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  79.292 +            <attribute default="${main.class}" name="classname"/>
  79.293 +            <element name="customize" optional="true"/>
  79.294 +            <sequential>
  79.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  79.296 +                    <jvmarg line="${run.jvmargs}"/>
  79.297 +                    <classpath>
  79.298 +                        <path path="${run.classpath}"/>
  79.299 +                    </classpath>
  79.300 +                    <syspropertyset>
  79.301 +                        <propertyref prefix="run-sys-prop."/>
  79.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  79.303 +                    </syspropertyset>
  79.304 +                    <customize/>
  79.305 +                </java>
  79.306 +            </sequential>
  79.307 +        </macrodef>
  79.308 +    </target>
  79.309 +    <target name="-init-presetdef-jar">
  79.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  79.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  79.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  79.313 +            </jar>
  79.314 +        </presetdef>
  79.315 +    </target>
  79.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  79.317 +    <!--
  79.318 +                ===================
  79.319 +                COMPILATION SECTION
  79.320 +                ===================
  79.321 +            -->
  79.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  79.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  79.324 +    <target depends="init" name="-check-automatic-build">
  79.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  79.326 +    </target>
  79.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  79.328 +        <antcall target="clean"/>
  79.329 +    </target>
  79.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  79.331 +        <mkdir dir="${build.classes.dir}"/>
  79.332 +    </target>
  79.333 +    <target name="-pre-compile">
  79.334 +        <!-- Empty placeholder for easier customization. -->
  79.335 +        <!-- You can override this target in the ../build.xml file. -->
  79.336 +    </target>
  79.337 +    <target if="do.depend.true" name="-compile-depend">
  79.338 +        <j2seproject3:depend/>
  79.339 +    </target>
  79.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  79.341 +        <j2seproject3:javac/>
  79.342 +        <copy todir="${build.classes.dir}">
  79.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  79.344 +        </copy>
  79.345 +    </target>
  79.346 +    <target name="-post-compile">
  79.347 +        <!-- Empty placeholder for easier customization. -->
  79.348 +        <!-- You can override this target in the ../build.xml file. -->
  79.349 +    </target>
  79.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  79.351 +    <target name="-pre-compile-single">
  79.352 +        <!-- Empty placeholder for easier customization. -->
  79.353 +        <!-- You can override this target in the ../build.xml file. -->
  79.354 +    </target>
  79.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  79.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  79.357 +        <j2seproject3:force-recompile/>
  79.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  79.359 +    </target>
  79.360 +    <target name="-post-compile-single">
  79.361 +        <!-- Empty placeholder for easier customization. -->
  79.362 +        <!-- You can override this target in the ../build.xml file. -->
  79.363 +    </target>
  79.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  79.365 +    <!--
  79.366 +                ====================
  79.367 +                JAR BUILDING SECTION
  79.368 +                ====================
  79.369 +            -->
  79.370 +    <target depends="init" name="-pre-pre-jar">
  79.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  79.372 +        <mkdir dir="${dist.jar.dir}"/>
  79.373 +    </target>
  79.374 +    <target name="-pre-jar">
  79.375 +        <!-- Empty placeholder for easier customization. -->
  79.376 +        <!-- You can override this target in the ../build.xml file. -->
  79.377 +    </target>
  79.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  79.379 +        <j2seproject1:jar/>
  79.380 +    </target>
  79.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  79.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  79.383 +    </target>
  79.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  79.385 +        <j2seproject1:jar manifest="${manifest.file}">
  79.386 +            <j2seproject1:manifest>
  79.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  79.388 +            </j2seproject1:manifest>
  79.389 +        </j2seproject1:jar>
  79.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  79.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  79.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  79.393 +        <pathconvert property="run.classpath.with.dist.jar">
  79.394 +            <path path="${run.classpath}"/>
  79.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  79.396 +        </pathconvert>
  79.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  79.398 +    </target>
  79.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  79.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  79.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  79.402 +            <path path="${run.classpath}"/>
  79.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  79.404 +        </pathconvert>
  79.405 +        <pathconvert pathsep=" " property="jar.classpath">
  79.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  79.407 +            <chainedmapper>
  79.408 +                <flattenmapper/>
  79.409 +                <globmapper from="*" to="lib/*"/>
  79.410 +            </chainedmapper>
  79.411 +        </pathconvert>
  79.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  79.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  79.414 +            <fileset dir="${build.classes.dir}"/>
  79.415 +            <manifest>
  79.416 +                <attribute name="Main-Class" value="${main.class}"/>
  79.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  79.418 +            </manifest>
  79.419 +        </copylibs>
  79.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  79.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  79.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  79.423 +    </target>
  79.424 +    <target name="-post-jar">
  79.425 +        <!-- Empty placeholder for easier customization. -->
  79.426 +        <!-- You can override this target in the ../build.xml file. -->
  79.427 +    </target>
  79.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  79.429 +    <!--
  79.430 +                =================
  79.431 +                EXECUTION SECTION
  79.432 +                =================
  79.433 +            -->
  79.434 +    <target depends="init,compile" description="Run a main class." name="run">
  79.435 +        <j2seproject1:java>
  79.436 +            <customize>
  79.437 +                <arg line="${application.args}"/>
  79.438 +            </customize>
  79.439 +        </j2seproject1:java>
  79.440 +    </target>
  79.441 +    <target name="-do-not-recompile">
  79.442 +        <property name="javac.includes.binary" value=""/>
  79.443 +    </target>
  79.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  79.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  79.446 +        <j2seproject1:java classname="${run.class}"/>
  79.447 +    </target>
  79.448 +    <!--
  79.449 +                =================
  79.450 +                DEBUGGING SECTION
  79.451 +                =================
  79.452 +            -->
  79.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  79.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  79.455 +    </target>
  79.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  79.457 +        <j2seproject3:debug>
  79.458 +            <customize>
  79.459 +                <arg line="${application.args}"/>
  79.460 +            </customize>
  79.461 +        </j2seproject3:debug>
  79.462 +    </target>
  79.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  79.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  79.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  79.466 +    </target>
  79.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  79.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  79.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  79.470 +        <j2seproject3:debug classname="${debug.class}"/>
  79.471 +    </target>
  79.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  79.473 +    <target depends="init" name="-pre-debug-fix">
  79.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  79.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  79.476 +    </target>
  79.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  79.478 +        <j2seproject1:nbjpdareload/>
  79.479 +    </target>
  79.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  79.481 +    <!--
  79.482 +                ===============
  79.483 +                JAVADOC SECTION
  79.484 +                ===============
  79.485 +            -->
  79.486 +    <target depends="init" name="-javadoc-build">
  79.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  79.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  79.489 +            <classpath>
  79.490 +                <path path="${javac.classpath}"/>
  79.491 +            </classpath>
  79.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  79.493 +                <filename name="**/*.java"/>
  79.494 +            </fileset>
  79.495 +        </javadoc>
  79.496 +    </target>
  79.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  79.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  79.499 +    </target>
  79.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  79.501 +    <!--
  79.502 +                =========================
  79.503 +                JUNIT COMPILATION SECTION
  79.504 +                =========================
  79.505 +            -->
  79.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  79.507 +        <mkdir dir="${build.test.classes.dir}"/>
  79.508 +    </target>
  79.509 +    <target name="-pre-compile-test">
  79.510 +        <!-- Empty placeholder for easier customization. -->
  79.511 +        <!-- You can override this target in the ../build.xml file. -->
  79.512 +    </target>
  79.513 +    <target if="do.depend.true" name="-compile-test-depend">
  79.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  79.515 +    </target>
  79.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  79.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  79.518 +        <copy todir="${build.test.classes.dir}">
  79.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  79.520 +        </copy>
  79.521 +    </target>
  79.522 +    <target name="-post-compile-test">
  79.523 +        <!-- Empty placeholder for easier customization. -->
  79.524 +        <!-- You can override this target in the ../build.xml file. -->
  79.525 +    </target>
  79.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  79.527 +    <target name="-pre-compile-test-single">
  79.528 +        <!-- Empty placeholder for easier customization. -->
  79.529 +        <!-- You can override this target in the ../build.xml file. -->
  79.530 +    </target>
  79.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  79.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  79.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  79.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  79.535 +        <copy todir="${build.test.classes.dir}">
  79.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  79.537 +        </copy>
  79.538 +    </target>
  79.539 +    <target name="-post-compile-test-single">
  79.540 +        <!-- Empty placeholder for easier customization. -->
  79.541 +        <!-- You can override this target in the ../build.xml file. -->
  79.542 +    </target>
  79.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  79.544 +    <!--
  79.545 +                =======================
  79.546 +                JUNIT EXECUTION SECTION
  79.547 +                =======================
  79.548 +            -->
  79.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  79.550 +        <mkdir dir="${build.test.results.dir}"/>
  79.551 +    </target>
  79.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  79.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  79.554 +    </target>
  79.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  79.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  79.557 +    </target>
  79.558 +    <target depends="init" if="have.tests" name="test-report"/>
  79.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  79.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  79.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  79.562 +        <mkdir dir="${build.test.results.dir}"/>
  79.563 +    </target>
  79.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  79.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  79.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  79.567 +    </target>
  79.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  79.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  79.570 +    </target>
  79.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  79.572 +    <!--
  79.573 +                =======================
  79.574 +                JUNIT DEBUGGING SECTION
  79.575 +                =======================
  79.576 +            -->
  79.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  79.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  79.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  79.580 +        <delete file="${test.report.file}"/>
  79.581 +        <mkdir dir="${build.test.results.dir}"/>
  79.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  79.583 +            <customize>
  79.584 +                <syspropertyset>
  79.585 +                    <propertyref prefix="test-sys-prop."/>
  79.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  79.587 +                </syspropertyset>
  79.588 +                <arg value="${test.class}"/>
  79.589 +                <arg value="showoutput=true"/>
  79.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  79.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  79.592 +            </customize>
  79.593 +        </j2seproject3:debug>
  79.594 +    </target>
  79.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  79.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  79.597 +    </target>
  79.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  79.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  79.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  79.601 +    </target>
  79.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  79.603 +    <!--
  79.604 +                =========================
  79.605 +                APPLET EXECUTION SECTION
  79.606 +                =========================
  79.607 +            -->
  79.608 +    <target depends="init,compile-single" name="run-applet">
  79.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  79.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  79.611 +            <customize>
  79.612 +                <arg value="${applet.url}"/>
  79.613 +            </customize>
  79.614 +        </j2seproject1:java>
  79.615 +    </target>
  79.616 +    <!--
  79.617 +                =========================
  79.618 +                APPLET DEBUGGING  SECTION
  79.619 +                =========================
  79.620 +            -->
  79.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  79.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  79.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  79.624 +            <customize>
  79.625 +                <arg value="${applet.url}"/>
  79.626 +            </customize>
  79.627 +        </j2seproject3:debug>
  79.628 +    </target>
  79.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  79.630 +    <!--
  79.631 +                ===============
  79.632 +                CLEANUP SECTION
  79.633 +                ===============
  79.634 +            -->
  79.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  79.636 +    <target depends="init" name="-do-clean">
  79.637 +        <delete dir="${build.dir}"/>
  79.638 +        <delete dir="${dist.dir}"/>
  79.639 +    </target>
  79.640 +    <target name="-post-clean">
  79.641 +        <!-- Empty placeholder for easier customization. -->
  79.642 +        <!-- You can override this target in the ../build.xml file. -->
  79.643 +    </target>
  79.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  79.645 +</project>
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/task1/solution07/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    80.3 @@ -0,0 +1,8 @@
    80.4 +build.xml.data.CRC32=2ab820eb
    80.5 +build.xml.script.CRC32=58a52595
    80.6 +build.xml.stylesheet.CRC32=be360661
    80.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    80.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    80.9 +nbproject/build-impl.xml.data.CRC32=979fc7ba
   80.10 +nbproject/build-impl.xml.script.CRC32=92452d37
   80.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/task1/solution07/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    81.3 @@ -0,0 +1,68 @@
    81.4 +application.title=currency
    81.5 +application.vendor=apidesign.org
    81.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    81.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    81.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    81.9 +build.classes.dir=${build.dir}/classes
   81.10 +build.classes.excludes=**/*.java,**/*.form
   81.11 +# This directory is removed when the project is cleaned:
   81.12 +build.dir=build
   81.13 +build.generated.dir=${build.dir}/generated
   81.14 +# Only compile against the classpath explicitly listed here:
   81.15 +build.sysclasspath=ignore
   81.16 +build.test.classes.dir=${build.dir}/test/classes
   81.17 +build.test.results.dir=${build.dir}/test/results
   81.18 +debug.classpath=\
   81.19 +    ${run.classpath}
   81.20 +debug.test.classpath=\
   81.21 +    ${run.test.classpath}
   81.22 +# This directory is removed when the project is cleaned:
   81.23 +dist.dir=dist
   81.24 +dist.jar=${dist.dir}/currency.jar
   81.25 +dist.javadoc.dir=${dist.dir}/javadoc
   81.26 +excludes=
   81.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   81.28 +file.reference.src-apifest08=..
   81.29 +includes=**
   81.30 +jar.compress=false
   81.31 +javac.classpath=
   81.32 +# Space-separated list of extra javac options
   81.33 +javac.compilerargs=
   81.34 +javac.deprecation=false
   81.35 +javac.source=1.5
   81.36 +javac.target=1.5
   81.37 +javac.test.classpath=\
   81.38 +    ${javac.classpath}:\
   81.39 +    ${build.classes.dir}:\
   81.40 +    ${file.reference.junit-4.4.jar}
   81.41 +javadoc.additionalparam=
   81.42 +javadoc.author=false
   81.43 +javadoc.encoding=
   81.44 +javadoc.noindex=false
   81.45 +javadoc.nonavbar=false
   81.46 +javadoc.notree=false
   81.47 +javadoc.private=false
   81.48 +javadoc.splitindex=true
   81.49 +javadoc.use=true
   81.50 +javadoc.version=false
   81.51 +javadoc.windowtitle=
   81.52 +jnlp.codebase.type=local
   81.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   81.54 +jnlp.descriptor=application
   81.55 +jnlp.enabled=false
   81.56 +jnlp.offline-allowed=false
   81.57 +jnlp.signed=false
   81.58 +meta.inf.dir=${src.dir}/META-INF
   81.59 +platform.active=default_platform
   81.60 +run.classpath=\
   81.61 +    ${javac.classpath}:\
   81.62 +    ${build.classes.dir}
   81.63 +# Space-separated list of JVM arguments used when running the project
   81.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   81.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   81.66 +run.jvmargs=
   81.67 +run.test.classpath=\
   81.68 +    ${javac.test.classpath}:\
   81.69 +    ${build.test.classes.dir}
   81.70 +src.dir=src
   81.71 +test.src.dir=test
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/task1/solution07/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    82.3 @@ -0,0 +1,16 @@
    82.4 +<?xml version="1.0" encoding="UTF-8"?>
    82.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    82.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    82.7 +    <configuration>
    82.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    82.9 +            <name>Currency Convertor Solution 07</name>
   82.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   82.11 +            <source-roots>
   82.12 +                <root id="src.dir"/>
   82.13 +            </source-roots>
   82.14 +            <test-roots>
   82.15 +                <root id="test.src.dir"/>
   82.16 +            </test-roots>
   82.17 +        </data>
   82.18 +    </configuration>
   82.19 +</project>
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/ConversionRate.java	Sun Sep 28 14:12:38 2008 +0200
    83.3 @@ -0,0 +1,91 @@
    83.4 +package org.apidesign.apifest08.currency;
    83.5 +
    83.6 +import java.math.BigDecimal;
    83.7 +import java.math.RoundingMode;
    83.8 +
    83.9 +/**
   83.10 + * A rate of conversion from one currency to another.
   83.11 + * @author jdvorak
   83.12 + */
   83.13 +public class ConversionRate {
   83.14 +
   83.15 +    private final MonetaryAmount srcUnitAmount;
   83.16 +    private final MonetaryAmount tgtUnitAmount;
   83.17 +    private final int tgtScale;
   83.18 +    private final RoundingMode roundingMode;
   83.19 +
   83.20 +    /**
   83.21 +     * A new conversion rate that gives tgtUnitAmount per every srcUnitAmount.
   83.22 +     * @param srcUnitAmount the amount of source currency
   83.23 +     * @param tgtUnitAmount the corresponding amount of target currency
   83.24 +     * @param tgtScale the scale of the target amounts
   83.25 +     * @param roundingMode the rounding mode to use when producing the target amounts
   83.26 +     */
   83.27 +    public ConversionRate( final MonetaryAmount srcUnitAmount, final MonetaryAmount tgtUnitAmount, final int targetScale, final RoundingMode roundingMode ) {
   83.28 +        this.srcUnitAmount = srcUnitAmount;
   83.29 +        this.tgtUnitAmount = tgtUnitAmount;
   83.30 +        this.tgtScale = targetScale;
   83.31 +        this.roundingMode = roundingMode;
   83.32 +    }
   83.33 +
   83.34 +    /**
   83.35 +     * A new conversion rate that gives tgtUnitAmount per every srcUnitAmount, default number of fraction digits and the given rounding mode.
   83.36 +     * @param srcUnitAmount the amount of source currency
   83.37 +     * @param tgtUnitAmount the corresponding amount of target currency
   83.38 +     * @param roundingMode the rounding mode to use
   83.39 +     */
   83.40 +    public ConversionRate( final MonetaryAmount srcUnitAmount, final MonetaryAmount tgtUnitAmount, final RoundingMode roundingMode ) {
   83.41 +        this( srcUnitAmount, tgtUnitAmount, tgtUnitAmount.getCurrency().getDefaultFractionDigits(), roundingMode );
   83.42 +    }
   83.43 +
   83.44 +    /**
   83.45 +     * A new conversion rate that gives tgtUnitAmount per every srcUnitAmount, default number of fraction digits and {@link RoundingMode#HALF_EVEN}.
   83.46 +     * @param srcUnitAmount the amount of source currency
   83.47 +     * @param tgtUnitAmount the corresponding amount of target currency
   83.48 +     */
   83.49 +    public ConversionRate( final MonetaryAmount srcUnitAmount, final MonetaryAmount tgtUnitAmount ) {
   83.50 +        this( srcUnitAmount, tgtUnitAmount, RoundingMode.HALF_EVEN );
   83.51 +    }
   83.52 +
   83.53 +    public RoundingMode getRoundingMode() {
   83.54 +        return roundingMode;
   83.55 +    }
   83.56 +
   83.57 +    public MonetaryAmount getSrcUnitAmount() {
   83.58 +        return srcUnitAmount;
   83.59 +    }
   83.60 +
   83.61 +    public int getTgtScale() {
   83.62 +        return tgtScale;
   83.63 +    }
   83.64 +
   83.65 +    public MonetaryAmount getTgtUnitAmount() {
   83.66 +        return tgtUnitAmount;
   83.67 +    }
   83.68 +    
   83.69 +    /**
   83.70 +     * Multiplies the given amount with the given rate.
   83.71 +     * @param srcAmount
   83.72 +     * @return
   83.73 +     */
   83.74 +    public BigDecimal convert( final BigDecimal srcAmount ) {
   83.75 +        return srcAmount
   83.76 +            .multiply( tgtUnitAmount.getAmount() )
   83.77 +            .divide( srcUnitAmount.getAmount(), tgtScale, roundingMode );
   83.78 +    }
   83.79 +    
   83.80 +    /**
   83.81 +     * Creates a monetary amount that corresponds to the given source amount multiplied by the rate.
   83.82 +     * @param srcAmount the source amount
   83.83 +     * @return the monetary amount in the target currency
   83.84 +     * @throws IllegalArgumentException if the currency of srcAmount is not equal to the source currency of this rate
   83.85 +     */
   83.86 +    public MonetaryAmount convert( final MonetaryAmount srcAmount ) {
   83.87 +        if ( srcUnitAmount.getCurrency().equals( srcAmount.getCurrency() ) ) {
   83.88 +            return new MonetaryAmount( convert( srcAmount.getAmount() ), tgtUnitAmount.getCurrency() );
   83.89 +        } else {
   83.90 +            throw new IllegalArgumentException( "This rate converts from " + srcUnitAmount.getCurrency() + ", but a conversion from " + srcAmount.getCurrency() + " is attempted" );
   83.91 +        }
   83.92 +    }
   83.93 +    
   83.94 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    84.3 @@ -0,0 +1,109 @@
    84.4 +package org.apidesign.apifest08.currency;
    84.5 +
    84.6 +import java.util.Currency;
    84.7 +
    84.8 +/** This is the skeleton class for your API. You need to make it public, so
    84.9 + * it is accessible to your client code (currently in Task1Test.java) file.
   84.10 + * <p>
   84.11 + * Feel free to create additional classes or rename this one, just keep all
   84.12 + * the API and its implementation in this package. Do not spread it outside
   84.13 + * to other packages.
   84.14 + */
   84.15 +public interface Convertor {
   84.16 +    
   84.17 +    /**
   84.18 +     * Converts by taking a request and producing a response.
   84.19 +     * If a convertor finds it cannot perform the requested conversion,
   84.20 +     * it should return a non-null {@link ConversionResult} that has null {@link ConversionResult#getNetAmount()}.
   84.21 +     * A convertor must not convert to a different currency than the one specified in the request.
   84.22 +     * <p>
   84.23 +     * When the need comes to extend the semantics, one subclasses the ConversionRequest and/or ConversionResult classes.
   84.24 +     * <p>
   84.25 +     * This method can be called as many times as you like.
   84.26 +     * A {@link Convertor} shall be considered immutable.
   84.27 +     * This method of a single {@link Convertor} can be called from many threads concurrently.
   84.28 +     * @param req the conversion request; mustn't be null
   84.29 +     * @return the result of carrying out the conversion request; never null
   84.30 +     * @throws IllegalRequestSubtypeException when the particular implementation cannot handle a specific ConversionRequest type
   84.31 +     */
   84.32 +    public ConversionResult convert( final ConversionRequest req ) throws IllegalRequestSubtypeException;
   84.33 +
   84.34 +    /**
   84.35 +     * The request for converting a monetary amout into another currency.
   84.36 +     * Immutable.
   84.37 +     */
   84.38 +    public class ConversionRequest {
   84.39 +        
   84.40 +        private final MonetaryAmount srcAmount;
   84.41 +        private final Currency tgtCurrency;
   84.42 +
   84.43 +        /**
   84.44 +         * A request to convert srcAmount into tgtCurrency.
   84.45 +         * @param srcAmount the source amount; must not be null
   84.46 +         * @param tgtCurrency the currency we want it in afterwards; must not be null
   84.47 +         */
   84.48 +        public ConversionRequest( final MonetaryAmount srcAmount, final Currency tgtCurrency ) {
   84.49 +            this.srcAmount = srcAmount;
   84.50 +            this.tgtCurrency = tgtCurrency;
   84.51 +            if ( srcAmount == null ) {
   84.52 +                throw new NullPointerException( "The source amount" );
   84.53 +            }
   84.54 +            if ( tgtCurrency == null ) {
   84.55 +                throw new NullPointerException( "The target currency" );
   84.56 +            }
   84.57 +            if ( srcAmount.getCurrency().equals( tgtCurrency ) ) {
   84.58 +                throw new IllegalArgumentException( "Cannot request conversion from " + srcAmount.getCurrency() + " to " + tgtCurrency );
   84.59 +            }
   84.60 +        }
   84.61 +
   84.62 +        /**
   84.63 +         * The source amount.
   84.64 +         */
   84.65 +        public MonetaryAmount getSrcAmount() {
   84.66 +            return srcAmount;
   84.67 +        }
   84.68 +
   84.69 +        /**
   84.70 +         * The target currency.
   84.71 +         */
   84.72 +        public Currency getTgtCurrency() {
   84.73 +            return tgtCurrency;
   84.74 +        }
   84.75 +        
   84.76 +    }
   84.77 +    
   84.78 +    /**
   84.79 +     * The result of converting a monetary amount into another currency.
   84.80 +     * For now it records just the net amount one recieves from the conversion.
   84.81 +     * Immutable.
   84.82 +     * <p>
   84.83 +     * <b>Extension note:</b> 
   84.84 +     * Other items can be added further down the road, as the need for them arises.
   84.85 +     * These items might provide info on other aspects of the conversion,
   84.86 +     * such as the fee or a reason why the conversion might not be admissible.
   84.87 +     */
   84.88 +    public class ConversionResult {
   84.89 +        
   84.90 +        private final MonetaryAmount netAmount;
   84.91 +        
   84.92 +        /**
   84.93 +         * A new conversion result.
   84.94 +         * @param netAmount the amount one recieves from the conversion; 
   84.95 +         * null means the conversion was not admissible
   84.96 +         */
   84.97 +        public ConversionResult( final MonetaryAmount netAmount ) {
   84.98 +            this.netAmount = netAmount;
   84.99 +        }
  84.100 +        
  84.101 +        /**
  84.102 +         * The amount one recieves from the conversion.
  84.103 +         * If null, the conversion is not admissible.
  84.104 +         * @return the amount
  84.105 +         */
  84.106 +        public MonetaryAmount getNetAmount() {
  84.107 +            return netAmount;
  84.108 +        }
  84.109 +        
  84.110 +    }
  84.111 +    
  84.112 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/DelegatingConvertor.java	Sun Sep 28 14:12:38 2008 +0200
    85.3 @@ -0,0 +1,28 @@
    85.4 +/*
    85.5 + * To change this template, choose Tools | Templates
    85.6 + * and open the template in the editor.
    85.7 + */
    85.8 +
    85.9 +package org.apidesign.apifest08.currency;
   85.10 +
   85.11 +/**
   85.12 + *
   85.13 + * @author jdvorak
   85.14 + */
   85.15 +public class DelegatingConvertor implements Convertor {
   85.16 +    
   85.17 +    private final Convertor underlyingConvertor;
   85.18 +
   85.19 +    public DelegatingConvertor( final Convertor underlyingConvertor ) {
   85.20 +        this.underlyingConvertor = underlyingConvertor;
   85.21 +    }
   85.22 +
   85.23 +    protected Convertor getUnderlyingConvertor() {
   85.24 +        return underlyingConvertor;
   85.25 +    }
   85.26 +    
   85.27 +    public ConversionResult convert( final ConversionRequest req ) {
   85.28 +        return underlyingConvertor.convert( req );
   85.29 +    }
   85.30 +    
   85.31 +}
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/IllegalRequestSubtypeException.java	Sun Sep 28 14:12:38 2008 +0200
    86.3 @@ -0,0 +1,30 @@
    86.4 +/*
    86.5 + * To change this template, choose Tools | Templates
    86.6 + * and open the template in the editor.
    86.7 + */
    86.8 +
    86.9 +package org.apidesign.apifest08.currency;
   86.10 +
   86.11 +/**
   86.12 + * Rised when a {@link Convertor} implementation cannot handle a particular subtype of {@link Convertor.ConversionRequest}.
   86.13 + * @author jdvorak
   86.14 + */
   86.15 +public class IllegalRequestSubtypeException extends IllegalArgumentException {
   86.16 +
   86.17 +    public IllegalRequestSubtypeException() {
   86.18 +        super();
   86.19 +    }
   86.20 +    
   86.21 +    public IllegalRequestSubtypeException( final String msg ) {
   86.22 +        super( msg );
   86.23 +    }
   86.24 +    
   86.25 +    public IllegalRequestSubtypeException( final Throwable cause ) {
   86.26 +        super( cause );
   86.27 +    }
   86.28 +    
   86.29 +    public IllegalRequestSubtypeException( final String msg, final Throwable cause ) {
   86.30 +        super( msg, cause );
   86.31 +    }
   86.32 +    
   86.33 +}
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/MonetaryAmount.java	Sun Sep 28 14:12:38 2008 +0200
    87.3 @@ -0,0 +1,89 @@
    87.4 +package org.apidesign.apifest08.currency;
    87.5 +
    87.6 +import java.math.BigDecimal;
    87.7 +import java.util.Currency;
    87.8 +
    87.9 +/**
   87.10 + * An amount of a currency.
   87.11 + * Immutable.
   87.12 + * @author jdvorak
   87.13 + */
   87.14 +public class MonetaryAmount {
   87.15 +
   87.16 +    private final BigDecimal amount;
   87.17 +    private final Currency currency;
   87.18 +    
   87.19 +    /**
   87.20 +     * A new amount.
   87.21 +     * @param amount the quantity of the currency; must not be null
   87.22 +     * @param currency the currency; must not be null
   87.23 +     */
   87.24 +    public MonetaryAmount( final BigDecimal amount, final Currency currency ) {
   87.25 +        this.amount = amount;
   87.26 +        this.currency = currency;
   87.27 +        if ( amount == null ) {
   87.28 +            throw new NullPointerException( "The amount" );
   87.29 +        }
   87.30 +        if ( currency == null ) {
   87.31 +            throw new NullPointerException( "The currency" );
   87.32 +        }
   87.33 +    }
   87.34 +    
   87.35 +    /**
   87.36 +     * A new amount.
   87.37 +     * @param amount the quantity of the currency; must not be null
   87.38 +     * @param currency the currency; must not be null
   87.39 +     */
   87.40 +    public MonetaryAmount( final double amount, final Currency currency ) {
   87.41 +        this( new BigDecimal( amount ), currency );
   87.42 +    }
   87.43 +    
   87.44 +    /**
   87.45 +     * The amount.
   87.46 +     * @return the amount
   87.47 +     */
   87.48 +    public BigDecimal getAmount() {
   87.49 +        return amount;
   87.50 +    }
   87.51 +    
   87.52 +    /**
   87.53 +     * The currency.
   87.54 +     * @return the currency
   87.55 +     */
   87.56 +    public Currency getCurrency() {
   87.57 +        return currency;
   87.58 +    }
   87.59 +
   87.60 +    /**
   87.61 +     * The string representation of the monetary amount.
   87.62 +     * @return the amount, a non-breakable space, the currency
   87.63 +     */
   87.64 +    @Override
   87.65 +    public String toString() {
   87.66 +        return amount.toPlainString() + "\u00a0" + currency.toString();
   87.67 +    }
   87.68 +    
   87.69 +    /**
   87.70 +     * Two monetary amounts are equal to each other iff they have equal amounts of equal currencies.
   87.71 +     * @param other the other object
   87.72 +     * @return equality
   87.73 +     */
   87.74 +    @Override
   87.75 +    public boolean equals( final Object other ) {
   87.76 +        if ( other instanceof MonetaryAmount ) {
   87.77 +            final MonetaryAmount otherMonetaryAmount = (MonetaryAmount) other;
   87.78 +            return getAmount().equals( otherMonetaryAmount.getAmount() ) && getCurrency().equals( otherMonetaryAmount.getCurrency() );
   87.79 +        }
   87.80 +        return false;
   87.81 +    }
   87.82 +    
   87.83 +    /**
   87.84 +     * The hash code combines the hash codes of the amount and of the currency.
   87.85 +     * @return hash code
   87.86 +     */
   87.87 +    @Override
   87.88 +    public int hashCode() {
   87.89 +        return amount.hashCode() * 37 + currency.hashCode();
   87.90 +    }
   87.91 +    
   87.92 +}
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/task1/solution07/src/org/apidesign/apifest08/currency/TableConvertor.java	Sun Sep 28 14:12:38 2008 +0200
    88.3 @@ -0,0 +1,71 @@
    88.4 +package org.apidesign.apifest08.currency;
    88.5 +
    88.6 +import java.util.Currency;
    88.7 +import java.util.HashMap;
    88.8 +import java.util.Map;
    88.9 +
   88.10 +/**
   88.11 + * A {@link Convertor} that works from a pre-set conversion table.
   88.12 + * First use {@link #putIntoTable(org.apidesign.apifest08.currency.ConversionRate)} to set the conversion table.
   88.13 + * Then invoke the {@link #convert(org.apidesign.apifest08.currency.Convertor.ConversionRequest)} method as many times as you wish.
   88.14 + * @author jdvorak
   88.15 + */
   88.16 +public class TableConvertor implements Convertor {
   88.17 +
   88.18 +    private final Map<Currency, Map<Currency, ConversionRate>> conversionTable = new HashMap<Currency, Map<Currency, ConversionRate>>();
   88.19 +    
   88.20 +    public TableConvertor() {
   88.21 +    }
   88.22 +
   88.23 +    /**
   88.24 +     * Puts a rate into the table.
   88.25 +     * @param rate
   88.26 +     */
   88.27 +    public void putIntoTable( final ConversionRate rate ) {
   88.28 +        final Currency srcCurrency = rate.getSrcUnitAmount().getCurrency();
   88.29 +        final Currency tgtCurrency = rate.getTgtUnitAmount().getCurrency();
   88.30 +        synchronized ( conversionTable ) {
   88.31 +            Map<Currency, ConversionRate> targetTable = conversionTable.get( srcCurrency );
   88.32 +            if ( targetTable == null ) {
   88.33 +                targetTable = new HashMap<Currency, ConversionRate>();
   88.34 +                conversionTable.put( srcCurrency, targetTable );
   88.35 +            }
   88.36 +            targetTable.put( tgtCurrency, rate );
   88.37 +        }
   88.38 +    }
   88.39 +    
   88.40 +    /**
   88.41 +     * Carries out the conversion.
   88.42 +     * If the table does not contain a conversion from the source currency to the target one,
   88.43 +     * a {@link ConversionResult} is returned that has null netAmount.
   88.44 +     * This implementation works with any {@link ConversionRequest}, it won't throw {@link IllegalRequestSubtypeException}.
   88.45 +     * @param req the conversion request
   88.46 +     * @return the conversion result
   88.47 +     */
   88.48 +    public ConversionResult convert( final ConversionRequest req ) {
   88.49 +        final Currency srcCurrency = req.getSrcAmount().getCurrency();
   88.50 +        final Currency tgtCurrency = req.getTgtCurrency();
   88.51 +        final ConversionRate rate = findConversionRate( srcCurrency, tgtCurrency );
   88.52 +        if ( rate != null ) {
   88.53 +            final MonetaryAmount tgtAmount = rate.convert( req.getSrcAmount() );
   88.54 +            return new ConversionResult( tgtAmount );
   88.55 +        } else {
   88.56 +            return new ConversionResult( null );    // did not find the pair of currencies in the table
   88.57 +        }
   88.58 +    }
   88.59 +
   88.60 +    /**
   88.61 +     * Looks up the conversion between the given currencies in the table.
   88.62 +     * @param srcCurrency the source currency
   88.63 +     * @param tgtCurrency the target currency
   88.64 +     * @return the conversion rate; null means no conversion between the currencies was found in the table
   88.65 +     */
   88.66 +    protected ConversionRate findConversionRate( final Currency srcCurrency, final Currency tgtCurrency ) {
   88.67 +        synchronized ( conversionTable ) {
   88.68 +            final Map<Currency, ConversionRate> targetTable = conversionTable.get(srcCurrency);
   88.69 +            final ConversionRate rate = (targetTable != null) ? targetTable.get(tgtCurrency) : null;
   88.70 +            return rate;
   88.71 +        }
   88.72 +    }
   88.73 +
   88.74 +}
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/task1/solution07/test/org/apidesign/apifest08/test/ContractImposingDelegatingConvertor.java	Sun Sep 28 14:12:38 2008 +0200
    89.3 @@ -0,0 +1,53 @@
    89.4 +/*
    89.5 + * To change this template, choose Tools | Templates
    89.6 + * and open the template in the editor.
    89.7 + */
    89.8 +
    89.9 +package org.apidesign.apifest08.test;
   89.10 +
   89.11 +import java.math.BigDecimal;
   89.12 +import java.util.Currency;
   89.13 +import junit.framework.Assert;
   89.14 +import org.apidesign.apifest08.currency.Convertor;
   89.15 +import org.apidesign.apifest08.currency.DelegatingConvertor;
   89.16 +import org.apidesign.apifest08.currency.MonetaryAmount;
   89.17 +
   89.18 +/**
   89.19 + * A delegating convertor that checks preconditions and postconditions.
   89.20 + * Useful for testing.
   89.21 + * @author jdvorak
   89.22 + */
   89.23 +public class ContractImposingDelegatingConvertor extends DelegatingConvertor {
   89.24 +
   89.25 +    public ContractImposingDelegatingConvertor( final Convertor underlyingConvertor ) {
   89.26 +        super( underlyingConvertor );
   89.27 +    }
   89.28 +
   89.29 +    @Override
   89.30 +    public ConversionResult convert( final ConversionRequest req ) {
   89.31 +        Assert.assertNotNull( "The request", req );
   89.32 +        final ConversionResult result = super.convert( req );
   89.33 +        Assert.assertNotNull( "Result of the convert() call", result );
   89.34 +        final MonetaryAmount netAmount = result.getNetAmount();
   89.35 +        if ( netAmount != null ) {
   89.36 +            Assert.assertEquals( "Converted to a different currency than specified in the request", req.getTgtCurrency(), netAmount.getCurrency() );
   89.37 +        }
   89.38 +        return result;
   89.39 +    }
   89.40 +
   89.41 +    /**
   89.42 +     * Do some tests on our own.
   89.43 +     * @return this
   89.44 +     */
   89.45 +    public Convertor test() {
   89.46 +        try {
   89.47 +            final Currency aCurrency = Currency.getInstance( "EUR" );
   89.48 +            new ConversionRequest( new MonetaryAmount( BigDecimal.ONE, aCurrency ), aCurrency );
   89.49 +            Assert.fail( "Should have thrown an IllegalArgumentException" );
   89.50 +        } catch ( final IllegalArgumentException e ) {
   89.51 +            Assert.assertEquals( "Cannot request conversion from EUR to EUR", e.getMessage() );
   89.52 +        }
   89.53 +        return this;
   89.54 +    }
   89.55 +
   89.56 +}
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/task1/solution07/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    90.3 @@ -0,0 +1,122 @@
    90.4 +package org.apidesign.apifest08.test;
    90.5 +
    90.6 +import java.util.Currency;
    90.7 +import junit.framework.TestCase;
    90.8 +import org.apidesign.apifest08.currency.ConversionRate;
    90.9 +import org.apidesign.apifest08.currency.Convertor;
   90.10 +import org.apidesign.apifest08.currency.MonetaryAmount;
   90.11 +import org.apidesign.apifest08.currency.TableConvertor;
   90.12 +
   90.13 +/** Finish the Convertor API, and then write bodies of methods inside
   90.14 + * of this class to match the given tasks. To fullfil your task, use the
   90.15 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   90.16 + * Do not you reflection, or other hacks as your code
   90.17 + * shall run without any runtime permissions.
   90.18 + */
   90.19 +public class Task1Test extends TestCase {
   90.20 +    public Task1Test(String testName) {
   90.21 +        super(testName);
   90.22 +    }
   90.23 +
   90.24 +    @Override
   90.25 +    protected void setUp() throws Exception {
   90.26 +    }
   90.27 +
   90.28 +    @Override
   90.29 +    protected void tearDown() throws Exception {
   90.30 +    }
   90.31 +
   90.32 +    protected static final Currency CZK = Currency.getInstance( "CZK" );
   90.33 +    protected static final Currency SKK = Currency.getInstance( "SKK" );
   90.34 +    protected static final Currency USD = Currency.getInstance( "USD" );
   90.35 +    
   90.36 +    /** Create convertor that understands two currencies, CZK and
   90.37 +     *  USD. Make 1 USD == 17 CZK.
   90.38 +     *
   90.39 +     * Creation of the convertor shall not require subclassing of any class
   90.40 +     * or interface on the client side.
   90.41 +     *
   90.42 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   90.43 +     */
   90.44 +    public static Convertor createCZKtoUSD() {
   90.45 +        final TableConvertor convertor = new TableConvertor();
   90.46 +        final MonetaryAmount amountInCZK = new MonetaryAmount( 17, CZK );
   90.47 +        final MonetaryAmount amountInUSD = new MonetaryAmount( 1, USD );
   90.48 +        convertor.putIntoTable( new ConversionRate( amountInCZK, amountInUSD ) );
   90.49 +        convertor.putIntoTable( new ConversionRate( amountInUSD, amountInCZK ) );
   90.50 +        return new ContractImposingDelegatingConvertor( convertor ).test();
   90.51 +    }
   90.52 +
   90.53 +    /** Create convertor that understands two currencies, CZK and
   90.54 +     *  SKK. Make 100 SKK == 80 CZK.
   90.55 +     *
   90.56 +     * Creation of the convertor shall not require subclassing of any class
   90.57 +     * or interface on the client side.
   90.58 +     * 
   90.59 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   90.60 +     */
   90.61 +    public static Convertor createSKKtoCZK() {
   90.62 +        final TableConvertor convertor = new TableConvertor();
   90.63 +        final MonetaryAmount amountInSKK = new MonetaryAmount( 100, SKK );
   90.64 +        final MonetaryAmount amountInCZK = new MonetaryAmount( 80, CZK );
   90.65 +        convertor.putIntoTable( new ConversionRate( amountInSKK, amountInCZK ) );
   90.66 +        convertor.putIntoTable( new ConversionRate( amountInCZK, amountInSKK ) );
   90.67 +        return new ContractImposingDelegatingConvertor( convertor ).test();
   90.68 +    }
   90.69 +
   90.70 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   90.71 +     * with it.
   90.72 +     */
   90.73 +    public void testCurrencyCZKUSD() throws Exception {
   90.74 +        final Convertor c = createCZKtoUSD();
   90.75 +        
   90.76 +        // convert $5 to CZK using c:
   90.77 +        final Convertor.ConversionResult r1 = c.convert( new Convertor.ConversionRequest( new MonetaryAmount( 5, USD ), CZK ) );
   90.78 +        final MonetaryAmount a1 = r1.getNetAmount();
   90.79 +        // assertEquals("Result is 85 CZK");
   90.80 +        assertNotNull( a1 );
   90.81 +        assertEquals( 85.0, a1.getAmount().doubleValue() );
   90.82 +        assertEquals( CZK, a1.getCurrency() );
   90.83 +
   90.84 +        // convert $8 to CZK
   90.85 +        final Convertor.ConversionResult r2 = c.convert( new Convertor.ConversionRequest( new MonetaryAmount( 8, USD ), CZK ) );
   90.86 +        final MonetaryAmount a2 = r2.getNetAmount();
   90.87 +        // assertEquals("Result is 136 CZK");
   90.88 +        assertNotNull( a2 );
   90.89 +        assertEquals( 136.0, a2.getAmount().doubleValue() );
   90.90 +        assertEquals( CZK, a2.getCurrency() );
   90.91 +
   90.92 +        // convert 1003CZK to USD
   90.93 +        final Convertor.ConversionResult r3 = c.convert( new Convertor.ConversionRequest( new MonetaryAmount( 1003, CZK ), USD ) );
   90.94 +        final MonetaryAmount a3 = r3.getNetAmount();
   90.95 +        // assertEquals("Result is 59 USD");
   90.96 +        assertNotNull( a3 );
   90.97 +        assertEquals( 59.0, a3.getAmount().doubleValue() );
   90.98 +        assertEquals( USD, a3.getCurrency() );
   90.99 +    }
  90.100 +
  90.101 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
  90.102 +     * with it.
  90.103 +     */
  90.104 +    public void testCurrencySKKCZK() throws Exception {
  90.105 +        final Convertor c = createSKKtoCZK();
  90.106 +        
  90.107 +        // convert 16CZK using c:
  90.108 +        final Convertor.ConversionResult r1 = c.convert( new Convertor.ConversionRequest( new MonetaryAmount( 16, CZK ), SKK ) );
  90.109 +        final MonetaryAmount a1 = r1.getNetAmount();
  90.110 +        // assertEquals("Result is 20 SKK");
  90.111 +        assertNotNull( a1 );
  90.112 +        assertEquals( 20.0, a1.getAmount().doubleValue() );
  90.113 +        assertEquals( SKK, a1.getCurrency() );
  90.114 +        
  90.115 +        // convert 500SKK to CZK
  90.116 +        final Convertor.ConversionResult r2 = c.convert( new Convertor.ConversionRequest( new MonetaryAmount( 500, SKK ), CZK ) );
  90.117 +        final MonetaryAmount a2 = r2.getNetAmount();
  90.118 +        // assertEquals("Result is 400 CZK");
  90.119 +        assertNotNull( a2 );
  90.120 +        assertEquals( 400.0, a2.getAmount().doubleValue() );
  90.121 +        assertEquals( CZK, a2.getCurrency() );
  90.122 +    }
  90.123 +
  90.124 +}
  90.125 +
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/task1/solution08/build.xml	Sun Sep 28 14:12:38 2008 +0200
    91.3 @@ -0,0 +1,69 @@
    91.4 +<?xml version="1.0" encoding="UTF-8"?>
    91.5 +<!-- You may freely edit this file. See commented blocks below for -->
    91.6 +<!-- some examples of how to customize the build. -->
    91.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    91.8 +<project name="currency" default="default" basedir=".">
    91.9 +    <description>Builds, tests, and runs the project.</description>
   91.10 +    <import file="nbproject/build-impl.xml"/>
   91.11 +    <!--
   91.12 +
   91.13 +    There exist several targets which are by default empty and which can be 
   91.14 +    used for execution of your tasks. These targets are usually executed 
   91.15 +    before and after some main targets. They are: 
   91.16 +
   91.17 +      -pre-init:                 called before initialization of project properties
   91.18 +      -post-init:                called after initialization of project properties
   91.19 +      -pre-compile:              called before javac compilation
   91.20 +      -post-compile:             called after javac compilation
   91.21 +      -pre-compile-single:       called before javac compilation of single file
   91.22 +      -post-compile-single:      called after javac compilation of single file
   91.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   91.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   91.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   91.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   91.27 +      -pre-jar:                  called before JAR building
   91.28 +      -post-jar:                 called after JAR building
   91.29 +      -post-clean:               called after cleaning build products
   91.30 +
   91.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   91.32 +
   91.33 +    Example of inserting an obfuscator after compilation could look like this:
   91.34 +
   91.35 +        <target name="-post-compile">
   91.36 +            <obfuscate>
   91.37 +                <fileset dir="${build.classes.dir}"/>
   91.38 +            </obfuscate>
   91.39 +        </target>
   91.40 +
   91.41 +    For list of available properties check the imported 
   91.42 +    nbproject/build-impl.xml file. 
   91.43 +
   91.44 +
   91.45 +    Another way to customize the build is by overriding existing main targets.
   91.46 +    The targets of interest are: 
   91.47 +
   91.48 +      -init-macrodef-javac:     defines macro for javac compilation
   91.49 +      -init-macrodef-junit:     defines macro for junit execution
   91.50 +      -init-macrodef-debug:     defines macro for class debugging
   91.51 +      -init-macrodef-java:      defines macro for class execution
   91.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   91.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   91.54 +      run:                      execution of project 
   91.55 +      -javadoc-build:           Javadoc generation
   91.56 +      test-report:              JUnit report generation
   91.57 +
   91.58 +    An example of overriding the target for project execution could look like this:
   91.59 +
   91.60 +        <target name="run" depends="currency-impl.jar">
   91.61 +            <exec dir="bin" executable="launcher.exe">
   91.62 +                <arg file="${dist.jar}"/>
   91.63 +            </exec>
   91.64 +        </target>
   91.65 +
   91.66 +    Notice that the overridden target depends on the jar target and not only on 
   91.67 +    the compile target as the regular run target does. Again, for a list of available 
   91.68 +    properties which you can use, check the target you are overriding in the
   91.69 +    nbproject/build-impl.xml file. 
   91.70 +
   91.71 +    -->
   91.72 +</project>
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/task1/solution08/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    92.3 @@ -0,0 +1,642 @@
    92.4 +<?xml version="1.0" encoding="UTF-8"?>
    92.5 +<!--
    92.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    92.7 +***         EDIT ../build.xml INSTEAD         ***
    92.8 +
    92.9 +For the purpose of easier reading the script
   92.10 +is divided into following sections:
   92.11 +
   92.12 +  - initialization
   92.13 +  - compilation
   92.14 +  - jar
   92.15 +  - execution
   92.16 +  - debugging
   92.17 +  - javadoc
   92.18 +  - junit compilation
   92.19 +  - junit execution
   92.20 +  - junit debugging
   92.21 +  - applet
   92.22 +  - cleanup
   92.23 +
   92.24 +        -->
   92.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_08-impl">
   92.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   92.27 +    <!-- 
   92.28 +                ======================
   92.29 +                INITIALIZATION SECTION 
   92.30 +                ======================
   92.31 +            -->
   92.32 +    <target name="-pre-init">
   92.33 +        <!-- Empty placeholder for easier customization. -->
   92.34 +        <!-- You can override this target in the ../build.xml file. -->
   92.35 +    </target>
   92.36 +    <target depends="-pre-init" name="-init-private">
   92.37 +        <property file="nbproject/private/config.properties"/>
   92.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   92.39 +        <property file="nbproject/private/private.properties"/>
   92.40 +    </target>
   92.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   92.42 +        <property file="${user.properties.file}"/>
   92.43 +        <!-- The two properties below are usually overridden -->
   92.44 +        <!-- by the active platform. Just a fallback. -->
   92.45 +        <property name="default.javac.source" value="1.4"/>
   92.46 +        <property name="default.javac.target" value="1.4"/>
   92.47 +    </target>
   92.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   92.49 +        <property file="nbproject/configs/${config}.properties"/>
   92.50 +        <property file="nbproject/project.properties"/>
   92.51 +    </target>
   92.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   92.53 +        <available file="${manifest.file}" property="manifest.available"/>
   92.54 +        <condition property="manifest.available+main.class">
   92.55 +            <and>
   92.56 +                <isset property="manifest.available"/>
   92.57 +                <isset property="main.class"/>
   92.58 +                <not>
   92.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   92.60 +                </not>
   92.61 +            </and>
   92.62 +        </condition>
   92.63 +        <condition property="manifest.available+main.class+mkdist.available">
   92.64 +            <and>
   92.65 +                <istrue value="${manifest.available+main.class}"/>
   92.66 +                <isset property="libs.CopyLibs.classpath"/>
   92.67 +            </and>
   92.68 +        </condition>
   92.69 +        <condition property="have.tests">
   92.70 +            <or>
   92.71 +                <available file="${test.src.dir}"/>
   92.72 +            </or>
   92.73 +        </condition>
   92.74 +        <condition property="have.sources">
   92.75 +            <or>
   92.76 +                <available file="${src.dir}"/>
   92.77 +            </or>
   92.78 +        </condition>
   92.79 +        <condition property="netbeans.home+have.tests">
   92.80 +            <and>
   92.81 +                <isset property="netbeans.home"/>
   92.82 +                <isset property="have.tests"/>
   92.83 +            </and>
   92.84 +        </condition>
   92.85 +        <condition property="no.javadoc.preview">
   92.86 +            <and>
   92.87 +                <isset property="javadoc.preview"/>
   92.88 +                <isfalse value="${javadoc.preview}"/>
   92.89 +            </and>
   92.90 +        </condition>
   92.91 +        <property name="run.jvmargs" value=""/>
   92.92 +        <property name="javac.compilerargs" value=""/>
   92.93 +        <property name="work.dir" value="${basedir}"/>
   92.94 +        <condition property="no.deps">
   92.95 +            <and>
   92.96 +                <istrue value="${no.dependencies}"/>
   92.97 +            </and>
   92.98 +        </condition>
   92.99 +        <property name="javac.debug" value="true"/>
  92.100 +        <property name="javadoc.preview" value="true"/>
  92.101 +        <property name="application.args" value=""/>
  92.102 +        <property name="source.encoding" value="${file.encoding}"/>
  92.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  92.104 +            <and>
  92.105 +                <isset property="javadoc.encoding"/>
  92.106 +                <not>
  92.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  92.108 +                </not>
  92.109 +            </and>
  92.110 +        </condition>
  92.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  92.112 +        <property name="includes" value="**"/>
  92.113 +        <property name="excludes" value=""/>
  92.114 +        <property name="do.depend" value="false"/>
  92.115 +        <condition property="do.depend.true">
  92.116 +            <istrue value="${do.depend}"/>
  92.117 +        </condition>
  92.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  92.119 +            <and>
  92.120 +                <isset property="jaxws.endorsed.dir"/>
  92.121 +                <available file="nbproject/jaxws-build.xml"/>
  92.122 +            </and>
  92.123 +        </condition>
  92.124 +    </target>
  92.125 +    <target name="-post-init">
  92.126 +        <!-- Empty placeholder for easier customization. -->
  92.127 +        <!-- You can override this target in the ../build.xml file. -->
  92.128 +    </target>
  92.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  92.130 +        <fail unless="src.dir">Must set src.dir</fail>
  92.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  92.132 +        <fail unless="build.dir">Must set build.dir</fail>
  92.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  92.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  92.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  92.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  92.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  92.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  92.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  92.140 +    </target>
  92.141 +    <target name="-init-macrodef-property">
  92.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  92.143 +            <attribute name="name"/>
  92.144 +            <attribute name="value"/>
  92.145 +            <sequential>
  92.146 +                <property name="@{name}" value="${@{value}}"/>
  92.147 +            </sequential>
  92.148 +        </macrodef>
  92.149 +    </target>
  92.150 +    <target name="-init-macrodef-javac">
  92.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  92.152 +            <attribute default="${src.dir}" name="srcdir"/>
  92.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  92.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  92.155 +            <attribute default="${includes}" name="includes"/>
  92.156 +            <attribute default="${excludes}" name="excludes"/>
  92.157 +            <attribute default="${javac.debug}" name="debug"/>
  92.158 +            <attribute default="" name="sourcepath"/>
  92.159 +            <element name="customize" optional="true"/>
  92.160 +            <sequential>
  92.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
  92.162 +                    <classpath>
  92.163 +                        <path path="@{classpath}"/>
  92.164 +                    </classpath>
  92.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  92.166 +                    <customize/>
  92.167 +                </javac>
  92.168 +            </sequential>
  92.169 +        </macrodef>
  92.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  92.171 +            <attribute default="${src.dir}" name="srcdir"/>
  92.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  92.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  92.174 +            <sequential>
  92.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  92.176 +                    <classpath>
  92.177 +                        <path path="@{classpath}"/>
  92.178 +                    </classpath>
  92.179 +                </depend>
  92.180 +            </sequential>
  92.181 +        </macrodef>
  92.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  92.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  92.184 +            <sequential>
  92.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  92.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  92.187 +                    <path>
  92.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  92.189 +                    </path>
  92.190 +                    <globmapper from="*.java" to="*.class"/>
  92.191 +                </pathconvert>
  92.192 +                <delete>
  92.193 +                    <files includes="${javac.includes.binary}"/>
  92.194 +                </delete>
  92.195 +            </sequential>
  92.196 +        </macrodef>
  92.197 +    </target>
  92.198 +    <target name="-init-macrodef-junit">
  92.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  92.200 +            <attribute default="${includes}" name="includes"/>
  92.201 +            <attribute default="${excludes}" name="excludes"/>
  92.202 +            <attribute default="**" name="testincludes"/>
  92.203 +            <sequential>
  92.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  92.205 +                    <batchtest todir="${build.test.results.dir}">
  92.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  92.207 +                            <filename name="@{testincludes}"/>
  92.208 +                        </fileset>
  92.209 +                    </batchtest>
  92.210 +                    <classpath>
  92.211 +                        <path path="${run.test.classpath}"/>
  92.212 +                    </classpath>
  92.213 +                    <syspropertyset>
  92.214 +                        <propertyref prefix="test-sys-prop."/>
  92.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  92.216 +                    </syspropertyset>
  92.217 +                    <formatter type="brief" usefile="false"/>
  92.218 +                    <formatter type="xml"/>
  92.219 +                    <jvmarg line="${run.jvmargs}"/>
  92.220 +                </junit>
  92.221 +            </sequential>
  92.222 +        </macrodef>
  92.223 +    </target>
  92.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  92.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  92.226 +            <attribute default="${main.class}" name="name"/>
  92.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  92.228 +            <attribute default="" name="stopclassname"/>
  92.229 +            <sequential>
  92.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  92.231 +                    <classpath>
  92.232 +                        <path path="@{classpath}"/>
  92.233 +                    </classpath>
  92.234 +                </nbjpdastart>
  92.235 +            </sequential>
  92.236 +        </macrodef>
  92.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  92.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  92.239 +            <sequential>
  92.240 +                <nbjpdareload>
  92.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  92.242 +                        <include name="${fix.includes}*.class"/>
  92.243 +                    </fileset>
  92.244 +                </nbjpdareload>
  92.245 +            </sequential>
  92.246 +        </macrodef>
  92.247 +    </target>
  92.248 +    <target name="-init-debug-args">
  92.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  92.250 +        <condition property="have-jdk-older-than-1.4">
  92.251 +            <or>
  92.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  92.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  92.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  92.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  92.256 +            </or>
  92.257 +        </condition>
  92.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  92.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
  92.260 +        </condition>
  92.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  92.262 +            <os family="windows"/>
  92.263 +        </condition>
  92.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  92.265 +            <isset property="debug.transport"/>
  92.266 +        </condition>
  92.267 +    </target>
  92.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  92.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  92.270 +            <attribute default="${main.class}" name="classname"/>
  92.271 +            <attribute default="${debug.classpath}" name="classpath"/>
  92.272 +            <element name="customize" optional="true"/>
  92.273 +            <sequential>
  92.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  92.275 +                    <jvmarg line="${debug-args-line}"/>
  92.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  92.277 +                    <jvmarg line="${run.jvmargs}"/>
  92.278 +                    <classpath>
  92.279 +                        <path path="@{classpath}"/>
  92.280 +                    </classpath>
  92.281 +                    <syspropertyset>
  92.282 +                        <propertyref prefix="run-sys-prop."/>
  92.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  92.284 +                    </syspropertyset>
  92.285 +                    <customize/>
  92.286 +                </java>
  92.287 +            </sequential>
  92.288 +        </macrodef>
  92.289 +    </target>
  92.290 +    <target name="-init-macrodef-java">
  92.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  92.292 +            <attribute default="${main.class}" name="classname"/>
  92.293 +            <element name="customize" optional="true"/>
  92.294 +            <sequential>
  92.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  92.296 +                    <jvmarg line="${run.jvmargs}"/>
  92.297 +                    <classpath>
  92.298 +                        <path path="${run.classpath}"/>
  92.299 +                    </classpath>
  92.300 +                    <syspropertyset>
  92.301 +                        <propertyref prefix="run-sys-prop."/>
  92.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  92.303 +                    </syspropertyset>
  92.304 +                    <customize/>
  92.305 +                </java>
  92.306 +            </sequential>
  92.307 +        </macrodef>
  92.308 +    </target>
  92.309 +    <target name="-init-presetdef-jar">
  92.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  92.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  92.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  92.313 +            </jar>
  92.314 +        </presetdef>
  92.315 +    </target>
  92.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  92.317 +    <!--
  92.318 +                ===================
  92.319 +                COMPILATION SECTION
  92.320 +                ===================
  92.321 +            -->
  92.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  92.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  92.324 +    <target depends="init" name="-check-automatic-build">
  92.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  92.326 +    </target>
  92.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  92.328 +        <antcall target="clean"/>
  92.329 +    </target>
  92.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  92.331 +        <mkdir dir="${build.classes.dir}"/>
  92.332 +    </target>
  92.333 +    <target name="-pre-compile">
  92.334 +        <!-- Empty placeholder for easier customization. -->
  92.335 +        <!-- You can override this target in the ../build.xml file. -->
  92.336 +    </target>
  92.337 +    <target if="do.depend.true" name="-compile-depend">
  92.338 +        <j2seproject3:depend/>
  92.339 +    </target>
  92.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  92.341 +        <j2seproject3:javac/>
  92.342 +        <copy todir="${build.classes.dir}">
  92.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  92.344 +        </copy>
  92.345 +    </target>
  92.346 +    <target name="-post-compile">
  92.347 +        <!-- Empty placeholder for easier customization. -->
  92.348 +        <!-- You can override this target in the ../build.xml file. -->
  92.349 +    </target>
  92.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  92.351 +    <target name="-pre-compile-single">
  92.352 +        <!-- Empty placeholder for easier customization. -->
  92.353 +        <!-- You can override this target in the ../build.xml file. -->
  92.354 +    </target>
  92.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  92.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  92.357 +        <j2seproject3:force-recompile/>
  92.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  92.359 +    </target>
  92.360 +    <target name="-post-compile-single">
  92.361 +        <!-- Empty placeholder for easier customization. -->
  92.362 +        <!-- You can override this target in the ../build.xml file. -->
  92.363 +    </target>
  92.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  92.365 +    <!--
  92.366 +                ====================
  92.367 +                JAR BUILDING SECTION
  92.368 +                ====================
  92.369 +            -->
  92.370 +    <target depends="init" name="-pre-pre-jar">
  92.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  92.372 +        <mkdir dir="${dist.jar.dir}"/>
  92.373 +    </target>
  92.374 +    <target name="-pre-jar">
  92.375 +        <!-- Empty placeholder for easier customization. -->
  92.376 +        <!-- You can override this target in the ../build.xml file. -->
  92.377 +    </target>
  92.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  92.379 +        <j2seproject1:jar/>
  92.380 +    </target>
  92.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  92.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
  92.383 +    </target>
  92.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  92.385 +        <j2seproject1:jar manifest="${manifest.file}">
  92.386 +            <j2seproject1:manifest>
  92.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  92.388 +            </j2seproject1:manifest>
  92.389 +        </j2seproject1:jar>
  92.390 +        <echo>To run this application from the command line without Ant, try:</echo>
  92.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  92.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  92.393 +        <pathconvert property="run.classpath.with.dist.jar">
  92.394 +            <path path="${run.classpath}"/>
  92.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  92.396 +        </pathconvert>
  92.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  92.398 +    </target>
  92.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  92.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  92.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
  92.402 +            <path path="${run.classpath}"/>
  92.403 +            <map from="${build.classes.dir.resolved}" to=""/>
  92.404 +        </pathconvert>
  92.405 +        <pathconvert pathsep=" " property="jar.classpath">
  92.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
  92.407 +            <chainedmapper>
  92.408 +                <flattenmapper/>
  92.409 +                <globmapper from="*" to="lib/*"/>
  92.410 +            </chainedmapper>
  92.411 +        </pathconvert>
  92.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  92.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  92.414 +            <fileset dir="${build.classes.dir}"/>
  92.415 +            <manifest>
  92.416 +                <attribute name="Main-Class" value="${main.class}"/>
  92.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  92.418 +            </manifest>
  92.419 +        </copylibs>
  92.420 +        <echo>To run this application from the command line without Ant, try:</echo>
  92.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  92.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  92.423 +    </target>
  92.424 +    <target name="-post-jar">
  92.425 +        <!-- Empty placeholder for easier customization. -->
  92.426 +        <!-- You can override this target in the ../build.xml file. -->
  92.427 +    </target>
  92.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  92.429 +    <!--
  92.430 +                =================
  92.431 +                EXECUTION SECTION
  92.432 +                =================
  92.433 +            -->
  92.434 +    <target depends="init,compile" description="Run a main class." name="run">
  92.435 +        <j2seproject1:java>
  92.436 +            <customize>
  92.437 +                <arg line="${application.args}"/>
  92.438 +            </customize>
  92.439 +        </j2seproject1:java>
  92.440 +    </target>
  92.441 +    <target name="-do-not-recompile">
  92.442 +        <property name="javac.includes.binary" value=""/>
  92.443 +    </target>
  92.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  92.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  92.446 +        <j2seproject1:java classname="${run.class}"/>
  92.447 +    </target>
  92.448 +    <!--
  92.449 +                =================
  92.450 +                DEBUGGING SECTION
  92.451 +                =================
  92.452 +            -->
  92.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  92.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  92.455 +    </target>
  92.456 +    <target depends="init,compile" name="-debug-start-debuggee">
  92.457 +        <j2seproject3:debug>
  92.458 +            <customize>
  92.459 +                <arg line="${application.args}"/>
  92.460 +            </customize>
  92.461 +        </j2seproject3:debug>
  92.462 +    </target>
  92.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  92.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  92.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  92.466 +    </target>
  92.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  92.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  92.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  92.470 +        <j2seproject3:debug classname="${debug.class}"/>
  92.471 +    </target>
  92.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  92.473 +    <target depends="init" name="-pre-debug-fix">
  92.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
  92.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
  92.476 +    </target>
  92.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  92.478 +        <j2seproject1:nbjpdareload/>
  92.479 +    </target>
  92.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  92.481 +    <!--
  92.482 +                ===============
  92.483 +                JAVADOC SECTION
  92.484 +                ===============
  92.485 +            -->
  92.486 +    <target depends="init" name="-javadoc-build">
  92.487 +        <mkdir dir="${dist.javadoc.dir}"/>
  92.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  92.489 +            <classpath>
  92.490 +                <path path="${javac.classpath}"/>
  92.491 +            </classpath>
  92.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  92.493 +                <filename name="**/*.java"/>
  92.494 +            </fileset>
  92.495 +        </javadoc>
  92.496 +    </target>
  92.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  92.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  92.499 +    </target>
  92.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  92.501 +    <!--
  92.502 +                =========================
  92.503 +                JUNIT COMPILATION SECTION
  92.504 +                =========================
  92.505 +            -->
  92.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  92.507 +        <mkdir dir="${build.test.classes.dir}"/>
  92.508 +    </target>
  92.509 +    <target name="-pre-compile-test">
  92.510 +        <!-- Empty placeholder for easier customization. -->
  92.511 +        <!-- You can override this target in the ../build.xml file. -->
  92.512 +    </target>
  92.513 +    <target if="do.depend.true" name="-compile-test-depend">
  92.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  92.515 +    </target>
  92.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  92.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  92.518 +        <copy todir="${build.test.classes.dir}">
  92.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  92.520 +        </copy>
  92.521 +    </target>
  92.522 +    <target name="-post-compile-test">
  92.523 +        <!-- Empty placeholder for easier customization. -->
  92.524 +        <!-- You can override this target in the ../build.xml file. -->
  92.525 +    </target>
  92.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  92.527 +    <target name="-pre-compile-test-single">
  92.528 +        <!-- Empty placeholder for easier customization. -->
  92.529 +        <!-- You can override this target in the ../build.xml file. -->
  92.530 +    </target>
  92.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  92.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  92.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  92.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  92.535 +        <copy todir="${build.test.classes.dir}">
  92.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  92.537 +        </copy>
  92.538 +    </target>
  92.539 +    <target name="-post-compile-test-single">
  92.540 +        <!-- Empty placeholder for easier customization. -->
  92.541 +        <!-- You can override this target in the ../build.xml file. -->
  92.542 +    </target>
  92.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  92.544 +    <!--
  92.545 +                =======================
  92.546 +                JUNIT EXECUTION SECTION
  92.547 +                =======================
  92.548 +            -->
  92.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
  92.550 +        <mkdir dir="${build.test.results.dir}"/>
  92.551 +    </target>
  92.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  92.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  92.554 +    </target>
  92.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  92.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  92.557 +    </target>
  92.558 +    <target depends="init" if="have.tests" name="test-report"/>
  92.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  92.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  92.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  92.562 +        <mkdir dir="${build.test.results.dir}"/>
  92.563 +    </target>
  92.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  92.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  92.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  92.567 +    </target>
  92.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  92.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  92.570 +    </target>
  92.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  92.572 +    <!--
  92.573 +                =======================
  92.574 +                JUNIT DEBUGGING SECTION
  92.575 +                =======================
  92.576 +            -->
  92.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  92.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  92.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  92.580 +        <delete file="${test.report.file}"/>
  92.581 +        <mkdir dir="${build.test.results.dir}"/>
  92.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  92.583 +            <customize>
  92.584 +                <syspropertyset>
  92.585 +                    <propertyref prefix="test-sys-prop."/>
  92.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  92.587 +                </syspropertyset>
  92.588 +                <arg value="${test.class}"/>
  92.589 +                <arg value="showoutput=true"/>
  92.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  92.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  92.592 +            </customize>
  92.593 +        </j2seproject3:debug>
  92.594 +    </target>
  92.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  92.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  92.597 +    </target>
  92.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  92.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  92.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  92.601 +    </target>
  92.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  92.603 +    <!--
  92.604 +                =========================
  92.605 +                APPLET EXECUTION SECTION
  92.606 +                =========================
  92.607 +            -->
  92.608 +    <target depends="init,compile-single" name="run-applet">
  92.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  92.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  92.611 +            <customize>
  92.612 +                <arg value="${applet.url}"/>
  92.613 +            </customize>
  92.614 +        </j2seproject1:java>
  92.615 +    </target>
  92.616 +    <!--
  92.617 +                =========================
  92.618 +                APPLET DEBUGGING  SECTION
  92.619 +                =========================
  92.620 +            -->
  92.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  92.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  92.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  92.624 +            <customize>
  92.625 +                <arg value="${applet.url}"/>
  92.626 +            </customize>
  92.627 +        </j2seproject3:debug>
  92.628 +    </target>
  92.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  92.630 +    <!--
  92.631 +                ===============
  92.632 +                CLEANUP SECTION
  92.633 +                ===============
  92.634 +            -->
  92.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  92.636 +    <target depends="init" name="-do-clean">
  92.637 +        <delete dir="${build.dir}"/>
  92.638 +        <delete dir="${dist.dir}"/>
  92.639 +    </target>
  92.640 +    <target name="-post-clean">
  92.641 +        <!-- Empty placeholder for easier customization. -->
  92.642 +        <!-- You can override this target in the ../build.xml file. -->
  92.643 +    </target>
  92.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  92.645 +</project>
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/task1/solution08/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
    93.3 @@ -0,0 +1,8 @@
    93.4 +build.xml.data.CRC32=2ab820eb
    93.5 +build.xml.script.CRC32=58a52595
    93.6 +build.xml.stylesheet.CRC32=be360661
    93.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    93.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    93.9 +nbproject/build-impl.xml.data.CRC32=a2ad29dd
   93.10 +nbproject/build-impl.xml.script.CRC32=43c3e6a6
   93.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/task1/solution08/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
    94.3 @@ -0,0 +1,68 @@
    94.4 +application.title=currency
    94.5 +application.vendor=apidesign.org
    94.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
    94.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
    94.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
    94.9 +build.classes.dir=${build.dir}/classes
   94.10 +build.classes.excludes=**/*.java,**/*.form
   94.11 +# This directory is removed when the project is cleaned:
   94.12 +build.dir=build
   94.13 +build.generated.dir=${build.dir}/generated
   94.14 +# Only compile against the classpath explicitly listed here:
   94.15 +build.sysclasspath=ignore
   94.16 +build.test.classes.dir=${build.dir}/test/classes
   94.17 +build.test.results.dir=${build.dir}/test/results
   94.18 +debug.classpath=\
   94.19 +    ${run.classpath}
   94.20 +debug.test.classpath=\
   94.21 +    ${run.test.classpath}
   94.22 +# This directory is removed when the project is cleaned:
   94.23 +dist.dir=dist
   94.24 +dist.jar=${dist.dir}/currency.jar
   94.25 +dist.javadoc.dir=${dist.dir}/javadoc
   94.26 +excludes=
   94.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
   94.28 +file.reference.src-apifest08=..
   94.29 +includes=**
   94.30 +jar.compress=false
   94.31 +javac.classpath=
   94.32 +# Space-separated list of extra javac options
   94.33 +javac.compilerargs=
   94.34 +javac.deprecation=false
   94.35 +javac.source=1.5
   94.36 +javac.target=1.5
   94.37 +javac.test.classpath=\
   94.38 +    ${javac.classpath}:\
   94.39 +    ${build.classes.dir}:\
   94.40 +    ${file.reference.junit-4.4.jar}
   94.41 +javadoc.additionalparam=
   94.42 +javadoc.author=false
   94.43 +javadoc.encoding=
   94.44 +javadoc.noindex=false
   94.45 +javadoc.nonavbar=false
   94.46 +javadoc.notree=false
   94.47 +javadoc.private=false
   94.48 +javadoc.splitindex=true
   94.49 +javadoc.use=true
   94.50 +javadoc.version=false
   94.51 +javadoc.windowtitle=
   94.52 +jnlp.codebase.type=local
   94.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
   94.54 +jnlp.descriptor=application
   94.55 +jnlp.enabled=false
   94.56 +jnlp.offline-allowed=false
   94.57 +jnlp.signed=false
   94.58 +meta.inf.dir=${src.dir}/META-INF
   94.59 +platform.active=default_platform
   94.60 +run.classpath=\
   94.61 +    ${javac.classpath}:\
   94.62 +    ${build.classes.dir}
   94.63 +# Space-separated list of JVM arguments used when running the project
   94.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   94.65 +# or test-sys-prop.name=value to set system properties for unit tests):
   94.66 +run.jvmargs=
   94.67 +run.test.classpath=\
   94.68 +    ${javac.test.classpath}:\
   94.69 +    ${build.test.classes.dir}
   94.70 +src.dir=src
   94.71 +test.src.dir=test
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/task1/solution08/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
    95.3 @@ -0,0 +1,16 @@
    95.4 +<?xml version="1.0" encoding="UTF-8"?>
    95.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    95.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    95.7 +    <configuration>
    95.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    95.9 +            <name>Currency Convertor Solution 08</name>
   95.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   95.11 +            <source-roots>
   95.12 +                <root id="src.dir"/>
   95.13 +            </source-roots>
   95.14 +            <test-roots>
   95.15 +                <root id="test.src.dir"/>
   95.16 +            </test-roots>
   95.17 +        </data>
   95.18 +    </configuration>
   95.19 +</project>
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/task1/solution08/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
    96.3 @@ -0,0 +1,55 @@
    96.4 +package org.apidesign.apifest08.currency;
    96.5 +
    96.6 +import java.util.Currency;
    96.7 +import java.util.Hashtable;
    96.8 +import java.util.Map;
    96.9 +
   96.10 +/** This is the skeleton class for your API. You need to make it public, so
   96.11 + * it is accessible to your client code (currently in Task1Test.java) file.
   96.12 + * <p>
   96.13 + * Feel free to create additional classes or rename this one, just keep all
   96.14 + * the API and its implementation in this package. Do not spread it outside
   96.15 + * to other packages.
   96.16 + */
   96.17 +public class Convertor {
   96.18 +    
   96.19 +    private static final Map<String, Float> EXCHANGE_RATES = new Hashtable<String, Float>() { {
   96.20 +            put("CZKUSD", 1/17F);
   96.21 +            put("USDCZK", 17F);
   96.22 +            put("SKKCZK", 100/80F);
   96.23 +            put("CZKSKK", 80/100F);
   96.24 +        }
   96.25 +    };
   96.26 +    
   96.27 +    private Currency currencyFirst;
   96.28 +    private Currency currencySecond;
   96.29 +    
   96.30 +    private Convertor(Currency currencyFirst, Currency currencySecond) {
   96.31 +        this.currencyFirst = currencyFirst;
   96.32 +        this.currencySecond = currencySecond;
   96.33 +    }
   96.34 +    
   96.35 +    public static Convertor getInstanceFor(Currency currencyFirst, Currency currencySecond) {
   96.36 +        return new Convertor(currencyFirst, currencySecond);
   96.37 +    }
   96.38 +    
   96.39 +    public float convert(float value, Currency toCurrency) {
   96.40 +        if (!toCurrency.equals(currencyFirst) && !toCurrency.equals(currencySecond)) {
   96.41 +            throw new IllegalArgumentException("Unsupported currency for this convertor!: " + toCurrency.getCurrencyCode());
   96.42 +        }
   96.43 +        
   96.44 +        Float rate = null;
   96.45 +        if (toCurrency.equals(currencyFirst)) {
   96.46 +            rate = EXCHANGE_RATES.get(currencyFirst.getCurrencyCode() + currencySecond.getCurrencyCode());
   96.47 +        }
   96.48 +        if (toCurrency.equals(currencySecond)) {
   96.49 +            rate = EXCHANGE_RATES.get(currencySecond.getCurrencyCode() + currencyFirst.getCurrencyCode());
   96.50 +        }
   96.51 +
   96.52 +        if (rate == null) {
   96.53 +            throw new IllegalStateException("Undefinied conversion!");
   96.54 +        }
   96.55 +
   96.56 +        return rate*value;
   96.57 +    }
   96.58 +}
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/task1/solution08/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
    97.3 @@ -0,0 +1,86 @@
    97.4 +package org.apidesign.apifest08.test;
    97.5 +
    97.6 +import java.util.Currency;
    97.7 +import junit.framework.TestCase;
    97.8 +import org.apidesign.apifest08.currency.Convertor;
    97.9 +
   97.10 +/** Finish the Convertor API, and then write bodies of methods inside
   97.11 + * of this class to match the given tasks. To fullfil your task, use the
   97.12 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
   97.13 + * Do not you reflection, or other hacks as your code
   97.14 + * shall run without any runtime permissions.
   97.15 + */
   97.16 +public class Task1Test extends TestCase {
   97.17 +    public Task1Test(String testName) {
   97.18 +        super(testName);
   97.19 +    }
   97.20 +
   97.21 +    @Override
   97.22 +    protected void setUp() throws Exception {
   97.23 +    }
   97.24 +
   97.25 +    @Override
   97.26 +    protected void tearDown() throws Exception {
   97.27 +    }
   97.28 +
   97.29 +    /** Create convertor that understands two currencies, CZK and
   97.30 +     *  USD. Make 1 USD == 17 CZK.
   97.31 +     *
   97.32 +     * Creation of the convertor shall not require subclassing of any class
   97.33 +     * or interface on the client side.
   97.34 +     *
   97.35 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
   97.36 +     */
   97.37 +    public static Convertor createCZKtoUSD() {
   97.38 +        return Convertor.getInstanceFor(Currency.getInstance("CZK"), Currency.getInstance("USD"));
   97.39 +    }
   97.40 +
   97.41 +    /** Create convertor that understands two currencies, CZK and
   97.42 +     *  SKK. Make 100 SKK == 80 CZK.
   97.43 +     *
   97.44 +     * Creation of the convertor shall not require subclassing of any class
   97.45 +     * or interface on the client side.
   97.46 +     * 
   97.47 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
   97.48 +     */
   97.49 +    public static Convertor createSKKtoCZK() {
   97.50 +        return Convertor.getInstanceFor(Currency.getInstance("SKK"), Currency.getInstance("CZK"));
   97.51 +    }
   97.52 +    
   97.53 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
   97.54 +     * with it.
   97.55 +     */
   97.56 +    public void testCurrencyCZKUSD() throws Exception {
   97.57 +        Convertor c = createCZKtoUSD();
   97.58 +        Currency usd = Currency.getInstance("USD");
   97.59 +        Currency czk = Currency.getInstance("CZK");
   97.60 +        // convert $5 to CZK using c:
   97.61 +        // assertEquals("Result is 85 CZK");
   97.62 +        assertEquals(85F, c.convert(5, usd));
   97.63 +
   97.64 +        // convert $8 to CZK
   97.65 +        // assertEquals("Result is 136 CZK");
   97.66 +        assertEquals(136F, c.convert(8, usd));
   97.67 +
   97.68 +        // convert 1003CZK to USD
   97.69 +        // assertEquals("Result is 59 USD");
   97.70 +        assertEquals(59F, c.convert(1003, czk));
   97.71 +    }
   97.72 +
   97.73 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
   97.74 +     * with it.
   97.75 +     */
   97.76 +    public void testCurrencySKKCZK() throws Exception {
   97.77 +        Convertor c = createSKKtoCZK();
   97.78 +        Currency skk = Currency.getInstance("SKK");
   97.79 +        Currency czk = Currency.getInstance("CZK");
   97.80 +        // convert 16CZK using c:
   97.81 +        // assertEquals("Result is 20 SKK");
   97.82 +        assertEquals(20F, c.convert(16, skk));
   97.83 +
   97.84 +        // convert 500SKK to CZK
   97.85 +        // assertEquals("Result is 400 CZK");
   97.86 +        assertEquals(400F, c.convert(500, czk));
   97.87 +    }
   97.88 +}
   97.89 +
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/task1/solution09/build.xml	Sun Sep 28 14:12:38 2008 +0200
    98.3 @@ -0,0 +1,69 @@
    98.4 +<?xml version="1.0" encoding="UTF-8"?>
    98.5 +<!-- You may freely edit this file. See commented blocks below for -->
    98.6 +<!-- some examples of how to customize the build. -->
    98.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    98.8 +<project name="currency" default="default" basedir=".">
    98.9 +    <description>Builds, tests, and runs the project.</description>
   98.10 +    <import file="nbproject/build-impl.xml"/>
   98.11 +    <!--
   98.12 +
   98.13 +    There exist several targets which are by default empty and which can be 
   98.14 +    used for execution of your tasks. These targets are usually executed 
   98.15 +    before and after some main targets. They are: 
   98.16 +
   98.17 +      -pre-init:                 called before initialization of project properties
   98.18 +      -post-init:                called after initialization of project properties
   98.19 +      -pre-compile:              called before javac compilation
   98.20 +      -post-compile:             called after javac compilation
   98.21 +      -pre-compile-single:       called before javac compilation of single file
   98.22 +      -post-compile-single:      called after javac compilation of single file
   98.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   98.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   98.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   98.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   98.27 +      -pre-jar:                  called before JAR building
   98.28 +      -post-jar:                 called after JAR building
   98.29 +      -post-clean:               called after cleaning build products
   98.30 +
   98.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   98.32 +
   98.33 +    Example of inserting an obfuscator after compilation could look like this:
   98.34 +
   98.35 +        <target name="-post-compile">
   98.36 +            <obfuscate>
   98.37 +                <fileset dir="${build.classes.dir}"/>
   98.38 +            </obfuscate>
   98.39 +        </target>
   98.40 +
   98.41 +    For list of available properties check the imported 
   98.42 +    nbproject/build-impl.xml file. 
   98.43 +
   98.44 +
   98.45 +    Another way to customize the build is by overriding existing main targets.
   98.46 +    The targets of interest are: 
   98.47 +
   98.48 +      -init-macrodef-javac:     defines macro for javac compilation
   98.49 +      -init-macrodef-junit:     defines macro for junit execution
   98.50 +      -init-macrodef-debug:     defines macro for class debugging
   98.51 +      -init-macrodef-java:      defines macro for class execution
   98.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   98.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   98.54 +      run:                      execution of project 
   98.55 +      -javadoc-build:           Javadoc generation
   98.56 +      test-report:              JUnit report generation
   98.57 +
   98.58 +    An example of overriding the target for project execution could look like this:
   98.59 +
   98.60 +        <target name="run" depends="currency-impl.jar">
   98.61 +            <exec dir="bin" executable="launcher.exe">
   98.62 +                <arg file="${dist.jar}"/>
   98.63 +            </exec>
   98.64 +        </target>
   98.65 +
   98.66 +    Notice that the overridden target depends on the jar target and not only on 
   98.67 +    the compile target as the regular run target does. Again, for a list of available 
   98.68 +    properties which you can use, check the target you are overriding in the
   98.69 +    nbproject/build-impl.xml file. 
   98.70 +
   98.71 +    -->
   98.72 +</project>
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/task1/solution09/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
    99.3 @@ -0,0 +1,684 @@
    99.4 +<?xml version="1.0" encoding="UTF-8"?>
    99.5 +<!--
    99.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    99.7 +***         EDIT ../build.xml INSTEAD         ***
    99.8 +
    99.9 +For the purpose of easier reading the script
   99.10 +is divided into following sections:
   99.11 +
   99.12 +  - initialization
   99.13 +  - compilation
   99.14 +  - jar
   99.15 +  - execution
   99.16 +  - debugging
   99.17 +  - javadoc
   99.18 +  - junit compilation
   99.19 +  - junit execution
   99.20 +  - junit debugging
   99.21 +  - applet
   99.22 +  - cleanup
   99.23 +
   99.24 +        -->
   99.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_09-impl">
   99.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   99.27 +    <!-- 
   99.28 +                ======================
   99.29 +                INITIALIZATION SECTION 
   99.30 +                ======================
   99.31 +            -->
   99.32 +    <target name="-pre-init">
   99.33 +        <!-- Empty placeholder for easier customization. -->
   99.34 +        <!-- You can override this target in the ../build.xml file. -->
   99.35 +    </target>
   99.36 +    <target depends="-pre-init" name="-init-private">
   99.37 +        <property file="nbproject/private/config.properties"/>
   99.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   99.39 +        <property file="nbproject/private/private.properties"/>
   99.40 +    </target>
   99.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   99.42 +        <property file="${user.properties.file}"/>
   99.43 +        <!-- The two properties below are usually overridden -->
   99.44 +        <!-- by the active platform. Just a fallback. -->
   99.45 +        <property name="default.javac.source" value="1.4"/>
   99.46 +        <property name="default.javac.target" value="1.4"/>
   99.47 +    </target>
   99.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   99.49 +        <property file="nbproject/configs/${config}.properties"/>
   99.50 +        <property file="nbproject/project.properties"/>
   99.51 +    </target>
   99.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   99.53 +        <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
   99.54 +        <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
   99.55 +        <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
   99.56 +        <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
   99.57 +        <condition property="platform.javac" value="${platform.home}/bin/javac">
   99.58 +            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
   99.59 +        </condition>
   99.60 +        <property name="platform.javac" value="${platform.javac.tmp}"/>
   99.61 +        <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
   99.62 +        <condition property="platform.java" value="${platform.home}/bin/java">
   99.63 +            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
   99.64 +        </condition>
   99.65 +        <property name="platform.java" value="${platform.java.tmp}"/>
   99.66 +        <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
   99.67 +        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
   99.68 +            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
   99.69 +        </condition>
   99.70 +        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
   99.71 +        <condition property="platform.invalid" value="true">
   99.72 +            <or>
   99.73 +                <contains string="${platform.javac}" substring="$${platforms."/>
   99.74 +                <contains string="${platform.java}" substring="$${platforms."/>
   99.75 +                <contains string="${platform.javadoc}" substring="$${platforms."/>
   99.76 +            </or>
   99.77 +        </condition>
   99.78 +        <fail unless="platform.home">Must set platform.home</fail>
   99.79 +        <fail unless="platform.bootcp">Must set platform.bootcp</fail>
   99.80 +        <fail unless="platform.java">Must set platform.java</fail>
   99.81 +        <fail unless="platform.javac">Must set platform.javac</fail>
   99.82 +        <fail if="platform.invalid">
   99.83 + The J2SE Platform is not correctly set up.
   99.84 + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 
   99.85 + Either open the project in the IDE and setup the Platform with the same name or add it manually.
   99.86 + For example like this:
   99.87 +     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
   99.88 +  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) 
   99.89 +  </fail>
   99.90 +        <available file="${manifest.file}" property="manifest.available"/>
   99.91 +        <condition property="manifest.available+main.class">
   99.92 +            <and>
   99.93 +                <isset property="manifest.available"/>
   99.94 +                <isset property="main.class"/>
   99.95 +                <not>
   99.96 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   99.97 +                </not>
   99.98 +            </and>
   99.99 +        </condition>
  99.100 +        <condition property="manifest.available+main.class+mkdist.available">
  99.101 +            <and>
  99.102 +                <istrue value="${manifest.available+main.class}"/>
  99.103 +                <isset property="libs.CopyLibs.classpath"/>
  99.104 +            </and>
  99.105 +        </condition>
  99.106 +        <condition property="have.tests">
  99.107 +            <or>
  99.108 +                <available file="${test.src.dir}"/>
  99.109 +            </or>
  99.110 +        </condition>
  99.111 +        <condition property="have.sources">
  99.112 +            <or>
  99.113 +                <available file="${src.dir}"/>
  99.114 +            </or>
  99.115 +        </condition>
  99.116 +        <condition property="netbeans.home+have.tests">
  99.117 +            <and>
  99.118 +                <isset property="netbeans.home"/>
  99.119 +                <isset property="have.tests"/>
  99.120 +            </and>
  99.121 +        </condition>
  99.122 +        <condition property="no.javadoc.preview">
  99.123 +            <and>
  99.124 +                <isset property="javadoc.preview"/>
  99.125 +                <isfalse value="${javadoc.preview}"/>
  99.126 +            </and>
  99.127 +        </condition>
  99.128 +        <property name="run.jvmargs" value=""/>
  99.129 +        <property name="javac.compilerargs" value=""/>
  99.130 +        <property name="work.dir" value="${basedir}"/>
  99.131 +        <condition property="no.deps">
  99.132 +            <and>
  99.133 +                <istrue value="${no.dependencies}"/>
  99.134 +            </and>
  99.135 +        </condition>
  99.136 +        <property name="javac.debug" value="true"/>
  99.137 +        <property name="javadoc.preview" value="true"/>
  99.138 +        <property name="application.args" value=""/>
  99.139 +        <property name="source.encoding" value="${file.encoding}"/>
  99.140 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  99.141 +            <and>
  99.142 +                <isset property="javadoc.encoding"/>
  99.143 +                <not>
  99.144 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  99.145 +                </not>
  99.146 +            </and>
  99.147 +        </condition>
  99.148 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  99.149 +        <property name="includes" value="**"/>
  99.150 +        <property name="excludes" value=""/>
  99.151 +        <property name="do.depend" value="false"/>
  99.152 +        <condition property="do.depend.true">
  99.153 +            <istrue value="${do.depend}"/>
  99.154 +        </condition>
  99.155 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  99.156 +            <and>
  99.157 +                <isset property="jaxws.endorsed.dir"/>
  99.158 +                <available file="nbproject/jaxws-build.xml"/>
  99.159 +            </and>
  99.160 +        </condition>
  99.161 +    </target>
  99.162 +    <target name="-post-init">
  99.163 +        <!-- Empty placeholder for easier customization. -->
  99.164 +        <!-- You can override this target in the ../build.xml file. -->
  99.165 +    </target>
  99.166 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  99.167 +        <fail unless="src.dir">Must set src.dir</fail>
  99.168 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  99.169 +        <fail unless="build.dir">Must set build.dir</fail>
  99.170 +        <fail unless="dist.dir">Must set dist.dir</fail>
  99.171 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  99.172 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  99.173 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  99.174 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  99.175 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  99.176 +        <fail unless="dist.jar">Must set dist.jar</fail>
  99.177 +    </target>
  99.178 +    <target name="-init-macrodef-property">
  99.179 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  99.180 +            <attribute name="name"/>
  99.181 +            <attribute name="value"/>
  99.182 +            <sequential>
  99.183 +                <property name="@{name}" value="${@{value}}"/>
  99.184 +            </sequential>
  99.185 +        </macrodef>
  99.186 +    </target>
  99.187 +    <target name="-init-macrodef-javac">
  99.188 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  99.189 +            <attribute default="${src.dir}" name="srcdir"/>
  99.190 +            <attribute default="${build.classes.dir}" name="destdir"/>
  99.191 +            <attribute default="${javac.classpath}" name="classpath"/>
  99.192 +            <attribute default="${includes}" name="includes"/>
  99.193 +            <attribute default="${excludes}" name="excludes"/>
  99.194 +            <attribute default="${javac.debug}" name="debug"/>
  99.195 +            <attribute default="" name="sourcepath"/>
  99.196 +            <element name="customize" optional="true"/>
  99.197 +            <sequential>
  99.198 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
  99.199 +                    <classpath>
  99.200 +                        <path path="@{classpath}"/>
  99.201 +                    </classpath>
  99.202 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  99.203 +                    <customize/>
  99.204 +                </javac>
  99.205 +            </sequential>
  99.206 +        </macrodef>
  99.207 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  99.208 +            <attribute default="${src.dir}" name="srcdir"/>
  99.209 +            <attribute default="${build.classes.dir}" name="destdir"/>
  99.210 +            <attribute default="${javac.classpath}" name="classpath"/>
  99.211 +            <sequential>
  99.212 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  99.213 +                    <classpath>
  99.214 +                        <path path="@{classpath}"/>
  99.215 +                    </classpath>
  99.216 +                </depend>
  99.217 +            </sequential>
  99.218 +        </macrodef>
  99.219 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  99.220 +            <attribute default="${build.classes.dir}" name="destdir"/>
  99.221 +            <sequential>
  99.222 +                <fail unless="javac.includes">Must set javac.includes</fail>
  99.223 +                <pathconvert pathsep="," property="javac.includes.binary">
  99.224 +                    <path>
  99.225 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  99.226 +                    </path>
  99.227 +                    <globmapper from="*.java" to="*.class"/>
  99.228 +                </pathconvert>
  99.229 +                <delete>
  99.230 +                    <files includes="${javac.includes.binary}"/>
  99.231 +                </delete>
  99.232 +            </sequential>
  99.233 +        </macrodef>
  99.234 +    </target>
  99.235 +    <target name="-init-macrodef-junit">
  99.236 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  99.237 +            <attribute default="${includes}" name="includes"/>
  99.238 +            <attribute default="${excludes}" name="excludes"/>
  99.239 +            <attribute default="**" name="testincludes"/>
  99.240 +            <sequential>
  99.241 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true">
  99.242 +                    <batchtest todir="${build.test.results.dir}">
  99.243 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  99.244 +                            <filename name="@{testincludes}"/>
  99.245 +                        </fileset>
  99.246 +                    </batchtest>
  99.247 +                    <classpath>
  99.248 +                        <path path="${run.test.classpath}"/>
  99.249 +                    </classpath>
  99.250 +                    <syspropertyset>
  99.251 +                        <propertyref prefix="test-sys-prop."/>
  99.252 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  99.253 +                    </syspropertyset>
  99.254 +                    <formatter type="brief" usefile="false"/>
  99.255 +                    <formatter type="xml"/>
  99.256 +                    <jvmarg line="${run.jvmargs}"/>
  99.257 +                </junit>
  99.258 +            </sequential>
  99.259 +        </macrodef>
  99.260 +    </target>
  99.261 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  99.262 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  99.263 +            <attribute default="${main.class}" name="name"/>
  99.264 +            <attribute default="${debug.classpath}" name="classpath"/>
  99.265 +            <attribute default="" name="stopclassname"/>
  99.266 +            <sequential>
  99.267 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  99.268 +                    <classpath>
  99.269 +                        <path path="@{classpath}"/>
  99.270 +                    </classpath>
  99.271 +                    <bootclasspath>
  99.272 +                        <path path="${platform.bootcp}"/>
  99.273 +                    </bootclasspath>
  99.274 +                </nbjpdastart>
  99.275 +            </sequential>
  99.276 +        </macrodef>
  99.277 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  99.278 +            <attribute default="${build.classes.dir}" name="dir"/>
  99.279 +            <sequential>
  99.280 +                <nbjpdareload>
  99.281 +                    <fileset dir="@{dir}" includes="${fix.classes}">
  99.282 +                        <include name="${fix.includes}*.class"/>
  99.283 +                    </fileset>
  99.284 +                </nbjpdareload>
  99.285 +            </sequential>
  99.286 +        </macrodef>
  99.287 +    </target>
  99.288 +    <target name="-init-debug-args">
  99.289 +        <exec executable="${platform.java}" outputproperty="version-output">
  99.290 +            <arg value="-version"/>
  99.291 +        </exec>
  99.292 +        <condition property="have-jdk-older-than-1.4">
  99.293 +            <or>
  99.294 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  99.295 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  99.296 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  99.297 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  99.298 +            </or>
  99.299 +        </condition>
  99.300 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  99.301 +            <istrue value="${have-jdk-older-than-1.4}"/>
  99.302 +        </condition>
  99.303 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  99.304 +            <os family="windows"/>
  99.305 +        </condition>
  99.306 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  99.307 +            <isset property="debug.transport"/>
  99.308 +        </condition>
  99.309 +    </target>
  99.310 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  99.311 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  99.312 +            <attribute default="${main.class}" name="classname"/>
  99.313 +            <attribute default="${debug.classpath}" name="classpath"/>
  99.314 +            <element name="customize" optional="true"/>
  99.315 +            <sequential>
  99.316 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
  99.317 +                    <jvmarg line="${debug-args-line}"/>
  99.318 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  99.319 +                    <jvmarg line="${run.jvmargs}"/>
  99.320 +                    <classpath>
  99.321 +                        <path path="@{classpath}"/>
  99.322 +                    </classpath>
  99.323 +                    <syspropertyset>
  99.324 +                        <propertyref prefix="run-sys-prop."/>
  99.325 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  99.326 +                    </syspropertyset>
  99.327 +                    <customize/>
  99.328 +                </java>
  99.329 +            </sequential>
  99.330 +        </macrodef>
  99.331 +    </target>
  99.332 +    <target name="-init-macrodef-java">
  99.333 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  99.334 +            <attribute default="${main.class}" name="classname"/>
  99.335 +            <element name="customize" optional="true"/>
  99.336 +            <sequential>
  99.337 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
  99.338 +                    <jvmarg line="${run.jvmargs}"/>
  99.339 +                    <classpath>
  99.340 +                        <path path="${run.classpath}"/>
  99.341 +                    </classpath>
  99.342 +                    <syspropertyset>
  99.343 +                        <propertyref prefix="run-sys-prop."/>
  99.344 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  99.345 +                    </syspropertyset>
  99.346 +                    <customize/>
  99.347 +                </java>
  99.348 +            </sequential>
  99.349 +        </macrodef>
  99.350 +    </target>
  99.351 +    <target name="-init-presetdef-jar">
  99.352 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  99.353 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  99.354 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  99.355 +            </jar>
  99.356 +        </presetdef>
  99.357 +    </target>
  99.358 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
  99.359 +    <!--
  99.360 +                ===================
  99.361 +                COMPILATION SECTION
  99.362 +                ===================
  99.363 +            -->
  99.364 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  99.365 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  99.366 +    <target depends="init" name="-check-automatic-build">
  99.367 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  99.368 +    </target>
  99.369 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  99.370 +        <antcall target="clean"/>
  99.371 +    </target>
  99.372 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  99.373 +        <mkdir dir="${build.classes.dir}"/>
  99.374 +    </target>
  99.375 +    <target name="-pre-compile">
  99.376 +        <!-- Empty placeholder for easier customization. -->
  99.377 +        <!-- You can override this target in the ../build.xml file. -->
  99.378 +    </target>
  99.379 +    <target if="do.depend.true" name="-compile-depend">
  99.380 +        <j2seproject3:depend/>
  99.381 +    </target>
  99.382 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  99.383 +        <j2seproject3:javac/>
  99.384 +        <copy todir="${build.classes.dir}">
  99.385 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  99.386 +        </copy>
  99.387 +    </target>
  99.388 +    <target name="-post-compile">
  99.389 +        <!-- Empty placeholder for easier customization. -->
  99.390 +        <!-- You can override this target in the ../build.xml file. -->
  99.391 +    </target>
  99.392 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  99.393 +    <target name="-pre-compile-single">
  99.394 +        <!-- Empty placeholder for easier customization. -->
  99.395 +        <!-- You can override this target in the ../build.xml file. -->
  99.396 +    </target>
  99.397 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  99.398 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  99.399 +        <j2seproject3:force-recompile/>
  99.400 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  99.401 +    </target>
  99.402 +    <target name="-post-compile-single">
  99.403 +        <!-- Empty placeholder for easier customization. -->
  99.404 +        <!-- You can override this target in the ../build.xml file. -->
  99.405 +    </target>
  99.406 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  99.407 +    <!--
  99.408 +                ====================
  99.409 +                JAR BUILDING SECTION
  99.410 +                ====================
  99.411 +            -->
  99.412 +    <target depends="init" name="-pre-pre-jar">
  99.413 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  99.414 +        <mkdir dir="${dist.jar.dir}"/>
  99.415 +    </target>
  99.416 +    <target name="-pre-jar">
  99.417 +        <!-- Empty placeholder for easier customization. -->
  99.418 +        <!-- You can override this target in the ../build.xml file. -->
  99.419 +    </target>
  99.420 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  99.421 +        <j2seproject1:jar/>
  99.422 +    </target>
  99.423 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  99.424 +        <j2seproject1:jar manifest="${manifest.file}"/>
  99.425 +    </target>
  99.426 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
  99.427 +        <j2seproject1:jar manifest="${manifest.file}">
  99.428 +            <j2seproject1:manifest>
  99.429 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  99.430 +            </j2seproject1:manifest>
  99.431 +        </j2seproject1:jar>
  99.432 +        <echo>To run this application from the command line without Ant, try:</echo>
  99.433 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  99.434 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  99.435 +        <pathconvert property="run.classpath.with.dist.jar">
  99.436 +            <path path="${run.classpath}"/>
  99.437 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  99.438 +        </pathconvert>
  99.439 +        <echo>${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  99.440 +    </target>
  99.441 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  99.442 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  99.443 +        <pathconvert property="run.classpath.without.build.classes.dir">
  99.444 +            <path path="${run.classpath}"/>
  99.445 +            <map from="${build.classes.dir.resolved}" to=""/>
  99.446 +        </pathconvert>
  99.447 +        <pathconvert pathsep=" " property="jar.classpath">
  99.448 +            <path path="${run.classpath.without.build.classes.dir}"/>
  99.449 +            <chainedmapper>
  99.450 +                <flattenmapper/>
  99.451 +                <globmapper from="*" to="lib/*"/>
  99.452 +            </chainedmapper>
  99.453 +        </pathconvert>
  99.454 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  99.455 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  99.456 +            <fileset dir="${build.classes.dir}"/>
  99.457 +            <manifest>
  99.458 +                <attribute name="Main-Class" value="${main.class}"/>
  99.459 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  99.460 +            </manifest>
  99.461 +        </copylibs>
  99.462 +        <echo>To run this application from the command line without Ant, try:</echo>
  99.463 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  99.464 +        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
  99.465 +    </target>
  99.466 +    <target name="-post-jar">
  99.467 +        <!-- Empty placeholder for easier customization. -->
  99.468 +        <!-- You can override this target in the ../build.xml file. -->
  99.469 +    </target>
  99.470 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
  99.471 +    <!--
  99.472 +                =================
  99.473 +                EXECUTION SECTION
  99.474 +                =================
  99.475 +            -->
  99.476 +    <target depends="init,compile" description="Run a main class." name="run">
  99.477 +        <j2seproject1:java>
  99.478 +            <customize>
  99.479 +                <arg line="${application.args}"/>
  99.480 +            </customize>
  99.481 +        </j2seproject1:java>
  99.482 +    </target>
  99.483 +    <target name="-do-not-recompile">
  99.484 +        <property name="javac.includes.binary" value=""/>
  99.485 +    </target>
  99.486 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  99.487 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  99.488 +        <j2seproject1:java classname="${run.class}"/>
  99.489 +    </target>
  99.490 +    <!--
  99.491 +                =================
  99.492 +                DEBUGGING SECTION
  99.493 +                =================
  99.494 +            -->
  99.495 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  99.496 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  99.497 +    </target>
  99.498 +    <target depends="init,compile" name="-debug-start-debuggee">
  99.499 +        <j2seproject3:debug>
  99.500 +            <customize>
  99.501 +                <arg line="${application.args}"/>
  99.502 +            </customize>
  99.503 +        </j2seproject3:debug>
  99.504 +    </target>
  99.505 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  99.506 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  99.507 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  99.508 +    </target>
  99.509 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  99.510 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  99.511 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  99.512 +        <j2seproject3:debug classname="${debug.class}"/>
  99.513 +    </target>
  99.514 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  99.515 +    <target depends="init" name="-pre-debug-fix">
  99.516 +        <fail unless="fix.includes">Must set fix.includes</fail>
  99.517 +        <property name="javac.includes" value="${fix.includes}.java"/>
  99.518 +    </target>
  99.519 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  99.520 +        <j2seproject1:nbjpdareload/>
  99.521 +    </target>
  99.522 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  99.523 +    <!--
  99.524 +                ===============
  99.525 +                JAVADOC SECTION
  99.526 +                ===============
  99.527 +            -->
  99.528 +    <target depends="init" name="-javadoc-build">
  99.529 +        <mkdir dir="${dist.javadoc.dir}"/>
  99.530 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
  99.531 +            <classpath>
  99.532 +                <path path="${javac.classpath}"/>
  99.533 +            </classpath>
  99.534 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  99.535 +                <filename name="**/*.java"/>
  99.536 +            </fileset>
  99.537 +        </javadoc>
  99.538 +    </target>
  99.539 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  99.540 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  99.541 +    </target>
  99.542 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  99.543 +    <!--
  99.544 +                =========================
  99.545 +                JUNIT COMPILATION SECTION
  99.546 +                =========================
  99.547 +            -->
  99.548 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  99.549 +        <mkdir dir="${build.test.classes.dir}"/>
  99.550 +    </target>
  99.551 +    <target name="-pre-compile-test">
  99.552 +        <!-- Empty placeholder for easier customization. -->
  99.553 +        <!-- You can override this target in the ../build.xml file. -->
  99.554 +    </target>
  99.555 +    <target if="do.depend.true" name="-compile-test-depend">
  99.556 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  99.557 +    </target>
  99.558 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  99.559 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  99.560 +        <copy todir="${build.test.classes.dir}">
  99.561 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  99.562 +        </copy>
  99.563 +    </target>
  99.564 +    <target name="-post-compile-test">
  99.565 +        <!-- Empty placeholder for easier customization. -->
  99.566 +        <!-- You can override this target in the ../build.xml file. -->
  99.567 +    </target>
  99.568 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  99.569 +    <target name="-pre-compile-test-single">
  99.570 +        <!-- Empty placeholder for easier customization. -->
  99.571 +        <!-- You can override this target in the ../build.xml file. -->
  99.572 +    </target>
  99.573 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  99.574 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  99.575 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  99.576 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
  99.577 +        <copy todir="${build.test.classes.dir}">
  99.578 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  99.579 +        </copy>
  99.580 +    </target>
  99.581 +    <target name="-post-compile-test-single">
  99.582 +        <!-- Empty placeholder for easier customization. -->
  99.583 +        <!-- You can override this target in the ../build.xml file. -->
  99.584 +    </target>
  99.585 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  99.586 +    <!--
  99.587 +                =======================
  99.588 +                JUNIT EXECUTION SECTION
  99.589 +                =======================
  99.590 +            -->
  99.591 +    <target depends="init" if="have.tests" name="-pre-test-run">
  99.592 +        <mkdir dir="${build.test.results.dir}"/>
  99.593 +    </target>
  99.594 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  99.595 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  99.596 +    </target>
  99.597 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  99.598 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  99.599 +    </target>
  99.600 +    <target depends="init" if="have.tests" name="test-report"/>
  99.601 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  99.602 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  99.603 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  99.604 +        <mkdir dir="${build.test.results.dir}"/>
  99.605 +    </target>
  99.606 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  99.607 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  99.608 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  99.609 +    </target>
  99.610 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  99.611 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  99.612 +    </target>
  99.613 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
  99.614 +    <!--
  99.615 +                =======================
  99.616 +                JUNIT DEBUGGING SECTION
  99.617 +                =======================
  99.618 +            -->
  99.619 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  99.620 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  99.621 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  99.622 +        <delete file="${test.report.file}"/>
  99.623 +        <mkdir dir="${build.test.results.dir}"/>
  99.624 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
  99.625 +            <customize>
  99.626 +                <syspropertyset>
  99.627 +                    <propertyref prefix="test-sys-prop."/>
  99.628 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  99.629 +                </syspropertyset>
  99.630 +                <arg value="${test.class}"/>
  99.631 +                <arg value="showoutput=true"/>
  99.632 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  99.633 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  99.634 +            </customize>
  99.635 +        </j2seproject3:debug>
  99.636 +    </target>
  99.637 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  99.638 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  99.639 +    </target>
  99.640 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  99.641 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  99.642 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  99.643 +    </target>
  99.644 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  99.645 +    <!--
  99.646 +                =========================
  99.647 +                APPLET EXECUTION SECTION
  99.648 +                =========================
  99.649 +            -->
  99.650 +    <target depends="init,compile-single" name="run-applet">
  99.651 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  99.652 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  99.653 +            <customize>
  99.654 +                <arg value="${applet.url}"/>
  99.655 +            </customize>
  99.656 +        </j2seproject1:java>
  99.657 +    </target>
  99.658 +    <!--
  99.659 +                =========================
  99.660 +                APPLET DEBUGGING  SECTION
  99.661 +                =========================
  99.662 +            -->
  99.663 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  99.664 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  99.665 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  99.666 +            <customize>
  99.667 +                <arg value="${applet.url}"/>
  99.668 +            </customize>
  99.669 +        </j2seproject3:debug>
  99.670 +    </target>
  99.671 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  99.672 +    <!--
  99.673 +                ===============
  99.674 +                CLEANUP SECTION
  99.675 +                ===============
  99.676 +            -->
  99.677 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  99.678 +    <target depends="init" name="-do-clean">
  99.679 +        <delete dir="${build.dir}"/>
  99.680 +        <delete dir="${dist.dir}"/>
  99.681 +    </target>
  99.682 +    <target name="-post-clean">
  99.683 +        <!-- Empty placeholder for easier customization. -->
  99.684 +        <!-- You can override this target in the ../build.xml file. -->
  99.685 +    </target>
  99.686 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  99.687 +</project>
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/task1/solution09/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
   100.3 @@ -0,0 +1,8 @@
   100.4 +build.xml.data.CRC32=2ab820eb
   100.5 +build.xml.script.CRC32=58a52595
   100.6 +build.xml.stylesheet.CRC32=be360661
   100.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   100.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   100.9 +nbproject/build-impl.xml.data.CRC32=e8d85d23
  100.10 +nbproject/build-impl.xml.script.CRC32=f0008fa7
  100.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/task1/solution09/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
   101.3 @@ -0,0 +1,68 @@
   101.4 +application.title=currency
   101.5 +application.vendor=apidesign.org
   101.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
   101.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
   101.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
   101.9 +build.classes.dir=${build.dir}/classes
  101.10 +build.classes.excludes=**/*.java,**/*.form
  101.11 +# This directory is removed when the project is cleaned:
  101.12 +build.dir=build
  101.13 +build.generated.dir=${build.dir}/generated
  101.14 +# Only compile against the classpath explicitly listed here:
  101.15 +build.sysclasspath=ignore
  101.16 +build.test.classes.dir=${build.dir}/test/classes
  101.17 +build.test.results.dir=${build.dir}/test/results
  101.18 +debug.classpath=\
  101.19 +    ${run.classpath}
  101.20 +debug.test.classpath=\
  101.21 +    ${run.test.classpath}
  101.22 +# This directory is removed when the project is cleaned:
  101.23 +dist.dir=dist
  101.24 +dist.jar=${dist.dir}/currency.jar
  101.25 +dist.javadoc.dir=${dist.dir}/javadoc
  101.26 +excludes=
  101.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
  101.28 +file.reference.src-apifest08=..
  101.29 +includes=**
  101.30 +jar.compress=false
  101.31 +javac.classpath=
  101.32 +# Space-separated list of extra javac options
  101.33 +javac.compilerargs=
  101.34 +javac.deprecation=false
  101.35 +javac.source=1.5
  101.36 +javac.target=1.5
  101.37 +javac.test.classpath=\
  101.38 +    ${javac.classpath}:\
  101.39 +    ${build.classes.dir}:\
  101.40 +    ${file.reference.junit-4.4.jar}
  101.41 +javadoc.additionalparam=
  101.42 +javadoc.author=false
  101.43 +javadoc.encoding=
  101.44 +javadoc.noindex=false
  101.45 +javadoc.nonavbar=false
  101.46 +javadoc.notree=false
  101.47 +javadoc.private=false
  101.48 +javadoc.splitindex=true
  101.49 +javadoc.use=true
  101.50 +javadoc.version=false
  101.51 +javadoc.windowtitle=
  101.52 +jnlp.codebase.type=local
  101.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
  101.54 +jnlp.descriptor=application
  101.55 +jnlp.enabled=false
  101.56 +jnlp.offline-allowed=false
  101.57 +jnlp.signed=false
  101.58 +meta.inf.dir=${src.dir}/META-INF
  101.59 +platform.active=JDK_1.6
  101.60 +run.classpath=\
  101.61 +    ${javac.classpath}:\
  101.62 +    ${build.classes.dir}
  101.63 +# Space-separated list of JVM arguments used when running the project
  101.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  101.65 +# or test-sys-prop.name=value to set system properties for unit tests):
  101.66 +run.jvmargs=
  101.67 +run.test.classpath=\
  101.68 +    ${javac.test.classpath}:\
  101.69 +    ${build.test.classes.dir}
  101.70 +src.dir=src
  101.71 +test.src.dir=test
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/task1/solution09/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
   102.3 @@ -0,0 +1,17 @@
   102.4 +<?xml version="1.0" encoding="UTF-8"?>
   102.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   102.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   102.7 +    <configuration>
   102.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   102.9 +            <name>Currency Convertor Solution 09</name>
  102.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  102.11 +            <explicit-platform explicit-source-supported="true"/>
  102.12 +            <source-roots>
  102.13 +                <root id="src.dir"/>
  102.14 +            </source-roots>
  102.15 +            <test-roots>
  102.16 +                <root id="test.src.dir"/>
  102.17 +            </test-roots>
  102.18 +        </data>
  102.19 +    </configuration>
  102.20 +</project>
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/task1/solution09/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
   103.3 @@ -0,0 +1,26 @@
   103.4 +package org.apidesign.apifest08.currency;
   103.5 +
   103.6 +/** This is the skeleton class for your API. You need to make it public, so
   103.7 + * it is accessible to your client code (currently in Task1Test.java) file.
   103.8 + * <p>
   103.9 + * Feel free to create additional classes or rename this one, just keep all
  103.10 + * the API and its implementation in this package. Do not spread it outside
  103.11 + * to other packages.
  103.12 + */
  103.13 +public interface Convertor {
  103.14 +
  103.15 +    /**
  103.16 +     * converts amount in first currency to amount second currency.
  103.17 +     * @param amountInCents the amount of first currency in cents (or equivalent)
  103.18 +     * @return the amount in the second currency in cents (or equivalent)
  103.19 +     */
  103.20 +    public long convertTo(long amountInCents);
  103.21 +
  103.22 +
  103.23 +    /**
  103.24 +     * converts from second currency amount to first currency amount.
  103.25 +     * @param amountInCents the amount of second currency in cents (or equivalent)
  103.26 +     * @return the amount in the first currency in cents (or equivalent)
  103.27 +     */
  103.28 +    public long convertFrom(long amountInCents);
  103.29 +}
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/task1/solution09/src/org/apidesign/apifest08/currency/ConvertorFactory.java	Sun Sep 28 14:12:38 2008 +0200
   104.3 @@ -0,0 +1,38 @@
   104.4 +package org.apidesign.apifest08.currency;
   104.5 +
   104.6 +import java.math.BigDecimal;
   104.7 +
   104.8 +
   104.9 +public class ConvertorFactory {
  104.10 +
  104.11 +    public static Convertor getConvertor(CurrencyType from, CurrencyType to) {
  104.12 +        if (from == CurrencyType.CZK && to == CurrencyType.USD) {
  104.13 +             return new BasicConvertor(new BigDecimal(17));
  104.14 +        } else if (from == CurrencyType.SKK && to == CurrencyType.CZK) {
  104.15 +            double rate = 0.8d;
  104.16 +            return new BasicConvertor(new BigDecimal(rate));
  104.17 +        }
  104.18 +
  104.19 +
  104.20 +        throw new UnsupportedOperationException("Conversion not supported now");
  104.21 +    }
  104.22 +
  104.23 +    private static class BasicConvertor implements Convertor {
  104.24 +
  104.25 +        private final BigDecimal conversionRate;
  104.26 +
  104.27 +        BasicConvertor(BigDecimal conversionRate) {
  104.28 +            this.conversionRate = conversionRate;
  104.29 +        }
  104.30 +
  104.31 +        @Override
  104.32 +        public long convertTo(long amount) {
  104.33 +            return (long) (conversionRate.doubleValue() * amount);
  104.34 +        }
  104.35 +
  104.36 +        @Override
  104.37 +        public long convertFrom(long amount) {
  104.38 +            return (long) (amount / conversionRate.doubleValue());
  104.39 +        }
  104.40 +    }
  104.41 +}
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/task1/solution09/src/org/apidesign/apifest08/currency/CurrencyType.java	Sun Sep 28 14:12:38 2008 +0200
   105.3 @@ -0,0 +1,7 @@
   105.4 +package org.apidesign.apifest08.currency;
   105.5 +
   105.6 +public enum CurrencyType {
   105.7 +
   105.8 +    CZK, SKK, USD;
   105.9 +    
  105.10 +}
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/task1/solution09/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
   106.3 @@ -0,0 +1,77 @@
   106.4 +package org.apidesign.apifest08.test;
   106.5 +
   106.6 +import junit.framework.TestCase;
   106.7 +import org.apidesign.apifest08.currency.Convertor;
   106.8 +import org.apidesign.apifest08.currency.ConvertorFactory;
   106.9 +import org.apidesign.apifest08.currency.CurrencyType;
  106.10 +
  106.11 +/** Finish the Convertor API, and then write bodies of methods inside
  106.12 + * of this class to match the given tasks. To fullfil your task, use the
  106.13 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
  106.14 + * Do not you reflection, or other hacks as your code
  106.15 + * shall run without any runtime permissions.
  106.16 + */
  106.17 +public class Task1Test extends TestCase {
  106.18 +    public Task1Test(String testName) {
  106.19 +        super(testName);
  106.20 +    }
  106.21 +
  106.22 +
  106.23 +    /** Create convertor that understands two currencies, CZK and
  106.24 +     *  USD. Make 1 USD == 17 CZK.
  106.25 +     *
  106.26 +     * Creation of the convertor shall not require subclassing of any class
  106.27 +     * or interface on the client side.
  106.28 +     *
  106.29 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
  106.30 +     */
  106.31 +    public static Convertor createCZKtoUSD() {
  106.32 +        return ConvertorFactory.getConvertor(CurrencyType.CZK, CurrencyType.USD);
  106.33 +    }
  106.34 +
  106.35 +    /** Create convertor that understands two currencies, CZK and
  106.36 +     *  SKK. Make 100 SKK == 80 CZK.
  106.37 +     *
  106.38 +     * Creation of the convertor shall not require subclassing of any class
  106.39 +     * or interface on the client side.
  106.40 +     * 
  106.41 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
  106.42 +     */
  106.43 +    public static Convertor createSKKtoCZK() {
  106.44 +        return ConvertorFactory.getConvertor(CurrencyType.SKK, CurrencyType.CZK);
  106.45 +    }
  106.46 +    
  106.47 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
  106.48 +     * with it.
  106.49 +     */
  106.50 +    public void testCurrencyCZKUSD() throws Exception {
  106.51 +        Convertor c = createCZKtoUSD();
  106.52 +
  106.53 +        // convert $5 to CZK using c:
  106.54 +        // assertEquals("Result is 85 CZK");
  106.55 +        assertEquals(85, c.convertTo(5));
  106.56 +
  106.57 +        // convert $8 to CZK
  106.58 +        // assertEquals("Result is 136 CZK");
  106.59 +        assertEquals(136, c.convertTo(8));
  106.60 +
  106.61 +        // convert 1003CZK to USD
  106.62 +        // assertEquals("Result is 59 USD");
  106.63 +        assertEquals(59, c.convertFrom(1003));
  106.64 +    }
  106.65 +
  106.66 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
  106.67 +     * with it.
  106.68 +     */
  106.69 +    public void testCurrencySKKCZK() throws Exception {
  106.70 +        Convertor c = createSKKtoCZK();
  106.71 +        // convert 16CZK using c:
  106.72 +        // assertEquals("Result is 20 SKK");
  106.73 +        assertEquals(20, c.convertFrom(16));
  106.74 +
  106.75 +        // convert 500SKK to CZK
  106.76 +        // assertEquals("Result is 400 CZK");
  106.77 +        assertEquals(400, c.convertTo(500));
  106.78 +    }
  106.79 +}
  106.80 +
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/task1/solution10/build.xml	Sun Sep 28 14:12:38 2008 +0200
   107.3 @@ -0,0 +1,69 @@
   107.4 +<?xml version="1.0" encoding="UTF-8"?>
   107.5 +<!-- You may freely edit this file. See commented blocks below for -->
   107.6 +<!-- some examples of how to customize the build. -->
   107.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   107.8 +<project name="Currency_Convertor_Solution_10" default="default" basedir=".">
   107.9 +    <description>Builds, tests, and runs the project Currency Convertor Solution 10.</description>
  107.10 +    <import file="nbproject/build-impl.xml"/>
  107.11 +    <!--
  107.12 +
  107.13 +    There exist several targets which are by default empty and which can be 
  107.14 +    used for execution of your tasks. These targets are usually executed 
  107.15 +    before and after some main targets. They are: 
  107.16 +
  107.17 +      -pre-init:                 called before initialization of project properties
  107.18 +      -post-init:                called after initialization of project properties
  107.19 +      -pre-compile:              called before javac compilation
  107.20 +      -post-compile:             called after javac compilation
  107.21 +      -pre-compile-single:       called before javac compilation of single file
  107.22 +      -post-compile-single:      called after javac compilation of single file
  107.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  107.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  107.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  107.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  107.27 +      -pre-jar:                  called before JAR building
  107.28 +      -post-jar:                 called after JAR building
  107.29 +      -post-clean:               called after cleaning build products
  107.30 +
  107.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  107.32 +
  107.33 +    Example of inserting an obfuscator after compilation could look like this:
  107.34 +
  107.35 +        <target name="-post-compile">
  107.36 +            <obfuscate>
  107.37 +                <fileset dir="${build.classes.dir}"/>
  107.38 +            </obfuscate>
  107.39 +        </target>
  107.40 +
  107.41 +    For list of available properties check the imported 
  107.42 +    nbproject/build-impl.xml file. 
  107.43 +
  107.44 +
  107.45 +    Another way to customize the build is by overriding existing main targets.
  107.46 +    The targets of interest are: 
  107.47 +
  107.48 +      -init-macrodef-javac:     defines macro for javac compilation
  107.49 +      -init-macrodef-junit:     defines macro for junit execution
  107.50 +      -init-macrodef-debug:     defines macro for class debugging
  107.51 +      -init-macrodef-java:      defines macro for class execution
  107.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  107.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  107.54 +      run:                      execution of project 
  107.55 +      -javadoc-build:           Javadoc generation
  107.56 +      test-report:              JUnit report generation
  107.57 +
  107.58 +    An example of overriding the target for project execution could look like this:
  107.59 +
  107.60 +        <target name="run" depends="Currency_Convertor_Solution_10-impl.jar">
  107.61 +            <exec dir="bin" executable="launcher.exe">
  107.62 +                <arg file="${dist.jar}"/>
  107.63 +            </exec>
  107.64 +        </target>
  107.65 +
  107.66 +    Notice that the overridden target depends on the jar target and not only on 
  107.67 +    the compile target as the regular run target does. Again, for a list of available 
  107.68 +    properties which you can use, check the target you are overriding in the
  107.69 +    nbproject/build-impl.xml file. 
  107.70 +
  107.71 +    -->
  107.72 +</project>
   108.1 Binary file task1/solution10/nbproject/.DS_Store has changed
   109.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.2 +++ b/task1/solution10/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
   109.3 @@ -0,0 +1,684 @@
   109.4 +<?xml version="1.0" encoding="UTF-8"?>
   109.5 +<!--
   109.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   109.7 +***         EDIT ../build.xml INSTEAD         ***
   109.8 +
   109.9 +For the purpose of easier reading the script
  109.10 +is divided into following sections:
  109.11 +
  109.12 +  - initialization
  109.13 +  - compilation
  109.14 +  - jar
  109.15 +  - execution
  109.16 +  - debugging
  109.17 +  - javadoc
  109.18 +  - junit compilation
  109.19 +  - junit execution
  109.20 +  - junit debugging
  109.21 +  - applet
  109.22 +  - cleanup
  109.23 +
  109.24 +        -->
  109.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_10-impl">
  109.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
  109.27 +    <!-- 
  109.28 +                ======================
  109.29 +                INITIALIZATION SECTION 
  109.30 +                ======================
  109.31 +            -->
  109.32 +    <target name="-pre-init">
  109.33 +        <!-- Empty placeholder for easier customization. -->
  109.34 +        <!-- You can override this target in the ../build.xml file. -->
  109.35 +    </target>
  109.36 +    <target depends="-pre-init" name="-init-private">
  109.37 +        <property file="nbproject/private/config.properties"/>
  109.38 +        <property file="nbproject/private/configs/${config}.properties"/>
  109.39 +        <property file="nbproject/private/private.properties"/>
  109.40 +    </target>
  109.41 +    <target depends="-pre-init,-init-private" name="-init-user">
  109.42 +        <property file="${user.properties.file}"/>
  109.43 +        <!-- The two properties below are usually overridden -->
  109.44 +        <!-- by the active platform. Just a fallback. -->
  109.45 +        <property name="default.javac.source" value="1.4"/>
  109.46 +        <property name="default.javac.target" value="1.4"/>
  109.47 +    </target>
  109.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
  109.49 +        <property file="nbproject/configs/${config}.properties"/>
  109.50 +        <property file="nbproject/project.properties"/>
  109.51 +    </target>
  109.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
  109.53 +        <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
  109.54 +        <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
  109.55 +        <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
  109.56 +        <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
  109.57 +        <condition property="platform.javac" value="${platform.home}/bin/javac">
  109.58 +            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
  109.59 +        </condition>
  109.60 +        <property name="platform.javac" value="${platform.javac.tmp}"/>
  109.61 +        <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
  109.62 +        <condition property="platform.java" value="${platform.home}/bin/java">
  109.63 +            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
  109.64 +        </condition>
  109.65 +        <property name="platform.java" value="${platform.java.tmp}"/>
  109.66 +        <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
  109.67 +        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
  109.68 +            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
  109.69 +        </condition>
  109.70 +        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
  109.71 +        <condition property="platform.invalid" value="true">
  109.72 +            <or>
  109.73 +                <contains string="${platform.javac}" substring="$${platforms."/>
  109.74 +                <contains string="${platform.java}" substring="$${platforms."/>
  109.75 +                <contains string="${platform.javadoc}" substring="$${platforms."/>
  109.76 +            </or>
  109.77 +        </condition>
  109.78 +        <fail unless="platform.home">Must set platform.home</fail>
  109.79 +        <fail unless="platform.bootcp">Must set platform.bootcp</fail>
  109.80 +        <fail unless="platform.java">Must set platform.java</fail>
  109.81 +        <fail unless="platform.javac">Must set platform.javac</fail>
  109.82 +        <fail if="platform.invalid">
  109.83 + The J2SE Platform is not correctly set up.
  109.84 + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 
  109.85 + Either open the project in the IDE and setup the Platform with the same name or add it manually.
  109.86 + For example like this:
  109.87 +     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
  109.88 +  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) 
  109.89 +  </fail>
  109.90 +        <available file="${manifest.file}" property="manifest.available"/>
  109.91 +        <condition property="manifest.available+main.class">
  109.92 +            <and>
  109.93 +                <isset property="manifest.available"/>
  109.94 +                <isset property="main.class"/>
  109.95 +                <not>
  109.96 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  109.97 +                </not>
  109.98 +            </and>
  109.99 +        </condition>
 109.100 +        <condition property="manifest.available+main.class+mkdist.available">
 109.101 +            <and>
 109.102 +                <istrue value="${manifest.available+main.class}"/>
 109.103 +                <isset property="libs.CopyLibs.classpath"/>
 109.104 +            </and>
 109.105 +        </condition>
 109.106 +        <condition property="have.tests">
 109.107 +            <or>
 109.108 +                <available file="${test.src.dir}"/>
 109.109 +            </or>
 109.110 +        </condition>
 109.111 +        <condition property="have.sources">
 109.112 +            <or>
 109.113 +                <available file="${src.dir}"/>
 109.114 +            </or>
 109.115 +        </condition>
 109.116 +        <condition property="netbeans.home+have.tests">
 109.117 +            <and>
 109.118 +                <isset property="netbeans.home"/>
 109.119 +                <isset property="have.tests"/>
 109.120 +            </and>
 109.121 +        </condition>
 109.122 +        <condition property="no.javadoc.preview">
 109.123 +            <and>
 109.124 +                <isset property="javadoc.preview"/>
 109.125 +                <isfalse value="${javadoc.preview}"/>
 109.126 +            </and>
 109.127 +        </condition>
 109.128 +        <property name="run.jvmargs" value=""/>
 109.129 +        <property name="javac.compilerargs" value=""/>
 109.130 +        <property name="work.dir" value="${basedir}"/>
 109.131 +        <condition property="no.deps">
 109.132 +            <and>
 109.133 +                <istrue value="${no.dependencies}"/>
 109.134 +            </and>
 109.135 +        </condition>
 109.136 +        <property name="javac.debug" value="true"/>
 109.137 +        <property name="javadoc.preview" value="true"/>
 109.138 +        <property name="application.args" value=""/>
 109.139 +        <property name="source.encoding" value="${file.encoding}"/>
 109.140 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 109.141 +            <and>
 109.142 +                <isset property="javadoc.encoding"/>
 109.143 +                <not>
 109.144 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
 109.145 +                </not>
 109.146 +            </and>
 109.147 +        </condition>
 109.148 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 109.149 +        <property name="includes" value="**"/>
 109.150 +        <property name="excludes" value=""/>
 109.151 +        <property name="do.depend" value="false"/>
 109.152 +        <condition property="do.depend.true">
 109.153 +            <istrue value="${do.depend}"/>
 109.154 +        </condition>
 109.155 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
 109.156 +            <and>
 109.157 +                <isset property="jaxws.endorsed.dir"/>
 109.158 +                <available file="nbproject/jaxws-build.xml"/>
 109.159 +            </and>
 109.160 +        </condition>
 109.161 +    </target>
 109.162 +    <target name="-post-init">
 109.163 +        <!-- Empty placeholder for easier customization. -->
 109.164 +        <!-- You can override this target in the ../build.xml file. -->
 109.165 +    </target>
 109.166 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
 109.167 +        <fail unless="src.dir">Must set src.dir</fail>
 109.168 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 109.169 +        <fail unless="build.dir">Must set build.dir</fail>
 109.170 +        <fail unless="dist.dir">Must set dist.dir</fail>
 109.171 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 109.172 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 109.173 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 109.174 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 109.175 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 109.176 +        <fail unless="dist.jar">Must set dist.jar</fail>
 109.177 +    </target>
 109.178 +    <target name="-init-macrodef-property">
 109.179 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 109.180 +            <attribute name="name"/>
 109.181 +            <attribute name="value"/>
 109.182 +            <sequential>
 109.183 +                <property name="@{name}" value="${@{value}}"/>
 109.184 +            </sequential>
 109.185 +        </macrodef>
 109.186 +    </target>
 109.187 +    <target name="-init-macrodef-javac">
 109.188 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 109.189 +            <attribute default="${src.dir}" name="srcdir"/>
 109.190 +            <attribute default="${build.classes.dir}" name="destdir"/>
 109.191 +            <attribute default="${javac.classpath}" name="classpath"/>
 109.192 +            <attribute default="${includes}" name="includes"/>
 109.193 +            <attribute default="${excludes}" name="excludes"/>
 109.194 +            <attribute default="${javac.debug}" name="debug"/>
 109.195 +            <attribute default="" name="sourcepath"/>
 109.196 +            <element name="customize" optional="true"/>
 109.197 +            <sequential>
 109.198 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
 109.199 +                    <classpath>
 109.200 +                        <path path="@{classpath}"/>
 109.201 +                    </classpath>
 109.202 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
 109.203 +                    <customize/>
 109.204 +                </javac>
 109.205 +            </sequential>
 109.206 +        </macrodef>
 109.207 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 109.208 +            <attribute default="${src.dir}" name="srcdir"/>
 109.209 +            <attribute default="${build.classes.dir}" name="destdir"/>
 109.210 +            <attribute default="${javac.classpath}" name="classpath"/>
 109.211 +            <sequential>
 109.212 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 109.213 +                    <classpath>
 109.214 +                        <path path="@{classpath}"/>
 109.215 +                    </classpath>
 109.216 +                </depend>
 109.217 +            </sequential>
 109.218 +        </macrodef>
 109.219 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 109.220 +            <attribute default="${build.classes.dir}" name="destdir"/>
 109.221 +            <sequential>
 109.222 +                <fail unless="javac.includes">Must set javac.includes</fail>
 109.223 +                <pathconvert pathsep="," property="javac.includes.binary">
 109.224 +                    <path>
 109.225 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 109.226 +                    </path>
 109.227 +                    <globmapper from="*.java" to="*.class"/>
 109.228 +                </pathconvert>
 109.229 +                <delete>
 109.230 +                    <files includes="${javac.includes.binary}"/>
 109.231 +                </delete>
 109.232 +            </sequential>
 109.233 +        </macrodef>
 109.234 +    </target>
 109.235 +    <target name="-init-macrodef-junit">
 109.236 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 109.237 +            <attribute default="${includes}" name="includes"/>
 109.238 +            <attribute default="${excludes}" name="excludes"/>
 109.239 +            <attribute default="**" name="testincludes"/>
 109.240 +            <sequential>
 109.241 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true">
 109.242 +                    <batchtest todir="${build.test.results.dir}">
 109.243 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 109.244 +                            <filename name="@{testincludes}"/>
 109.245 +                        </fileset>
 109.246 +                    </batchtest>
 109.247 +                    <classpath>
 109.248 +                        <path path="${run.test.classpath}"/>
 109.249 +                    </classpath>
 109.250 +                    <syspropertyset>
 109.251 +                        <propertyref prefix="test-sys-prop."/>
 109.252 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 109.253 +                    </syspropertyset>
 109.254 +                    <formatter type="brief" usefile="false"/>
 109.255 +                    <formatter type="xml"/>
 109.256 +                    <jvmarg line="${run.jvmargs}"/>
 109.257 +                </junit>
 109.258 +            </sequential>
 109.259 +        </macrodef>
 109.260 +    </target>
 109.261 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
 109.262 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 109.263 +            <attribute default="${main.class}" name="name"/>
 109.264 +            <attribute default="${debug.classpath}" name="classpath"/>
 109.265 +            <attribute default="" name="stopclassname"/>
 109.266 +            <sequential>
 109.267 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
 109.268 +                    <classpath>
 109.269 +                        <path path="@{classpath}"/>
 109.270 +                    </classpath>
 109.271 +                    <bootclasspath>
 109.272 +                        <path path="${platform.bootcp}"/>
 109.273 +                    </bootclasspath>
 109.274 +                </nbjpdastart>
 109.275 +            </sequential>
 109.276 +        </macrodef>
 109.277 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 109.278 +            <attribute default="${build.classes.dir}" name="dir"/>
 109.279 +            <sequential>
 109.280 +                <nbjpdareload>
 109.281 +                    <fileset dir="@{dir}" includes="${fix.classes}">
 109.282 +                        <include name="${fix.includes}*.class"/>
 109.283 +                    </fileset>
 109.284 +                </nbjpdareload>
 109.285 +            </sequential>
 109.286 +        </macrodef>
 109.287 +    </target>
 109.288 +    <target name="-init-debug-args">
 109.289 +        <exec executable="${platform.java}" outputproperty="version-output">
 109.290 +            <arg value="-version"/>
 109.291 +        </exec>
 109.292 +        <condition property="have-jdk-older-than-1.4">
 109.293 +            <or>
 109.294 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
 109.295 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
 109.296 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
 109.297 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
 109.298 +            </or>
 109.299 +        </condition>
 109.300 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
 109.301 +            <istrue value="${have-jdk-older-than-1.4}"/>
 109.302 +        </condition>
 109.303 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
 109.304 +            <os family="windows"/>
 109.305 +        </condition>
 109.306 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
 109.307 +            <isset property="debug.transport"/>
 109.308 +        </condition>
 109.309 +    </target>
 109.310 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
 109.311 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 109.312 +            <attribute default="${main.class}" name="classname"/>
 109.313 +            <attribute default="${debug.classpath}" name="classpath"/>
 109.314 +            <element name="customize" optional="true"/>
 109.315 +            <sequential>
 109.316 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
 109.317 +                    <jvmarg line="${debug-args-line}"/>
 109.318 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
 109.319 +                    <jvmarg line="${run.jvmargs}"/>
 109.320 +                    <classpath>
 109.321 +                        <path path="@{classpath}"/>
 109.322 +                    </classpath>
 109.323 +                    <syspropertyset>
 109.324 +                        <propertyref prefix="run-sys-prop."/>
 109.325 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 109.326 +                    </syspropertyset>
 109.327 +                    <customize/>
 109.328 +                </java>
 109.329 +            </sequential>
 109.330 +        </macrodef>
 109.331 +    </target>
 109.332 +    <target name="-init-macrodef-java">
 109.333 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 109.334 +            <attribute default="${main.class}" name="classname"/>
 109.335 +            <element name="customize" optional="true"/>
 109.336 +            <sequential>
 109.337 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
 109.338 +                    <jvmarg line="${run.jvmargs}"/>
 109.339 +                    <classpath>
 109.340 +                        <path path="${run.classpath}"/>
 109.341 +                    </classpath>
 109.342 +                    <syspropertyset>
 109.343 +                        <propertyref prefix="run-sys-prop."/>
 109.344 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 109.345 +                    </syspropertyset>
 109.346 +                    <customize/>
 109.347 +                </java>
 109.348 +            </sequential>
 109.349 +        </macrodef>
 109.350 +    </target>
 109.351 +    <target name="-init-presetdef-jar">
 109.352 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 109.353 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
 109.354 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 109.355 +            </jar>
 109.356 +        </presetdef>
 109.357 +    </target>
 109.358 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
 109.359 +    <!--
 109.360 +                ===================
 109.361 +                COMPILATION SECTION
 109.362 +                ===================
 109.363 +            -->
 109.364 +    <target depends="init" name="deps-jar" unless="no.deps"/>
 109.365 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 109.366 +    <target depends="init" name="-check-automatic-build">
 109.367 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 109.368 +    </target>
 109.369 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 109.370 +        <antcall target="clean"/>
 109.371 +    </target>
 109.372 +    <target depends="init,deps-jar" name="-pre-pre-compile">
 109.373 +        <mkdir dir="${build.classes.dir}"/>
 109.374 +    </target>
 109.375 +    <target name="-pre-compile">
 109.376 +        <!-- Empty placeholder for easier customization. -->
 109.377 +        <!-- You can override this target in the ../build.xml file. -->
 109.378 +    </target>
 109.379 +    <target if="do.depend.true" name="-compile-depend">
 109.380 +        <j2seproject3:depend/>
 109.381 +    </target>
 109.382 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
 109.383 +        <j2seproject3:javac/>
 109.384 +        <copy todir="${build.classes.dir}">
 109.385 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 109.386 +        </copy>
 109.387 +    </target>
 109.388 +    <target name="-post-compile">
 109.389 +        <!-- Empty placeholder for easier customization. -->
 109.390 +        <!-- You can override this target in the ../build.xml file. -->
 109.391 +    </target>
 109.392 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
 109.393 +    <target name="-pre-compile-single">
 109.394 +        <!-- Empty placeholder for easier customization. -->
 109.395 +        <!-- You can override this target in the ../build.xml file. -->
 109.396 +    </target>
 109.397 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
 109.398 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 109.399 +        <j2seproject3:force-recompile/>
 109.400 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
 109.401 +    </target>
 109.402 +    <target name="-post-compile-single">
 109.403 +        <!-- Empty placeholder for easier customization. -->
 109.404 +        <!-- You can override this target in the ../build.xml file. -->
 109.405 +    </target>
 109.406 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
 109.407 +    <!--
 109.408 +                ====================
 109.409 +                JAR BUILDING SECTION
 109.410 +                ====================
 109.411 +            -->
 109.412 +    <target depends="init" name="-pre-pre-jar">
 109.413 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
 109.414 +        <mkdir dir="${dist.jar.dir}"/>
 109.415 +    </target>
 109.416 +    <target name="-pre-jar">
 109.417 +        <!-- Empty placeholder for easier customization. -->
 109.418 +        <!-- You can override this target in the ../build.xml file. -->
 109.419 +    </target>
 109.420 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
 109.421 +        <j2seproject1:jar/>
 109.422 +    </target>
 109.423 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
 109.424 +        <j2seproject1:jar manifest="${manifest.file}"/>
 109.425 +    </target>
 109.426 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
 109.427 +        <j2seproject1:jar manifest="${manifest.file}">
 109.428 +            <j2seproject1:manifest>
 109.429 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 109.430 +            </j2seproject1:manifest>
 109.431 +        </j2seproject1:jar>
 109.432 +        <echo>To run this application from the command line without Ant, try:</echo>
 109.433 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 109.434 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 109.435 +        <pathconvert property="run.classpath.with.dist.jar">
 109.436 +            <path path="${run.classpath}"/>
 109.437 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 109.438 +        </pathconvert>
 109.439 +        <echo>${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 109.440 +    </target>
 109.441 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
 109.442 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 109.443 +        <pathconvert property="run.classpath.without.build.classes.dir">
 109.444 +            <path path="${run.classpath}"/>
 109.445 +            <map from="${build.classes.dir.resolved}" to=""/>
 109.446 +        </pathconvert>
 109.447 +        <pathconvert pathsep=" " property="jar.classpath">
 109.448 +            <path path="${run.classpath.without.build.classes.dir}"/>
 109.449 +            <chainedmapper>
 109.450 +                <flattenmapper/>
 109.451 +                <globmapper from="*" to="lib/*"/>
 109.452 +            </chainedmapper>
 109.453 +        </pathconvert>
 109.454 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 109.455 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 109.456 +            <fileset dir="${build.classes.dir}"/>
 109.457 +            <manifest>
 109.458 +                <attribute name="Main-Class" value="${main.class}"/>
 109.459 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 109.460 +            </manifest>
 109.461 +        </copylibs>
 109.462 +        <echo>To run this application from the command line without Ant, try:</echo>
 109.463 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 109.464 +        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
 109.465 +    </target>
 109.466 +    <target name="-post-jar">
 109.467 +        <!-- Empty placeholder for easier customization. -->
 109.468 +        <!-- You can override this target in the ../build.xml file. -->
 109.469 +    </target>
 109.470 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
 109.471 +    <!--
 109.472 +                =================
 109.473 +                EXECUTION SECTION
 109.474 +                =================
 109.475 +            -->
 109.476 +    <target depends="init,compile" description="Run a main class." name="run">
 109.477 +        <j2seproject1:java>
 109.478 +            <customize>
 109.479 +                <arg line="${application.args}"/>
 109.480 +            </customize>
 109.481 +        </j2seproject1:java>
 109.482 +    </target>
 109.483 +    <target name="-do-not-recompile">
 109.484 +        <property name="javac.includes.binary" value=""/>
 109.485 +    </target>
 109.486 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
 109.487 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 109.488 +        <j2seproject1:java classname="${run.class}"/>
 109.489 +    </target>
 109.490 +    <!--
 109.491 +                =================
 109.492 +                DEBUGGING SECTION
 109.493 +                =================
 109.494 +            -->
 109.495 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 109.496 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 109.497 +    </target>
 109.498 +    <target depends="init,compile" name="-debug-start-debuggee">
 109.499 +        <j2seproject3:debug>
 109.500 +            <customize>
 109.501 +                <arg line="${application.args}"/>
 109.502 +            </customize>
 109.503 +        </j2seproject3:debug>
 109.504 +    </target>
 109.505 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 109.506 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 109.507 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 109.508 +    </target>
 109.509 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 109.510 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 109.511 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 109.512 +        <j2seproject3:debug classname="${debug.class}"/>
 109.513 +    </target>
 109.514 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 109.515 +    <target depends="init" name="-pre-debug-fix">
 109.516 +        <fail unless="fix.includes">Must set fix.includes</fail>
 109.517 +        <property name="javac.includes" value="${fix.includes}.java"/>
 109.518 +    </target>
 109.519 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 109.520 +        <j2seproject1:nbjpdareload/>
 109.521 +    </target>
 109.522 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 109.523 +    <!--
 109.524 +                ===============
 109.525 +                JAVADOC SECTION
 109.526 +                ===============
 109.527 +            -->
 109.528 +    <target depends="init" name="-javadoc-build">
 109.529 +        <mkdir dir="${dist.javadoc.dir}"/>
 109.530 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
 109.531 +            <classpath>
 109.532 +                <path path="${javac.classpath}"/>
 109.533 +            </classpath>
 109.534 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 109.535 +                <filename name="**/*.java"/>
 109.536 +            </fileset>
 109.537 +        </javadoc>
 109.538 +    </target>
 109.539 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 109.540 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 109.541 +    </target>
 109.542 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 109.543 +    <!--
 109.544 +                =========================
 109.545 +                JUNIT COMPILATION SECTION
 109.546 +                =========================
 109.547 +            -->
 109.548 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 109.549 +        <mkdir dir="${build.test.classes.dir}"/>
 109.550 +    </target>
 109.551 +    <target name="-pre-compile-test">
 109.552 +        <!-- Empty placeholder for easier customization. -->
 109.553 +        <!-- You can override this target in the ../build.xml file. -->
 109.554 +    </target>
 109.555 +    <target if="do.depend.true" name="-compile-test-depend">
 109.556 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 109.557 +    </target>
 109.558 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 109.559 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 109.560 +        <copy todir="${build.test.classes.dir}">
 109.561 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 109.562 +        </copy>
 109.563 +    </target>
 109.564 +    <target name="-post-compile-test">
 109.565 +        <!-- Empty placeholder for easier customization. -->
 109.566 +        <!-- You can override this target in the ../build.xml file. -->
 109.567 +    </target>
 109.568 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 109.569 +    <target name="-pre-compile-test-single">
 109.570 +        <!-- Empty placeholder for easier customization. -->
 109.571 +        <!-- You can override this target in the ../build.xml file. -->
 109.572 +    </target>
 109.573 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 109.574 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 109.575 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 109.576 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
 109.577 +        <copy todir="${build.test.classes.dir}">
 109.578 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 109.579 +        </copy>
 109.580 +    </target>
 109.581 +    <target name="-post-compile-test-single">
 109.582 +        <!-- Empty placeholder for easier customization. -->
 109.583 +        <!-- You can override this target in the ../build.xml file. -->
 109.584 +    </target>
 109.585 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 109.586 +    <!--
 109.587 +                =======================
 109.588 +                JUNIT EXECUTION SECTION
 109.589 +                =======================
 109.590 +            -->
 109.591 +    <target depends="init" if="have.tests" name="-pre-test-run">
 109.592 +        <mkdir dir="${build.test.results.dir}"/>
 109.593 +    </target>
 109.594 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 109.595 +        <j2seproject3:junit testincludes="**/*Test.java"/>
 109.596 +    </target>
 109.597 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 109.598 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 109.599 +    </target>
 109.600 +    <target depends="init" if="have.tests" name="test-report"/>
 109.601 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 109.602 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 109.603 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
 109.604 +        <mkdir dir="${build.test.results.dir}"/>
 109.605 +    </target>
 109.606 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 109.607 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 109.608 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
 109.609 +    </target>
 109.610 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 109.611 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 109.612 +    </target>
 109.613 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
 109.614 +    <!--
 109.615 +                =======================
 109.616 +                JUNIT DEBUGGING SECTION
 109.617 +                =======================
 109.618 +            -->
 109.619 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
 109.620 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 109.621 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
 109.622 +        <delete file="${test.report.file}"/>
 109.623 +        <mkdir dir="${build.test.results.dir}"/>
 109.624 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
 109.625 +            <customize>
 109.626 +                <syspropertyset>
 109.627 +                    <propertyref prefix="test-sys-prop."/>
 109.628 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
 109.629 +                </syspropertyset>
 109.630 +                <arg value="${test.class}"/>
 109.631 +                <arg value="showoutput=true"/>
 109.632 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 109.633 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
 109.634 +            </customize>
 109.635 +        </j2seproject3:debug>
 109.636 +    </target>
 109.637 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 109.638 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 109.639 +    </target>
 109.640 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 109.641 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 109.642 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 109.643 +    </target>
 109.644 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 109.645 +    <!--
 109.646 +                =========================
 109.647 +                APPLET EXECUTION SECTION
 109.648 +                =========================
 109.649 +            -->
 109.650 +    <target depends="init,compile-single" name="run-applet">
 109.651 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 109.652 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 109.653 +            <customize>
 109.654 +                <arg value="${applet.url}"/>
 109.655 +            </customize>
 109.656 +        </j2seproject1:java>
 109.657 +    </target>
 109.658 +    <!--
 109.659 +                =========================
 109.660 +                APPLET DEBUGGING  SECTION
 109.661 +                =========================
 109.662 +            -->
 109.663 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 109.664 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 109.665 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 109.666 +            <customize>
 109.667 +                <arg value="${applet.url}"/>
 109.668 +            </customize>
 109.669 +        </j2seproject3:debug>
 109.670 +    </target>
 109.671 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 109.672 +    <!--
 109.673 +                ===============
 109.674 +                CLEANUP SECTION
 109.675 +                ===============
 109.676 +            -->
 109.677 +    <target depends="init" name="deps-clean" unless="no.deps"/>
 109.678 +    <target depends="init" name="-do-clean">
 109.679 +        <delete dir="${build.dir}"/>
 109.680 +        <delete dir="${dist.dir}"/>
 109.681 +    </target>
 109.682 +    <target name="-post-clean">
 109.683 +        <!-- Empty placeholder for easier customization. -->
 109.684 +        <!-- You can override this target in the ../build.xml file. -->
 109.685 +    </target>
 109.686 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 109.687 +</project>
   110.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.2 +++ b/task1/solution10/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
   110.3 @@ -0,0 +1,8 @@
   110.4 +build.xml.data.CRC32=75e20e37
   110.5 +build.xml.script.CRC32=2c84d7b2
   110.6 +build.xml.stylesheet.CRC32=be360661
   110.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   110.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   110.9 +nbproject/build-impl.xml.data.CRC32=75e20e37
  110.10 +nbproject/build-impl.xml.script.CRC32=e2acc04f
  110.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
   111.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   111.2 +++ b/task1/solution10/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
   111.3 @@ -0,0 +1,59 @@
   111.4 +application.title=basic
   111.5 +application.vendor=vvessan
   111.6 +build.classes.dir=${build.dir}/classes
   111.7 +build.classes.excludes=**/*.java,**/*.form
   111.8 +# This directory is removed when the project is cleaned:
   111.9 +build.dir=build
  111.10 +build.generated.dir=${build.dir}/generated
  111.11 +# Only compile against the classpath explicitly listed here:
  111.12 +build.sysclasspath=ignore
  111.13 +build.test.classes.dir=${build.dir}/test/classes
  111.14 +build.test.results.dir=${build.dir}/test/results
  111.15 +debug.classpath=\
  111.16 +    ${run.classpath}
  111.17 +debug.test.classpath=\
  111.18 +    ${run.test.classpath}
  111.19 +# This directory is removed when the project is cleaned:
  111.20 +dist.dir=dist
  111.21 +dist.jar=${dist.dir}/Currency_Convertor_Solution_10.jar
  111.22 +dist.javadoc.dir=${dist.dir}/javadoc
  111.23 +excludes=
  111.24 +file.reference.junit-4.4.jar=../../libs/junit-4.4.jar
  111.25 +includes=**
  111.26 +jar.compress=false
  111.27 +javac.classpath=
  111.28 +# Space-separated list of extra javac options
  111.29 +javac.compilerargs=
  111.30 +javac.deprecation=false
  111.31 +javac.source=1.5
  111.32 +javac.target=1.5
  111.33 +javac.test.classpath=\
  111.34 +    ${javac.classpath}:\
  111.35 +    ${build.classes.dir}:\
  111.36 +    ${file.reference.junit-4.4.jar}
  111.37 +javadoc.additionalparam=
  111.38 +javadoc.author=false
  111.39 +javadoc.encoding=${source.encoding}
  111.40 +javadoc.noindex=false
  111.41 +javadoc.nonavbar=false
  111.42 +javadoc.notree=false
  111.43 +javadoc.private=false
  111.44 +javadoc.splitindex=true
  111.45 +javadoc.use=true
  111.46 +javadoc.version=false
  111.47 +javadoc.windowtitle=
  111.48 +meta.inf.dir=${src.dir}/META-INF
  111.49 +platform.active=JDK_1.6
  111.50 +run.classpath=\
  111.51 +    ${javac.classpath}:\
  111.52 +    ${build.classes.dir}
  111.53 +# Space-separated list of JVM arguments used when running the project
  111.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  111.55 +# or test-sys-prop.name=value to set system properties for unit tests):
  111.56 +run.jvmargs=
  111.57 +run.test.classpath=\
  111.58 +    ${javac.test.classpath}:\
  111.59 +    ${build.test.classes.dir}
  111.60 +source.encoding=UTF-8
  111.61 +src.dir=src
  111.62 +test.src.dir=test
   112.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   112.2 +++ b/task1/solution10/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
   112.3 @@ -0,0 +1,17 @@
   112.4 +<?xml version="1.0" encoding="UTF-8"?>
   112.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   112.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   112.7 +    <configuration>
   112.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   112.9 +            <name>Currency Convertor Solution 10</name>
  112.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  112.11 +            <explicit-platform explicit-source-supported="true"/>
  112.12 +            <source-roots>
  112.13 +                <root id="src.dir"/>
  112.14 +            </source-roots>
  112.15 +            <test-roots>
  112.16 +                <root id="test.src.dir"/>
  112.17 +            </test-roots>
  112.18 +        </data>
  112.19 +    </configuration>
  112.20 +</project>
   113.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/ConstantRateConverter.java	Sun Sep 28 14:12:38 2008 +0200
   113.3 @@ -0,0 +1,44 @@
   113.4 +package org.apidesign.apifest08.currency;
   113.5 +
   113.6 +import java.util.*;
   113.7 +
   113.8 +final class ConstantRateConverter implements CurrencyConverter {
   113.9 +
  113.10 +	private final Currency from;
  113.11 +	private final Currency to;
  113.12 +
  113.13 +	private final double rate;
  113.14 +
  113.15 +	public ConstantRateConverter(Currency from, Currency to, double rate) throws IllegalArgumentException {
  113.16 +		if (from == null || to == null)
  113.17 +			throw new NullPointerException("None of the currencies can be null");
  113.18 +		if (from.equals(to))
  113.19 +			throw new IllegalArgumentException("Cannot create converter with two equal currencies");
  113.20 +		this.from = from;
  113.21 +		this.to = to;
  113.22 +		this.rate = rate;
  113.23 +	}
  113.24 +
  113.25 +	@Override
  113.26 +	public double convert(double value, String from, String to)
  113.27 +			throws CurrencyConversionException, NullPointerException {
  113.28 +		return convert(value, Currency.getInstance(from), Currency.getInstance(to));
  113.29 +	}
  113.30 +
  113.31 +	@Override
  113.32 +	public double convert(double value, Currency from, Currency to)
  113.33 +			throws NullPointerException, CurrencyConversionException {
  113.34 +
  113.35 +		if (this.from.equals(from)) {
  113.36 +			if (!this.to.equals(to))
  113.37 +				throw new CurrencyConversionException(from, to, "Unsupported currency");
  113.38 +			return value * rate;
  113.39 +		}
  113.40 +		if (this.from.equals(to)) {
  113.41 +			if (!this.to.equals(from))
  113.42 +				throw new CurrencyConversionException(from, to, "Unsupported currency");
  113.43 +			return value / rate;
  113.44 +		}
  113.45 +		throw new CurrencyConversionException(from, to, "Unsupported currency"); 
  113.46 +	}
  113.47 +}
   114.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConversionException.java	Sun Sep 28 14:12:38 2008 +0200
   114.3 @@ -0,0 +1,42 @@
   114.4 +package org.apidesign.apifest08.currency;
   114.5 +
   114.6 +import java.util.*;
   114.7 +
   114.8 +/**
   114.9 + * Exception thrown in cases that a CurrencyConverter is unable ensure requested accuracy of conversion.
  114.10 + * Such situation may occur in cases that the client is not on-line, or the exchange rates are older than
  114.11 + * requested etc. This exception is defined as RuntimeException to enable simple usage in simple applications,
  114.12 + * but enable other applications to be informed about possible problems and prevent them from using
  114.13 + * inaccurate data.
  114.14 + */
  114.15 +public final class CurrencyConversionException extends RuntimeException {
  114.16 +
  114.17 +	private final Currency from;
  114.18 +	private final Currency to;
  114.19 +
  114.20 +	CurrencyConversionException(Currency from, Currency to) {
  114.21 +		this(from, to, (Throwable) null);
  114.22 +	}
  114.23 +
  114.24 +	CurrencyConversionException(Currency from, Currency to, Throwable throwable) {
  114.25 +		this(from, to, String.format("Failed to convert curency from %1$s to %2$s", from, to), throwable);
  114.26 +	}
  114.27 +
  114.28 +	CurrencyConversionException(Currency from, Currency to, String message) {
  114.29 +		this(from, to, message, null);
  114.30 +	}
  114.31 +
  114.32 +	CurrencyConversionException(Currency from, Currency to, String message, Throwable throwable) {
  114.33 +		super(message, throwable);
  114.34 +		this.from = from;
  114.35 +		this.to = to;
  114.36 +	}
  114.37 +
  114.38 +	public Currency getFromCurrency() {
  114.39 +		return from;
  114.40 +	}
  114.41 +
  114.42 +	public Currency getToCurrency() {
  114.43 +		return to;
  114.44 +	}
  114.45 +}
   115.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConverter.java	Sun Sep 28 14:12:38 2008 +0200
   115.3 @@ -0,0 +1,48 @@
   115.4 +package org.apidesign.apifest08.currency;
   115.5 +
   115.6 +import java.util.*;
   115.7 +
   115.8 +/** This is the skeleton class for your API. You need to make it public, so
   115.9 + * it is accessible to your client code (currently in Task1Test.java) file.
  115.10 + * <p>
  115.11 + * Feel free to create additional classes or rename this one, just keep all
  115.12 + * the API and its implementation in this package. Do not spread it outside
  115.13 + * to other packages.
  115.14 + *
  115.15 + * The converter will usually work internally with Currency class, to be more type-safe as String can be used
  115.16 + * for almost anything. But methods taking strings as parameters are provided for convenience.
  115.17 + */
  115.18 +public interface CurrencyConverter {
  115.19 +
  115.20 +	/**
  115.21 +	 * This is convenience method for convert(Currency.getInstance(from), Currency.getInstance(to)).
  115.22 +	 *
  115.23 +	 * @param value that should be converted form one currency to the other
  115.24 +	 * @param from ISO-4217 code of the currency of the value provided
  115.25 +	 * @param to ISO-4212 code of the currency to which the value should be converted
  115.26 +	 * @return value expressed in the target value
  115.27 +	 * @throws IllegalArgumentException if any of the arguments is not a valid ISO code
  115.28 +	 * @throws CurrencyConversionException if the conversion cannot be performed with desired parameters,
  115.29 +	 * for example the exchange rates are not current, connection to exchange rates provider is not available
  115.30 +	 * @throws NullPointerException if any of the specified currency ISO codes is null
  115.31 +	 */
  115.32 +	// this method is provided to ensure future compatibility for converters supporting more than 2 currencies
  115.33 +	//		- simpler methods with fewer arguments would make using such converters less intuitive
  115.34 +	double convert(double value, /*@NotNull*/ String from, /*@NotNull*/ String to)
  115.35 +			throws CurrencyConversionException, NullPointerException, IllegalArgumentException;
  115.36 +
  115.37 +	/**
  115.38 +	 * Converts the specified value from one currency (from) to target currency (to).
  115.39 +	 *
  115.40 +	 * @param value that should be converted form one currency to the other
  115.41 +	 * @param from ISO-4217 code of the currency of the value provided
  115.42 +	 * @param to ISO-4212 code of the currency to which the value should be converted
  115.43 +	 * @return value expressed in the target value
  115.44 +	 * @throws IllegalArgumentException if any of the arguments is not a valid ISO code
  115.45 +	 * @throws CurrencyConversionException if the conversion cannot be performed with desired parameters,
  115.46 +	 * for example the exchange rates are not current, connection to exchange rates provider is not available
  115.47 +	 * @throws NullPointerException if any of the specified currency ISO codes is null
  115.48 +	 */
  115.49 +	double convert(double value, /*@NotNull*/ Currency from, /*@NotNull*/ Currency to)
  115.50 +			throws CurrencyConversionException, NullPointerException;
  115.51 +}
   116.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/CurrencyConverterProvider.java	Sun Sep 28 14:12:38 2008 +0200
   116.3 @@ -0,0 +1,68 @@
   116.4 +package org.apidesign.apifest08.currency;
   116.5 +
   116.6 +import java.util.*;
   116.7 +
   116.8 +/**
   116.9 + * CurrencyConversionService provides methods necessary for construction all necessary currency
  116.10 + * conversion-related classes.
  116.11 + */
  116.12 +public interface CurrencyConverterProvider {
  116.13 +
  116.14 +	/**
  116.15 +	 * Convenience method for getConverter(amount1, Currency.getInstance(currency1));
  116.16 +	 *
  116.17 +	 * @param amount1 amount of the money in the currency1
  116.18 +	 * @param currency1 one of the supported currencies
  116.19 +	 * @param amount2 amount of the money in the currency2
  116.20 +	 * @param currency2 one of the supported currencies
  116.21 +	 * @return converter able to convert between the two specified currencies
  116.22 +	 * @throws IllegalArgumentException if any of the amount values is not positive
  116.23 +	 * @throws CurrencyNotAvailableException thrown when one of the currencies is not available
  116.24 +	 */
  116.25 +	CurrencyConverter getConverter(double amount1, /*@NotNull*/ String currency1,
  116.26 +								   double amount2, /*@NotNull*/ String currency2)
  116.27 +			throws IllegalArgumentException, CurrencyNotAvailableException;
  116.28 +
  116.29 +	/**
  116.30 +	 * Retrieves converter that is capable of converting values between currency1 and currency2.
  116.31 +	 * The exchange is specified in easy to understand way. By specifying values in two currencies that
  116.32 +	 * are equal. For example CurrencyConverter.getConverter(25, "CZK", 1, "EUR"); means 25CKZ is equal to 1EUR.
  116.33 +	 * This enables user to use this method without having to calculate anything. In general this can be
  116.34 +	 * expressed by formula amount1[currency1] = amount2[currency2].
  116.35 +	 *
  116.36 +	 * @param amount1 amount of the money in the currency1
  116.37 +	 * @param currency1 one of the supported currencies
  116.38 +	 * @param amount2 amount of the money in the currency2
  116.39 +	 * @param currency2 one of the supported currencies
  116.40 +	 * @return converter able to convert between the two specified currencies
  116.41 +	 * @throws IllegalArgumentException if any of the amount values is not positive
  116.42 +	 * @throws CurrencyNotAvailableException thrown when one of the currencies is not available
  116.43 +	 */
  116.44 +	CurrencyConverter getConverter(double amount1, /*@NotNull*/ Currency currency1,
  116.45 +								   double amount2, /*@NotNull*/ Currency currency2)
  116.46 +			throws IllegalArgumentException, CurrencyNotAvailableException;
  116.47 +
  116.48 +	/**
  116.49 +	 * Creates a new converter that is able to convert between all specified currencies. The converter
  116.50 +	 * may optionally support additional currencies that were not specified.
  116.51 +	 *
  116.52 +	 * @param currencies that the converter should be created for
  116.53 +	 * @return converter able to convert between all specified currencies
  116.54 +	 * @throws CurrencyNotAvailableException thrown when one of the currencies is not available
  116.55 +	 * @throws NullPointerException if any of the specified currencies is null of the array is null
  116.56 +	 */
  116.57 +	CurrencyConverter getConverter(/*@NotNull*/ Currency... currencies)
  116.58 +			throws CurrencyNotAvailableException, NullPointerException;
  116.59 +
  116.60 +	/**
  116.61 +	 * Convenient method for getConverter(Currency...)
  116.62 +	 *
  116.63 +	 * @param currencies that the converter should be created for
  116.64 +	 * @return converter able to convert between all specified currencies
  116.65 +	 * @throws CurrencyNotAvailableException thrown when one of the currencies is not available
  116.66 +	 * @throws NullPointerException if any of the specified currencies is null, or the array is null
  116.67 +	 * @throws IllegalArgumentException if any of the specified currencies is not a valid ISO code
  116.68 +	 */
  116.69 +	CurrencyConverter getConverter(/*@NotNull*/ String... currencies)
  116.70 +			throws CurrencyNotAvailableException, IllegalArgumentException, NullPointerException;
  116.71 +}
  116.72 \ No newline at end of file
   117.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/CurrencyNotAvailableException.java	Sun Sep 28 14:12:38 2008 +0200
   117.3 @@ -0,0 +1,21 @@
   117.4 +package org.apidesign.apifest08.currency;
   117.5 +
   117.6 +import java.util.*;
   117.7 +
   117.8 +public final class CurrencyNotAvailableException extends RuntimeException {
   117.9 +
  117.10 +	private final Currency currency;
  117.11 +
  117.12 +	CurrencyNotAvailableException(Currency currency) {
  117.13 +		this(currency, String.format("Currency %1$s not available", currency));	
  117.14 +	}
  117.15 +
  117.16 +	CurrencyNotAvailableException(Currency currency, String message) {
  117.17 +		super(message);
  117.18 +		this.currency = currency;
  117.19 +	}
  117.20 +
  117.21 +	public Currency getCurrency() {
  117.22 +		return currency;
  117.23 +	}
  117.24 +}
   118.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/MultiCurrencyConstantRateConverter.java	Sun Sep 28 14:12:38 2008 +0200
   118.3 @@ -0,0 +1,71 @@
   118.4 +package org.apidesign.apifest08.currency;
   118.5 +
   118.6 +import java.util.*;
   118.7 +
   118.8 +final class MultiCurrencyConstantRateConverter implements CurrencyConverter {
   118.9 +
  118.10 +	private final Map<Currency, Double> rates;
  118.11 +
  118.12 +	public MultiCurrencyConstantRateConverter(Map<Currency, Double> rates) {
  118.13 +		this.rates = rates;
  118.14 +	}
  118.15 +
  118.16 +	/**
  118.17 +	 * This is convenience method for convert(Currency.getInstance(from), Currency.getInstance(to)).
  118.18 +	 *
  118.19 +	 * @param value that should be converted form one currency to the other
  118.20 +	 * @param from  ISO-4217 code of the currency of the value provided
  118.21 +	 * @param to	ISO-4212 code of the currency to which the value should be converted
  118.22 +	 *
  118.23 +	 * @return value expressed in the target value
  118.24 +	 *
  118.25 +	 * @throws IllegalArgumentException if any of the arguments is not a valid ISO code
  118.26 +	 * @throws CurrencyConversionException
  118.27 +	 *                                  if the conversion cannot be performed with desired parameters, for
  118.28 +	 *                                  example the exchange rates are not current, connection to exchange rates
  118.29 +	 *                                  provider is not available
  118.30 +	 * @throws NullPointerException	 if any of the specified currency ISO codes is null
  118.31 +	 */
  118.32 +	// this method is provided to ensure future compatibility for converters supporting more than 2 currencies
  118.33 +	//		- simpler methods with fewer arguments would make using such converters less intuitive
  118.34 +	@Override
  118.35 +	public double convert(double value, /*@NotNull*/ String from, /*@NotNull*/ String to)
  118.36 +			throws CurrencyConversionException, NullPointerException, IllegalArgumentException {
  118.37 +		return convert(value, Currency.getInstance(from), Currency.getInstance(to));
  118.38 +	}
  118.39 +
  118.40 +	/**
  118.41 +	 * Converts the specified value from one currency (from) to target currency (to).
  118.42 +	 *
  118.43 +	 * @param value that should be converted form one currency to the other
  118.44 +	 * @param from  ISO-4217 code of the currency of the value provided
  118.45 +	 * @param to	ISO-4212 code of the currency to which the value should be converted
  118.46 +	 *
  118.47 +	 * @return value expressed in the target value
  118.48 +	 *
  118.49 +	 * @throws IllegalArgumentException if any of the arguments is not a valid ISO code
  118.50 +	 * @throws CurrencyConversionException
  118.51 +	 *                                  if the conversion cannot be performed with desired parameters, for
  118.52 +	 *                                  example the exchange rates are not current, connection to exchange rates
  118.53 +	 *                                  provider is not available
  118.54 +	 * @throws NullPointerException	 if any of the specified currency ISO codes is null
  118.55 +	 */
  118.56 +	@Override
  118.57 +	public double convert(double value, /*@NotNull*/ Currency from, /*@NotNull*/ Currency to)
  118.58 +			throws CurrencyConversionException, NullPointerException {
  118.59 +
  118.60 +		// this is not necessary, but we let users know that nulls are not allowed here - should be handled by annotations
  118.61 +		if (from == null || to == null)
  118.62 +			throw new NullPointerException("One of the specified currencies in null");
  118.63 +
  118.64 +		Double fromRate = rates.get(from);
  118.65 +		Double toRate = rates.get(to);
  118.66 +
  118.67 +		if (fromRate == null)
  118.68 +			throw new CurrencyConversionException(from, to, String.format("Currency %1$s not supported", from));
  118.69 +		if (toRate == null)
  118.70 +			throw new CurrencyConversionException(from, to, String.format("Currency %1$s not supported", to));
  118.71 +
  118.72 +		return (value / fromRate) * toRate;
  118.73 +	}
  118.74 +}
   119.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.2 +++ b/task1/solution10/src/org/apidesign/apifest08/currency/OfflineConverterProvider.java	Sun Sep 28 14:12:38 2008 +0200
   119.3 @@ -0,0 +1,120 @@
   119.4 +package org.apidesign.apifest08.currency;
   119.5 +
   119.6 +import java.util.*;
   119.7 +
   119.8 +/**
   119.9 + * ConvertorProvider class is introduced to handle
  119.10 + */
  119.11 +public final class OfflineConverterProvider implements CurrencyConverterProvider {
  119.12 +
  119.13 +
  119.14 +	// we can't synchronize on DEFAULT as it's not final and can even be null in synchronized section
  119.15 +	private static final Object LOCK = new Object();
  119.16 +	private static CurrencyConverterProvider DEFAULT;
  119.17 +
  119.18 +	// this is not nice and could be static, but future usage is uncertain and it's pretty easy to create
  119.19 +	private final Map<Currency, Double> rates;
  119.20 +
  119.21 +	private OfflineConverterProvider() {
  119.22 +		rates = new HashMap<Currency, Double>();
  119.23 +		// simple initialization just for Task1Test
  119.24 +		rates.put(Currency.getInstance("USD"), 100.0);
  119.25 +		rates.put(Currency.getInstance("CZK"), 1700.0);
  119.26 +		rates.put(Currency.getInstance("SKK"), 2125.0);
  119.27 +	}
  119.28 +
  119.29 +	/**
  119.30 +	 * Provides default implementation of ConvertorProvider. This Converter does nos not ensure accuracy
  119.31 +	 * of exchange rates, but should be functional at any circumstances including being offline.
  119.32 +	 *
  119.33 +	 * @return
  119.34 +	 */
  119.35 +	public static CurrencyConverterProvider getInstance() {
  119.36 +		// should be necessary in current implementation as creating CurrencyConverterProvider is cheap, but for future
  119.37 +		if (DEFAULT == null)
  119.38 +			synchronized (LOCK) {
  119.39 +				if (DEFAULT == null)
  119.40 +					DEFAULT = new OfflineConverterProvider();
  119.41 +			}
  119.42 +		return DEFAULT;
  119.43 +	}
  119.44 +
  119.45 +	@Override
  119.46 +	public CurrencyConverter getConverter(double amount1, /*@NotNull*/ String currency1,
  119.47 +									   double amount2, /*@NotNull*/ String currency2)
  119.48 +			throws IllegalArgumentException {
  119.49 +
  119.50 +		return getConverter(amount1, Currency.getInstance(currency2), amount2, Currency.getInstance(currency1));
  119.51 +	}
  119.52 +
  119.53 +	/**
  119.54 +	 * Retrieves converter that is capable of converting values between currency1 and currency2. The exchange is
  119.55 +	 * specified in easy to understand way. By specifying values in two currencies that are equal. For example
  119.56 +	 * CurrencyConverter.getConverter(25, "CZK", 1, "EUR"); means 25CKZ is equal to 1EUR. This enables user to
  119.57 +	 * use this method without having to calculate anything. In general this can be expressed by formula
  119.58 +	 * amount1[currency1] = amount2[currency2].
  119.59 +	 *
  119.60 +	 * @param amount1
  119.61 +	 * @param currency1
  119.62 +	 * @param amount2
  119.63 +	 * @param currency2
  119.64 +	 *
  119.65 +	 * @return
  119.66 +	 *
  119.67 +	 * @throws IllegalArgumentException
  119.68 +	 * @throws CurrencyNotAvailableException
  119.69 +	 *
  119.70 +	 */
  119.71 +	@Override
  119.72 +	public CurrencyConverter getConverter(double amount1, /*@NotNull*/ Currency currency1,
  119.73 +									   double amount2, /*@NotNull*/ Currency currency2)
  119.74 +			throws IllegalArgumentException, CurrencyNotAvailableException {
  119.75 +		if (amount1 <= 0.0 || amount2 <= 0.0)
  119.76 +			throw new IllegalArgumentException(
  119.77 +					String.format("The specified currency values (%1$s, %2$s)", amount1, amount2));
  119.78 +		return new ConstantRateConverter(currency2, currency1, amount2 / amount1);
  119.79 +	}
  119.80 +
  119.81 +	/**
  119.82 +	 * Creates a new converter that is able to convert between all specified currencies.
  119.83 +	 *
  119.84 +	 * @param currencies that the converter should be created for
  119.85 +	 *
  119.86 +	 * @return converter able to convert between all specified currencies
  119.87 +	 *
  119.88 +	 * @throws CurrencyNotAvailableException
  119.89 +	 *          thrown when one of the currencies is not available
  119.90 +	 */
  119.91 +	@Override
  119.92 +	public CurrencyConverter getConverter(/*@NotNull*/ Currency... currencies) throws CurrencyNotAvailableException {
  119.93 +		for (Currency c : currencies) {
  119.94 +			if (c == null)
  119.95 +				throw new NullPointerException("One of the specified currencies is null");
  119.96 +			if (!rates.containsKey(c))
  119.97 +				throw new CurrencyNotAvailableException(c);
  119.98 +		}
  119.99 +		return new MultiCurrencyConstantRateConverter(rates);
 119.100 +	}
 119.101 +
 119.102 +	/**
 119.103 +	 * Creates a new converter that is able to convert between all specified currencies.
 119.104 +	 *
 119.105 +	 * @param currencies that the converter should be created for
 119.106 +	 *
 119.107 +	 * @return converter able to convert between all specified currencies
 119.108 +	 *
 119.109 +	 * @throws CurrencyNotAvailableException
 119.110 +	 *                                  thrown when one of the currencies is not available
 119.111 +	 * @throws NullPointerException	 if any of the specified currencies is null
 119.112 +	 * @throws IllegalArgumentException if any of the specified currencies is not a valid ISO code
 119.113 +	 */
 119.114 +	@Override
 119.115 +	public CurrencyConverter getConverter(/*@NotNull*/ String... currencies)
 119.116 +			throws CurrencyNotAvailableException, IllegalArgumentException, NullPointerException {
 119.117 +
 119.118 +		Currency[] c2 = new Currency[currencies.length];
 119.119 +		for (int i = 0; i < c2.length; i++)
 119.120 +			c2[i] = Currency.getInstance(currencies[i]);
 119.121 +		return getConverter(c2);
 119.122 +	}
 119.123 +}
   120.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.2 +++ b/task1/solution10/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
   120.3 @@ -0,0 +1,134 @@
   120.4 +package org.apidesign.apifest08.test;
   120.5 +
   120.6 +import junit.framework.*;
   120.7 +import org.apidesign.apifest08.currency.*;
   120.8 +
   120.9 +import java.util.*;
  120.10 +
  120.11 +/** Finish the Convertor API, and then write bodies of methods inside
  120.12 + * of this class to match the given tasks. To fullfil your task, use the
  120.13 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
  120.14 + * Do not you reflection, or other hacks as your code
  120.15 + * shall run without any runtime permissions.
  120.16 + */
  120.17 +public class Task1Test extends TestCase {
  120.18 +
  120.19 +	private static final String
  120.20 +			USD = "USD",
  120.21 +			CZK = "CZK",
  120.22 +			SKK = "SKK";
  120.23 +
  120.24 +	private static final Currency
  120.25 +			USD2 = Currency.getInstance(USD),
  120.26 +			CZK2 = Currency.getInstance(CZK),
  120.27 +			SKK2 = Currency.getInstance(SKK);
  120.28 +
  120.29 +	public Task1Test(String testName) {
  120.30 +    	super(testName);
  120.31 +    }
  120.32 +
  120.33 +    @Override
  120.34 +    protected void setUp() throws Exception {
  120.35 +	}
  120.36 +
  120.37 +    @Override
  120.38 +    protected void tearDown() throws Exception {
  120.39 +    }
  120.40 +
  120.41 +    /** Create convertor that understands two currencies, CZK and
  120.42 +     *  USD. Make 1 USD == 17 CZK.
  120.43 +     *
  120.44 +     * Creation of the convertor shall not require subclassing of any class
  120.45 +     * or interface on the client side.
  120.46 +     *
  120.47 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
  120.48 +     */
  120.49 +    public static CurrencyConverter createCZKtoUSD() {
  120.50 +		return OfflineConverterProvider.getInstance().getConverter(17, CZK, 1, USD);
  120.51 +    }
  120.52 +
  120.53 +	public static CurrencyConverter createCZKtoUSD2() {
  120.54 +		return OfflineConverterProvider.getInstance().getConverter(CZK, USD);
  120.55 +    }
  120.56 +
  120.57 +    /** Create convertor that understands two currencies, CZK and
  120.58 +     *  SKK. Make 100 SKK == 80 CZK.
  120.59 +     *
  120.60 +     * Creation of the convertor shall not require subclassing of any class
  120.61 +     * or interface on the client side.
  120.62 +     * 
  120.63 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
  120.64 +     */
  120.65 +    public static CurrencyConverter createSKKtoCZK() {
  120.66 +        return OfflineConverterProvider.getInstance().getConverter(100, SKK, 80, CZK);
  120.67 +    }
  120.68 +
  120.69 +	public static CurrencyConverter createSKKtoCZK2() {
  120.70 +        return OfflineConverterProvider.getInstance().getConverter(SKK, CZK);
  120.71 +    }
  120.72 +    
  120.73 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
  120.74 +     * with it.
  120.75 +     */
  120.76 +    public void testCurrencyCZKUSD() throws Exception {
  120.77 +		CurrencyConverter c = createCZKtoUSD();
  120.78 +		testCZKUSD(c);
  120.79 +
  120.80 +		// test without specifying rates
  120.81 +		c = createCZKtoUSD2();
  120.82 +		testCZKUSD(c);
  120.83 +	}
  120.84 +
  120.85 +	private void testCZKUSD(CurrencyConverter c) {
  120.86 +		double czk, usd;
  120.87 +		// convert $5 to CZK using c:
  120.88 +		// assertEquals("Result is 85 CZK");
  120.89 +		czk = c.convert(5, USD, CZK);
  120.90 +		assertEquals(85.0, czk, 0.0);
  120.91 +		czk = c.convert(5, USD2, CZK2);
  120.92 +		assertEquals(85.0, czk, 0.0);
  120.93 +
  120.94 +		// convert $8 to CZK
  120.95 +		// assertEquals("Result is 136 CZK");
  120.96 +		czk = c.convert(8, USD, CZK);
  120.97 +		assertEquals(136.0, czk, 0.0);
  120.98 +		czk = c.convert(8, USD2, CZK2);
  120.99 +		assertEquals(136.0, czk, 0.0);
 120.100 +
 120.101 +		// convert 1003CZK to USD
 120.102 +		// assertEquals("Result is 59 USD");
 120.103 +		usd = c.convert(1003, CZK, USD);
 120.104 +		assertEquals(59.0, usd, 0.0);
 120.105 +		usd = c.convert(1003, CZK2, USD2);
 120.106 +		assertEquals(59.0, usd, 0.0);
 120.107 +	}
 120.108 +
 120.109 +	/** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
 120.110 +     * with it.
 120.111 +     */
 120.112 +    public void testCurrencySKKCZK() throws Exception {
 120.113 +		CurrencyConverter c = createSKKtoCZK();
 120.114 +		testCZKSKK(c);
 120.115 +
 120.116 +		// test without specifying rates
 120.117 +		c = createSKKtoCZK2();
 120.118 +		testCZKSKK(c);
 120.119 +	}
 120.120 +
 120.121 +	private void testCZKSKK(CurrencyConverter c) {
 120.122 +		double czk, skk;
 120.123 +		// convert 16CZK using c:
 120.124 +		// assertEquals("Result is 20 SKK");
 120.125 +		skk = c.convert(16, CZK, SKK);
 120.126 +		assertEquals(20.0, skk, 0.0);
 120.127 +		skk = c.convert(16, CZK2, SKK2);
 120.128 +		assertEquals(20.0, skk, 0.0);
 120.129 +
 120.130 +		// convert 500SKK to CZK
 120.131 +		// assertEquals("Result is 400 CZK");
 120.132 +		czk = c.convert(500, SKK, CZK);
 120.133 +		assertEquals(400.0, czk, 0.0);
 120.134 +		czk = c.convert(500, SKK2, CZK2);
 120.135 +		assertEquals(400.0, czk, 0.0);
 120.136 +	}
 120.137 +}
 120.138 \ No newline at end of file
   121.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.2 +++ b/task1/solution11/build.xml	Sun Sep 28 14:12:38 2008 +0200
   121.3 @@ -0,0 +1,69 @@
   121.4 +<?xml version="1.0" encoding="UTF-8"?>
   121.5 +<!-- You may freely edit this file. See commented blocks below for -->
   121.6 +<!-- some examples of how to customize the build. -->
   121.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   121.8 +<project name="currency" default="default" basedir=".">
   121.9 +    <description>Builds, tests, and runs the project.</description>
  121.10 +    <import file="nbproject/build-impl.xml"/>
  121.11 +    <!--
  121.12 +
  121.13 +    There exist several targets which are by default empty and which can be 
  121.14 +    used for execution of your tasks. These targets are usually executed 
  121.15 +    before and after some main targets. They are: 
  121.16 +
  121.17 +      -pre-init:                 called before initialization of project properties
  121.18 +      -post-init:                called after initialization of project properties
  121.19 +      -pre-compile:              called before javac compilation
  121.20 +      -post-compile:             called after javac compilation
  121.21 +      -pre-compile-single:       called before javac compilation of single file
  121.22 +      -post-compile-single:      called after javac compilation of single file
  121.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  121.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  121.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  121.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  121.27 +      -pre-jar:                  called before JAR building
  121.28 +      -post-jar:                 called after JAR building
  121.29 +      -post-clean:               called after cleaning build products
  121.30 +
  121.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  121.32 +
  121.33 +    Example of inserting an obfuscator after compilation could look like this:
  121.34 +
  121.35 +        <target name="-post-compile">
  121.36 +            <obfuscate>
  121.37 +                <fileset dir="${build.classes.dir}"/>
  121.38 +            </obfuscate>
  121.39 +        </target>
  121.40 +
  121.41 +    For list of available properties check the imported 
  121.42 +    nbproject/build-impl.xml file. 
  121.43 +
  121.44 +
  121.45 +    Another way to customize the build is by overriding existing main targets.
  121.46 +    The targets of interest are: 
  121.47 +
  121.48 +      -init-macrodef-javac:     defines macro for javac compilation
  121.49 +      -init-macrodef-junit:     defines macro for junit execution
  121.50 +      -init-macrodef-debug:     defines macro for class debugging
  121.51 +      -init-macrodef-java:      defines macro for class execution
  121.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  121.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  121.54 +      run:                      execution of project 
  121.55 +      -javadoc-build:           Javadoc generation
  121.56 +      test-report:              JUnit report generation
  121.57 +
  121.58 +    An example of overriding the target for project execution could look like this:
  121.59 +
  121.60 +        <target name="run" depends="currency-impl.jar">
  121.61 +            <exec dir="bin" executable="launcher.exe">
  121.62 +                <arg file="${dist.jar}"/>
  121.63 +            </exec>
  121.64 +        </target>
  121.65 +
  121.66 +    Notice that the overridden target depends on the jar target and not only on 
  121.67 +    the compile target as the regular run target does. Again, for a list of available 
  121.68 +    properties which you can use, check the target you are overriding in the
  121.69 +    nbproject/build-impl.xml file. 
  121.70 +
  121.71 +    -->
  121.72 +</project>
   122.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.2 +++ b/task1/solution11/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
   122.3 @@ -0,0 +1,642 @@
   122.4 +<?xml version="1.0" encoding="UTF-8"?>
   122.5 +<!--
   122.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   122.7 +***         EDIT ../build.xml INSTEAD         ***
   122.8 +
   122.9 +For the purpose of easier reading the script
  122.10 +is divided into following sections:
  122.11 +
  122.12 +  - initialization
  122.13 +  - compilation
  122.14 +  - jar
  122.15 +  - execution
  122.16 +  - debugging
  122.17 +  - javadoc
  122.18 +  - junit compilation
  122.19 +  - junit execution
  122.20 +  - junit debugging
  122.21 +  - applet
  122.22 +  - cleanup
  122.23 +
  122.24 +        -->
  122.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_11-impl">
  122.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
  122.27 +    <!-- 
  122.28 +                ======================
  122.29 +                INITIALIZATION SECTION 
  122.30 +                ======================
  122.31 +            -->
  122.32 +    <target name="-pre-init">
  122.33 +        <!-- Empty placeholder for easier customization. -->
  122.34 +        <!-- You can override this target in the ../build.xml file. -->
  122.35 +    </target>
  122.36 +    <target depends="-pre-init" name="-init-private">
  122.37 +        <property file="nbproject/private/config.properties"/>
  122.38 +        <property file="nbproject/private/configs/${config}.properties"/>
  122.39 +        <property file="nbproject/private/private.properties"/>
  122.40 +    </target>
  122.41 +    <target depends="-pre-init,-init-private" name="-init-user">
  122.42 +        <property file="${user.properties.file}"/>
  122.43 +        <!-- The two properties below are usually overridden -->
  122.44 +        <!-- by the active platform. Just a fallback. -->
  122.45 +        <property name="default.javac.source" value="1.4"/>
  122.46 +        <property name="default.javac.target" value="1.4"/>
  122.47 +    </target>
  122.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
  122.49 +        <property file="nbproject/configs/${config}.properties"/>
  122.50 +        <property file="nbproject/project.properties"/>
  122.51 +    </target>
  122.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
  122.53 +        <available file="${manifest.file}" property="manifest.available"/>
  122.54 +        <condition property="manifest.available+main.class">
  122.55 +            <and>
  122.56 +                <isset property="manifest.available"/>
  122.57 +                <isset property="main.class"/>
  122.58 +                <not>
  122.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  122.60 +                </not>
  122.61 +            </and>
  122.62 +        </condition>
  122.63 +        <condition property="manifest.available+main.class+mkdist.available">
  122.64 +            <and>
  122.65 +                <istrue value="${manifest.available+main.class}"/>
  122.66 +                <isset property="libs.CopyLibs.classpath"/>
  122.67 +            </and>
  122.68 +        </condition>
  122.69 +        <condition property="have.tests">
  122.70 +            <or>
  122.71 +                <available file="${test.src.dir}"/>
  122.72 +            </or>
  122.73 +        </condition>
  122.74 +        <condition property="have.sources">
  122.75 +            <or>
  122.76 +                <available file="${src.dir}"/>
  122.77 +            </or>
  122.78 +        </condition>
  122.79 +        <condition property="netbeans.home+have.tests">
  122.80 +            <and>
  122.81 +                <isset property="netbeans.home"/>
  122.82 +                <isset property="have.tests"/>
  122.83 +            </and>
  122.84 +        </condition>
  122.85 +        <condition property="no.javadoc.preview">
  122.86 +            <and>
  122.87 +                <isset property="javadoc.preview"/>
  122.88 +                <isfalse value="${javadoc.preview}"/>
  122.89 +            </and>
  122.90 +        </condition>
  122.91 +        <property name="run.jvmargs" value=""/>
  122.92 +        <property name="javac.compilerargs" value=""/>
  122.93 +        <property name="work.dir" value="${basedir}"/>
  122.94 +        <condition property="no.deps">
  122.95 +            <and>
  122.96 +                <istrue value="${no.dependencies}"/>
  122.97 +            </and>
  122.98 +        </condition>
  122.99 +        <property name="javac.debug" value="true"/>
 122.100 +        <property name="javadoc.preview" value="true"/>
 122.101 +        <property name="application.args" value=""/>
 122.102 +        <property name="source.encoding" value="${file.encoding}"/>
 122.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 122.104 +            <and>
 122.105 +                <isset property="javadoc.encoding"/>
 122.106 +                <not>
 122.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
 122.108 +                </not>
 122.109 +            </and>
 122.110 +        </condition>
 122.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 122.112 +        <property name="includes" value="**"/>
 122.113 +        <property name="excludes" value=""/>
 122.114 +        <property name="do.depend" value="false"/>
 122.115 +        <condition property="do.depend.true">
 122.116 +            <istrue value="${do.depend}"/>
 122.117 +        </condition>
 122.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
 122.119 +            <and>
 122.120 +                <isset property="jaxws.endorsed.dir"/>
 122.121 +                <available file="nbproject/jaxws-build.xml"/>
 122.122 +            </and>
 122.123 +        </condition>
 122.124 +    </target>
 122.125 +    <target name="-post-init">
 122.126 +        <!-- Empty placeholder for easier customization. -->
 122.127 +        <!-- You can override this target in the ../build.xml file. -->
 122.128 +    </target>
 122.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
 122.130 +        <fail unless="src.dir">Must set src.dir</fail>
 122.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 122.132 +        <fail unless="build.dir">Must set build.dir</fail>
 122.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
 122.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 122.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 122.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 122.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 122.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 122.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
 122.140 +    </target>
 122.141 +    <target name="-init-macrodef-property">
 122.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 122.143 +            <attribute name="name"/>
 122.144 +            <attribute name="value"/>
 122.145 +            <sequential>
 122.146 +                <property name="@{name}" value="${@{value}}"/>
 122.147 +            </sequential>
 122.148 +        </macrodef>
 122.149 +    </target>
 122.150 +    <target name="-init-macrodef-javac">
 122.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 122.152 +            <attribute default="${src.dir}" name="srcdir"/>
 122.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
 122.154 +            <attribute default="${javac.classpath}" name="classpath"/>
 122.155 +            <attribute default="${includes}" name="includes"/>
 122.156 +            <attribute default="${excludes}" name="excludes"/>
 122.157 +            <attribute default="${javac.debug}" name="debug"/>
 122.158 +            <attribute default="" name="sourcepath"/>
 122.159 +            <element name="customize" optional="true"/>
 122.160 +            <sequential>
 122.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
 122.162 +                    <classpath>
 122.163 +                        <path path="@{classpath}"/>
 122.164 +                    </classpath>
 122.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
 122.166 +                    <customize/>
 122.167 +                </javac>
 122.168 +            </sequential>
 122.169 +        </macrodef>
 122.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 122.171 +            <attribute default="${src.dir}" name="srcdir"/>
 122.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
 122.173 +            <attribute default="${javac.classpath}" name="classpath"/>
 122.174 +            <sequential>
 122.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 122.176 +                    <classpath>
 122.177 +                        <path path="@{classpath}"/>
 122.178 +                    </classpath>
 122.179 +                </depend>
 122.180 +            </sequential>
 122.181 +        </macrodef>
 122.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 122.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
 122.184 +            <sequential>
 122.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
 122.186 +                <pathconvert pathsep="," property="javac.includes.binary">
 122.187 +                    <path>
 122.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 122.189 +                    </path>
 122.190 +                    <globmapper from="*.java" to="*.class"/>
 122.191 +                </pathconvert>
 122.192 +                <delete>
 122.193 +                    <files includes="${javac.includes.binary}"/>
 122.194 +                </delete>
 122.195 +            </sequential>
 122.196 +        </macrodef>
 122.197 +    </target>
 122.198 +    <target name="-init-macrodef-junit">
 122.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 122.200 +            <attribute default="${includes}" name="includes"/>
 122.201 +            <attribute default="${excludes}" name="excludes"/>
 122.202 +            <attribute default="**" name="testincludes"/>
 122.203 +            <sequential>
 122.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
 122.205 +                    <batchtest todir="${build.test.results.dir}">
 122.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 122.207 +                            <filename name="@{testincludes}"/>
 122.208 +                        </fileset>
 122.209 +                    </batchtest>
 122.210 +                    <classpath>
 122.211 +                        <path path="${run.test.classpath}"/>
 122.212 +                    </classpath>
 122.213 +                    <syspropertyset>
 122.214 +                        <propertyref prefix="test-sys-prop."/>
 122.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 122.216 +                    </syspropertyset>
 122.217 +                    <formatter type="brief" usefile="false"/>
 122.218 +                    <formatter type="xml"/>
 122.219 +                    <jvmarg line="${run.jvmargs}"/>
 122.220 +                </junit>
 122.221 +            </sequential>
 122.222 +        </macrodef>
 122.223 +    </target>
 122.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
 122.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 122.226 +            <attribute default="${main.class}" name="name"/>
 122.227 +            <attribute default="${debug.classpath}" name="classpath"/>
 122.228 +            <attribute default="" name="stopclassname"/>
 122.229 +            <sequential>
 122.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
 122.231 +                    <classpath>
 122.232 +                        <path path="@{classpath}"/>
 122.233 +                    </classpath>
 122.234 +                </nbjpdastart>
 122.235 +            </sequential>
 122.236 +        </macrodef>
 122.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 122.238 +            <attribute default="${build.classes.dir}" name="dir"/>
 122.239 +            <sequential>
 122.240 +                <nbjpdareload>
 122.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
 122.242 +                        <include name="${fix.includes}*.class"/>
 122.243 +                    </fileset>
 122.244 +                </nbjpdareload>
 122.245 +            </sequential>
 122.246 +        </macrodef>
 122.247 +    </target>
 122.248 +    <target name="-init-debug-args">
 122.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
 122.250 +        <condition property="have-jdk-older-than-1.4">
 122.251 +            <or>
 122.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
 122.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
 122.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
 122.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
 122.256 +            </or>
 122.257 +        </condition>
 122.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
 122.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
 122.260 +        </condition>
 122.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
 122.262 +            <os family="windows"/>
 122.263 +        </condition>
 122.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
 122.265 +            <isset property="debug.transport"/>
 122.266 +        </condition>
 122.267 +    </target>
 122.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
 122.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 122.270 +            <attribute default="${main.class}" name="classname"/>
 122.271 +            <attribute default="${debug.classpath}" name="classpath"/>
 122.272 +            <element name="customize" optional="true"/>
 122.273 +            <sequential>
 122.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
 122.275 +                    <jvmarg line="${debug-args-line}"/>
 122.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
 122.277 +                    <jvmarg line="${run.jvmargs}"/>
 122.278 +                    <classpath>
 122.279 +                        <path path="@{classpath}"/>
 122.280 +                    </classpath>
 122.281 +                    <syspropertyset>
 122.282 +                        <propertyref prefix="run-sys-prop."/>
 122.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 122.284 +                    </syspropertyset>
 122.285 +                    <customize/>
 122.286 +                </java>
 122.287 +            </sequential>
 122.288 +        </macrodef>
 122.289 +    </target>
 122.290 +    <target name="-init-macrodef-java">
 122.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 122.292 +            <attribute default="${main.class}" name="classname"/>
 122.293 +            <element name="customize" optional="true"/>
 122.294 +            <sequential>
 122.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
 122.296 +                    <jvmarg line="${run.jvmargs}"/>
 122.297 +                    <classpath>
 122.298 +                        <path path="${run.classpath}"/>
 122.299 +                    </classpath>
 122.300 +                    <syspropertyset>
 122.301 +                        <propertyref prefix="run-sys-prop."/>
 122.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 122.303 +                    </syspropertyset>
 122.304 +                    <customize/>
 122.305 +                </java>
 122.306 +            </sequential>
 122.307 +        </macrodef>
 122.308 +    </target>
 122.309 +    <target name="-init-presetdef-jar">
 122.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 122.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
 122.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 122.313 +            </jar>
 122.314 +        </presetdef>
 122.315 +    </target>
 122.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
 122.317 +    <!--
 122.318 +                ===================
 122.319 +                COMPILATION SECTION
 122.320 +                ===================
 122.321 +            -->
 122.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
 122.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 122.324 +    <target depends="init" name="-check-automatic-build">
 122.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 122.326 +    </target>
 122.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 122.328 +        <antcall target="clean"/>
 122.329 +    </target>
 122.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
 122.331 +        <mkdir dir="${build.classes.dir}"/>
 122.332 +    </target>
 122.333 +    <target name="-pre-compile">
 122.334 +        <!-- Empty placeholder for easier customization. -->
 122.335 +        <!-- You can override this target in the ../build.xml file. -->
 122.336 +    </target>
 122.337 +    <target if="do.depend.true" name="-compile-depend">
 122.338 +        <j2seproject3:depend/>
 122.339 +    </target>
 122.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
 122.341 +        <j2seproject3:javac/>
 122.342 +        <copy todir="${build.classes.dir}">
 122.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 122.344 +        </copy>
 122.345 +    </target>
 122.346 +    <target name="-post-compile">
 122.347 +        <!-- Empty placeholder for easier customization. -->
 122.348 +        <!-- You can override this target in the ../build.xml file. -->
 122.349 +    </target>
 122.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
 122.351 +    <target name="-pre-compile-single">
 122.352 +        <!-- Empty placeholder for easier customization. -->
 122.353 +        <!-- You can override this target in the ../build.xml file. -->
 122.354 +    </target>
 122.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
 122.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 122.357 +        <j2seproject3:force-recompile/>
 122.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
 122.359 +    </target>
 122.360 +    <target name="-post-compile-single">
 122.361 +        <!-- Empty placeholder for easier customization. -->
 122.362 +        <!-- You can override this target in the ../build.xml file. -->
 122.363 +    </target>
 122.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
 122.365 +    <!--
 122.366 +                ====================
 122.367 +                JAR BUILDING SECTION
 122.368 +                ====================
 122.369 +            -->
 122.370 +    <target depends="init" name="-pre-pre-jar">
 122.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
 122.372 +        <mkdir dir="${dist.jar.dir}"/>
 122.373 +    </target>
 122.374 +    <target name="-pre-jar">
 122.375 +        <!-- Empty placeholder for easier customization. -->
 122.376 +        <!-- You can override this target in the ../build.xml file. -->
 122.377 +    </target>
 122.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
 122.379 +        <j2seproject1:jar/>
 122.380 +    </target>
 122.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
 122.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
 122.383 +    </target>
 122.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
 122.385 +        <j2seproject1:jar manifest="${manifest.file}">
 122.386 +            <j2seproject1:manifest>
 122.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 122.388 +            </j2seproject1:manifest>
 122.389 +        </j2seproject1:jar>
 122.390 +        <echo>To run this application from the command line without Ant, try:</echo>
 122.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 122.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 122.393 +        <pathconvert property="run.classpath.with.dist.jar">
 122.394 +            <path path="${run.classpath}"/>
 122.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 122.396 +        </pathconvert>
 122.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 122.398 +    </target>
 122.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
 122.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 122.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
 122.402 +            <path path="${run.classpath}"/>
 122.403 +            <map from="${build.classes.dir.resolved}" to=""/>
 122.404 +        </pathconvert>
 122.405 +        <pathconvert pathsep=" " property="jar.classpath">
 122.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
 122.407 +            <chainedmapper>
 122.408 +                <flattenmapper/>
 122.409 +                <globmapper from="*" to="lib/*"/>
 122.410 +            </chainedmapper>
 122.411 +        </pathconvert>
 122.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 122.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 122.414 +            <fileset dir="${build.classes.dir}"/>
 122.415 +            <manifest>
 122.416 +                <attribute name="Main-Class" value="${main.class}"/>
 122.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 122.418 +            </manifest>
 122.419 +        </copylibs>
 122.420 +        <echo>To run this application from the command line without Ant, try:</echo>
 122.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 122.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 122.423 +    </target>
 122.424 +    <target name="-post-jar">
 122.425 +        <!-- Empty placeholder for easier customization. -->
 122.426 +        <!-- You can override this target in the ../build.xml file. -->
 122.427 +    </target>
 122.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
 122.429 +    <!--
 122.430 +                =================
 122.431 +                EXECUTION SECTION
 122.432 +                =================
 122.433 +            -->
 122.434 +    <target depends="init,compile" description="Run a main class." name="run">
 122.435 +        <j2seproject1:java>
 122.436 +            <customize>
 122.437 +                <arg line="${application.args}"/>
 122.438 +            </customize>
 122.439 +        </j2seproject1:java>
 122.440 +    </target>
 122.441 +    <target name="-do-not-recompile">
 122.442 +        <property name="javac.includes.binary" value=""/>
 122.443 +    </target>
 122.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
 122.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 122.446 +        <j2seproject1:java classname="${run.class}"/>
 122.447 +    </target>
 122.448 +    <!--
 122.449 +                =================
 122.450 +                DEBUGGING SECTION
 122.451 +                =================
 122.452 +            -->
 122.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 122.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 122.455 +    </target>
 122.456 +    <target depends="init,compile" name="-debug-start-debuggee">
 122.457 +        <j2seproject3:debug>
 122.458 +            <customize>
 122.459 +                <arg line="${application.args}"/>
 122.460 +            </customize>
 122.461 +        </j2seproject3:debug>
 122.462 +    </target>
 122.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 122.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 122.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 122.466 +    </target>
 122.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 122.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 122.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 122.470 +        <j2seproject3:debug classname="${debug.class}"/>
 122.471 +    </target>
 122.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 122.473 +    <target depends="init" name="-pre-debug-fix">
 122.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
 122.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
 122.476 +    </target>
 122.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 122.478 +        <j2seproject1:nbjpdareload/>
 122.479 +    </target>
 122.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 122.481 +    <!--
 122.482 +                ===============
 122.483 +                JAVADOC SECTION
 122.484 +                ===============
 122.485 +            -->
 122.486 +    <target depends="init" name="-javadoc-build">
 122.487 +        <mkdir dir="${dist.javadoc.dir}"/>
 122.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
 122.489 +            <classpath>
 122.490 +                <path path="${javac.classpath}"/>
 122.491 +            </classpath>
 122.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 122.493 +                <filename name="**/*.java"/>
 122.494 +            </fileset>
 122.495 +        </javadoc>
 122.496 +    </target>
 122.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 122.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 122.499 +    </target>
 122.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 122.501 +    <!--
 122.502 +                =========================
 122.503 +                JUNIT COMPILATION SECTION
 122.504 +                =========================
 122.505 +            -->
 122.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 122.507 +        <mkdir dir="${build.test.classes.dir}"/>
 122.508 +    </target>
 122.509 +    <target name="-pre-compile-test">
 122.510 +        <!-- Empty placeholder for easier customization. -->
 122.511 +        <!-- You can override this target in the ../build.xml file. -->
 122.512 +    </target>
 122.513 +    <target if="do.depend.true" name="-compile-test-depend">
 122.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 122.515 +    </target>
 122.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 122.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 122.518 +        <copy todir="${build.test.classes.dir}">
 122.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 122.520 +        </copy>
 122.521 +    </target>
 122.522 +    <target name="-post-compile-test">
 122.523 +        <!-- Empty placeholder for easier customization. -->
 122.524 +        <!-- You can override this target in the ../build.xml file. -->
 122.525 +    </target>
 122.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 122.527 +    <target name="-pre-compile-test-single">
 122.528 +        <!-- Empty placeholder for easier customization. -->
 122.529 +        <!-- You can override this target in the ../build.xml file. -->
 122.530 +    </target>
 122.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 122.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 122.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 122.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
 122.535 +        <copy todir="${build.test.classes.dir}">
 122.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 122.537 +        </copy>
 122.538 +    </target>
 122.539 +    <target name="-post-compile-test-single">
 122.540 +        <!-- Empty placeholder for easier customization. -->
 122.541 +        <!-- You can override this target in the ../build.xml file. -->
 122.542 +    </target>
 122.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 122.544 +    <!--
 122.545 +                =======================
 122.546 +                JUNIT EXECUTION SECTION
 122.547 +                =======================
 122.548 +            -->
 122.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
 122.550 +        <mkdir dir="${build.test.results.dir}"/>
 122.551 +    </target>
 122.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 122.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
 122.554 +    </target>
 122.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 122.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 122.557 +    </target>
 122.558 +    <target depends="init" if="have.tests" name="test-report"/>
 122.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 122.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 122.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
 122.562 +        <mkdir dir="${build.test.results.dir}"/>
 122.563 +    </target>
 122.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 122.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 122.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
 122.567 +    </target>
 122.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 122.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 122.570 +    </target>
 122.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
 122.572 +    <!--
 122.573 +                =======================
 122.574 +                JUNIT DEBUGGING SECTION
 122.575 +                =======================
 122.576 +            -->
 122.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
 122.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 122.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
 122.580 +        <delete file="${test.report.file}"/>
 122.581 +        <mkdir dir="${build.test.results.dir}"/>
 122.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
 122.583 +            <customize>
 122.584 +                <syspropertyset>
 122.585 +                    <propertyref prefix="test-sys-prop."/>
 122.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
 122.587 +                </syspropertyset>
 122.588 +                <arg value="${test.class}"/>
 122.589 +                <arg value="showoutput=true"/>
 122.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 122.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
 122.592 +            </customize>
 122.593 +        </j2seproject3:debug>
 122.594 +    </target>
 122.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 122.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 122.597 +    </target>
 122.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 122.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 122.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 122.601 +    </target>
 122.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 122.603 +    <!--
 122.604 +                =========================
 122.605 +                APPLET EXECUTION SECTION
 122.606 +                =========================
 122.607 +            -->
 122.608 +    <target depends="init,compile-single" name="run-applet">
 122.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 122.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 122.611 +            <customize>
 122.612 +                <arg value="${applet.url}"/>
 122.613 +            </customize>
 122.614 +        </j2seproject1:java>
 122.615 +    </target>
 122.616 +    <!--
 122.617 +                =========================
 122.618 +                APPLET DEBUGGING  SECTION
 122.619 +                =========================
 122.620 +            -->
 122.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 122.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 122.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 122.624 +            <customize>
 122.625 +                <arg value="${applet.url}"/>
 122.626 +            </customize>
 122.627 +        </j2seproject3:debug>
 122.628 +    </target>
 122.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 122.630 +    <!--
 122.631 +                ===============
 122.632 +                CLEANUP SECTION
 122.633 +                ===============
 122.634 +            -->
 122.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
 122.636 +    <target depends="init" name="-do-clean">
 122.637 +        <delete dir="${build.dir}"/>
 122.638 +        <delete dir="${dist.dir}"/>
 122.639 +    </target>
 122.640 +    <target name="-post-clean">
 122.641 +        <!-- Empty placeholder for easier customization. -->
 122.642 +        <!-- You can override this target in the ../build.xml file. -->
 122.643 +    </target>
 122.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 122.645 +</project>
   123.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.2 +++ b/task1/solution11/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
   123.3 @@ -0,0 +1,8 @@
   123.4 +build.xml.data.CRC32=2ab820eb
   123.5 +build.xml.script.CRC32=58a52595
   123.6 +build.xml.stylesheet.CRC32=be360661
   123.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   123.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   123.9 +nbproject/build-impl.xml.data.CRC32=0e1e702f
  123.10 +nbproject/build-impl.xml.script.CRC32=6cbb076a
  123.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
   124.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.2 +++ b/task1/solution11/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
   124.3 @@ -0,0 +1,68 @@
   124.4 +application.title=currency
   124.5 +application.vendor=apidesign.org
   124.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
   124.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
   124.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
   124.9 +build.classes.dir=${build.dir}/classes
  124.10 +build.classes.excludes=**/*.java,**/*.form
  124.11 +# This directory is removed when the project is cleaned:
  124.12 +build.dir=build
  124.13 +build.generated.dir=${build.dir}/generated
  124.14 +# Only compile against the classpath explicitly listed here:
  124.15 +build.sysclasspath=ignore
  124.16 +build.test.classes.dir=${build.dir}/test/classes
  124.17 +build.test.results.dir=${build.dir}/test/results
  124.18 +debug.classpath=\
  124.19 +    ${run.classpath}
  124.20 +debug.test.classpath=\
  124.21 +    ${run.test.classpath}
  124.22 +# This directory is removed when the project is cleaned:
  124.23 +dist.dir=dist
  124.24 +dist.jar=${dist.dir}/currency.jar
  124.25 +dist.javadoc.dir=${dist.dir}/javadoc
  124.26 +excludes=
  124.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
  124.28 +file.reference.src-apifest08=..
  124.29 +includes=**
  124.30 +jar.compress=false
  124.31 +javac.classpath=
  124.32 +# Space-separated list of extra javac options
  124.33 +javac.compilerargs=-Xlint:unchecked
  124.34 +javac.deprecation=false
  124.35 +javac.source=1.5
  124.36 +javac.target=1.5
  124.37 +javac.test.classpath=\
  124.38 +    ${javac.classpath}:\
  124.39 +    ${build.classes.dir}:\
  124.40 +    ${file.reference.junit-4.4.jar}
  124.41 +javadoc.additionalparam=
  124.42 +javadoc.author=false
  124.43 +javadoc.encoding=
  124.44 +javadoc.noindex=false
  124.45 +javadoc.nonavbar=false
  124.46 +javadoc.notree=false
  124.47 +javadoc.private=false
  124.48 +javadoc.splitindex=true
  124.49 +javadoc.use=true
  124.50 +javadoc.version=false
  124.51 +javadoc.windowtitle=
  124.52 +jnlp.codebase.type=local
  124.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
  124.54 +jnlp.descriptor=application
  124.55 +jnlp.enabled=false
  124.56 +jnlp.offline-allowed=false
  124.57 +jnlp.signed=false
  124.58 +meta.inf.dir=${src.dir}/META-INF
  124.59 +platform.active=default_platform
  124.60 +run.classpath=\
  124.61 +    ${javac.classpath}:\
  124.62 +    ${build.classes.dir}
  124.63 +# Space-separated list of JVM arguments used when running the project
  124.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  124.65 +# or test-sys-prop.name=value to set system properties for unit tests):
  124.66 +run.jvmargs=
  124.67 +run.test.classpath=\
  124.68 +    ${javac.test.classpath}:\
  124.69 +    ${build.test.classes.dir}
  124.70 +src.dir=src
  124.71 +test.src.dir=test
   125.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   125.2 +++ b/task1/solution11/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
   125.3 @@ -0,0 +1,16 @@
   125.4 +<?xml version="1.0" encoding="UTF-8"?>
   125.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   125.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   125.7 +    <configuration>
   125.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   125.9 +            <name>Currency Convertor Solution 11</name>
  125.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  125.11 +            <source-roots>
  125.12 +                <root id="src.dir"/>
  125.13 +            </source-roots>
  125.14 +            <test-roots>
  125.15 +                <root id="test.src.dir"/>
  125.16 +            </test-roots>
  125.17 +        </data>
  125.18 +    </configuration>
  125.19 +</project>
   126.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   126.2 +++ b/task1/solution11/src/org/apidesign/apifest08/currency/Computer.java	Sun Sep 28 14:12:38 2008 +0200
   126.3 @@ -0,0 +1,65 @@
   126.4 +package org.apidesign.apifest08.currency;
   126.5 +
   126.6 +/**
   126.7 + * Interface declaring method for computing conversion.
   126.8 + * 
   126.9 + * Because of a vague definition of currency amount's type,
  126.10 + * the interface has a generic type.
  126.11 + * 
  126.12 + * @author ked
  126.13 + * @see http://wiki.apidesign.org/wiki/APIDesignPatterns:ResponseReply
  126.14 + */
  126.15 +interface Computer<AmountType> {
  126.16 +
  126.17 +    ComputerResponse<AmountType> compute(ComputerRequest<AmountType> request);
  126.18 +
  126.19 +    /**
  126.20 +     * 
  126.21 +     * @param <AmountType>
  126.22 +     */
  126.23 +    final class ComputerRequest<AmountType> {
  126.24 +
  126.25 +        private AmountType input;
  126.26 +        private AmountType inputCurrencyRatio;
  126.27 +        private AmountType outputCurrencyRatio;
  126.28 +
  126.29 +        AmountType getInput() {
  126.30 +            return input;
  126.31 +        }
  126.32 +
  126.33 +        void setInput(AmountType input) {
  126.34 +            this.input = input;
  126.35 +        }
  126.36 +
  126.37 +        AmountType getInputCurrencyRatio() {
  126.38 +            return inputCurrencyRatio;
  126.39 +        }
  126.40 +
  126.41 +        void setInputCurrencyRatio(AmountType inputCurrencyRatio) {
  126.42 +            this.inputCurrencyRatio = inputCurrencyRatio;
  126.43 +        }
  126.44 +
  126.45 +        AmountType getOutputCurrencyRatio() {
  126.46 +            return outputCurrencyRatio;
  126.47 +        }
  126.48 +
  126.49 +        void setOutputCurrencyRatio(AmountType outputCurrencyRatio) {
  126.50 +            this.outputCurrencyRatio = outputCurrencyRatio;
  126.51 +        }
  126.52 +    }
  126.53 +
  126.54 +    final class ComputerResponse<AmountType> {
  126.55 +
  126.56 +        private AmountType result;
  126.57 +
  126.58 +        AmountType getResult() {
  126.59 +            return result;
  126.60 +        }
  126.61 +
  126.62 +        void setResult(AmountType result) {
  126.63 +            this.result = result;
  126.64 +        }
  126.65 +    }
  126.66 +    
  126.67 +    
  126.68 +}
  126.69 \ No newline at end of file
   127.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   127.2 +++ b/task1/solution11/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
   127.3 @@ -0,0 +1,119 @@
   127.4 +package org.apidesign.apifest08.currency;
   127.5 +
   127.6 +import org.apidesign.apifest08.currency.Computer.ComputerRequest;
   127.7 +import org.apidesign.apifest08.currency.Computer.ComputerResponse;
   127.8 +
   127.9 +/**
  127.10 + * Convertor.
  127.11 + * 
  127.12 + * In Task 1's version provides conversion between currency values
  127.13 + * with amount stored in integer or double, that are identified
  127.14 + * with string value. Exchange rates are immutable.
  127.15 + * 
  127.16 + * @author ked
  127.17 + */
  127.18 +public final class Convertor<AmountType, IdentifierType> {
  127.19 +
  127.20 +    Computer<AmountType> computer;
  127.21 +    CurrencyValue<AmountType, IdentifierType> firstCurrencyExchangeRate;
  127.22 +    CurrencyValue<AmountType, IdentifierType> secondCurrencyExchangeRate;
  127.23 +
  127.24 +    Convertor(
  127.25 +            Computer<AmountType> computer,
  127.26 +            CurrencyValue<AmountType, IdentifierType> firstCurrencyExchangeRate,
  127.27 +            CurrencyValue<AmountType, IdentifierType> secondCurrencyExchangeRate) {
  127.28 +        this.computer = computer;
  127.29 +        this.firstCurrencyExchangeRate = firstCurrencyExchangeRate;
  127.30 +        this.secondCurrencyExchangeRate = secondCurrencyExchangeRate;
  127.31 +    }
  127.32 +
  127.33 +    /**
  127.34 +     * Convert an amount of the one currency to an amount of the another one currency
  127.35 +     * with respect to previously specified exchange rate.
  127.36 +     * 
  127.37 +     * @param currencyValue an amount of the one currency
  127.38 +     * @return an amount of the another one currency
  127.39 +     */
  127.40 +    public CurrencyValue<AmountType, IdentifierType> convert(CurrencyValue<AmountType, IdentifierType> currencyValue) {
  127.41 +        if (firstCurrencyExchangeRate.getIdentifier().equals(currencyValue.getIdentifier())) {
  127.42 +            ComputerRequest<AmountType> computerRequest = new ComputerRequest<AmountType>();
  127.43 +            computerRequest.setInput(currencyValue.getAmount());
  127.44 +            computerRequest.setInputCurrencyRatio(firstCurrencyExchangeRate.getAmount());
  127.45 +            computerRequest.setOutputCurrencyRatio(secondCurrencyExchangeRate.getAmount());
  127.46 +            ComputerResponse<AmountType> computerResponse = computer.compute(computerRequest);
  127.47 +
  127.48 +            return CurrencyValue.getCurrencyValue(
  127.49 +                    computerResponse.getResult(),
  127.50 +                    secondCurrencyExchangeRate.getIdentifier());
  127.51 +        } else if (secondCurrencyExchangeRate.getIdentifier().equals(currencyValue.getIdentifier())) {
  127.52 +            ComputerRequest<AmountType> computerRequest = new ComputerRequest<AmountType>();
  127.53 +            computerRequest.setInput(currencyValue.getAmount());
  127.54 +            computerRequest.setInputCurrencyRatio(secondCurrencyExchangeRate.getAmount());
  127.55 +            computerRequest.setOutputCurrencyRatio(firstCurrencyExchangeRate.getAmount());
  127.56 +            ComputerResponse<AmountType> computerResponse = computer.compute(computerRequest);
  127.57 +
  127.58 +            return CurrencyValue.getCurrencyValue(
  127.59 +                    computerResponse.getResult(),
  127.60 +                    firstCurrencyExchangeRate.getIdentifier());
  127.61 +        } else {
  127.62 +            throw new IllegalArgumentException("Inappropriate currency to convert!");
  127.63 +        }
  127.64 +    }
  127.65 +
  127.66 +    static <AmountType, IdentifierType> Convertor<AmountType, IdentifierType> getConvertor(
  127.67 +            Computer<AmountType> computer,
  127.68 +            CurrencyValue<AmountType, IdentifierType> firstCurrencyExchangeRate,
  127.69 +            CurrencyValue<AmountType, IdentifierType> secondCurrencyExchangeRate) {
  127.70 +        return new Convertor<AmountType, IdentifierType>(
  127.71 +                computer,
  127.72 +                firstCurrencyExchangeRate,
  127.73 +                secondCurrencyExchangeRate);
  127.74 +    }
  127.75 +    
  127.76 +    static final Computer<Double> DoubleComputer = new Computer<Double>() {
  127.77 +
  127.78 +        public ComputerResponse<Double> compute(ComputerRequest<Double> request) {
  127.79 +            ComputerResponse<Double> response = new ComputerResponse<Double>();
  127.80 +            response.setResult(request.getInput() * request.getOutputCurrencyRatio() / request.getInputCurrencyRatio());
  127.81 +            return response;
  127.82 +        }
  127.83 +    };
  127.84 +
  127.85 +    /**
  127.86 +     * Creates convertor for Double|String values with specified exchange rate
  127.87 +     * between two currencies.
  127.88 +     * 
  127.89 +     * @param firstCurrencyExchangeRate first currency
  127.90 +     * @param secondCurrencyExchangeRate second currency
  127.91 +     * @return convertor
  127.92 +     */
  127.93 +
  127.94 +    public static Convertor<Double, String> getConvertorDoubleString(
  127.95 +            CurrencyValue<Double, String> firstCurrencyExchangeRate,
  127.96 +            CurrencyValue<Double, String> secondCurrencyExchangeRate) {
  127.97 +        return getConvertor(DoubleComputer, firstCurrencyExchangeRate, secondCurrencyExchangeRate);
  127.98 +    }
  127.99 +    
 127.100 +    static final Computer<Integer> IntegerComputer = new Computer<Integer>() {
 127.101 +
 127.102 +        public ComputerResponse<Integer> compute(ComputerRequest<Integer> request) {
 127.103 +            ComputerResponse<Integer> response = new ComputerResponse<Integer>();
 127.104 +            response.setResult(request.getInput() * request.getOutputCurrencyRatio() / request.getInputCurrencyRatio());
 127.105 +            return response;
 127.106 +        }
 127.107 +    };
 127.108 +
 127.109 +    /**
 127.110 +     * Creates convertor for Integer|String values with specified exchange rate
 127.111 +     * between two currencies.
 127.112 +     * 
 127.113 +     * @param firstCurrencyExchangeRate first currency
 127.114 +     * @param secondCurrencyExchangeRate second currency
 127.115 +     * @return convertor
 127.116 +     */
 127.117 +    public static Convertor<Integer, String> getConvertorIntegerString(
 127.118 +            CurrencyValue<Integer, String> firstCurrencyExchangeRate,
 127.119 +            CurrencyValue<Integer, String> secondCurrencyExchangeRate) {
 127.120 +        return getConvertor(IntegerComputer, firstCurrencyExchangeRate, secondCurrencyExchangeRate);
 127.121 +    }
 127.122 +}
   128.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   128.2 +++ b/task1/solution11/src/org/apidesign/apifest08/currency/CurrencyValue.java	Sun Sep 28 14:12:38 2008 +0200
   128.3 @@ -0,0 +1,72 @@
   128.4 +package org.apidesign.apifest08.currency;
   128.5 +
   128.6 +import java.io.Serializable;
   128.7 +
   128.8 +/**
   128.9 + * Value class, holding an amount of the currency & an identifier of the currency.
  128.10 + * Designed to be an immutable.
  128.11 + * 
  128.12 + * Because of a vague definition of types of the both fields,
  128.13 + * the class has generic types, used as types of the fields.
  128.14 + * These types should be immutable classes, too.
  128.15 + * 
  128.16 + * @author ked
  128.17 + */
  128.18 +public final class CurrencyValue<AmountType, IdentifierType> implements Serializable {
  128.19 +
  128.20 +    private final AmountType amount;
  128.21 +    private final IdentifierType identifier;
  128.22 +
  128.23 +    private CurrencyValue(AmountType amount, IdentifierType identifier) {
  128.24 +        this.amount = amount;
  128.25 +        this.identifier = identifier;
  128.26 +    }
  128.27 +
  128.28 +    public AmountType getAmount() {
  128.29 +        return amount;
  128.30 +    }
  128.31 +
  128.32 +    public IdentifierType getIdentifier() {
  128.33 +        return identifier;
  128.34 +    }
  128.35 +
  128.36 +    @Override
  128.37 +    public boolean equals(Object obj) {
  128.38 +        if (obj == null) {
  128.39 +            return false;
  128.40 +        }
  128.41 +        if (getClass() != obj.getClass()) {
  128.42 +            return false;
  128.43 +        }
  128.44 +        final CurrencyValue other = (CurrencyValue) obj;
  128.45 +        if (this.amount != other.amount && (this.amount == null || !this.amount.equals(other.amount))) {
  128.46 +            return false;
  128.47 +        }
  128.48 +        if (this.identifier != other.identifier && (this.identifier == null || !this.identifier.equals(other.identifier))) {
  128.49 +            return false;
  128.50 +        }
  128.51 +        return true;
  128.52 +    }
  128.53 +
  128.54 +    @Override
  128.55 +    public int hashCode() {
  128.56 +        int hash = 7;
  128.57 +        hash = 97 * hash + (this.amount != null ? this.amount.hashCode() : 0);
  128.58 +        hash = 97 * hash + (this.identifier != null ? this.identifier.hashCode() : 0);
  128.59 +        return hash;
  128.60 +    }
  128.61 +
  128.62 +    /**
  128.63 +     * Creates new instance.
  128.64 +     * Generic types of the new instance are derived from types of the parameters.
  128.65 +     * 
  128.66 +     * @param <AmountType> type of the currency amount
  128.67 +     * @param <IdentifierType> type of the currency identifier
  128.68 +     * @param amount currency amount
  128.69 +     * @param identifier currency identifier
  128.70 +     * @return new instance
  128.71 +     */
  128.72 +    public static <AmountType, IdentifierType> CurrencyValue<AmountType, IdentifierType> getCurrencyValue(AmountType amount, IdentifierType identifier) {
  128.73 +        return new CurrencyValue<AmountType, IdentifierType>(amount, identifier);
  128.74 +    }
  128.75 +}
   129.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   129.2 +++ b/task1/solution11/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
   129.3 @@ -0,0 +1,99 @@
   129.4 +package org.apidesign.apifest08.test;
   129.5 +
   129.6 +import junit.framework.TestCase;
   129.7 +import org.apidesign.apifest08.currency.Convertor;
   129.8 +import org.apidesign.apifest08.currency.CurrencyValue;
   129.9 +
  129.10 +/** Finish the Convertor API, and then write bodies of methods inside
  129.11 + * of this class to match the given tasks. To fullfil your task, use the
  129.12 + * API define in the <code>org.apidesign.apifest08.currency</code> package.
  129.13 + * Do not you reflection, or other hacks as your code
  129.14 + * shall run without any runtime permissions.
  129.15 + */
  129.16 +public class Task1Test extends TestCase {
  129.17 +    public Task1Test(String testName) {
  129.18 +        super(testName);
  129.19 +    }
  129.20 +
  129.21 +    @Override
  129.22 +    protected void setUp() throws Exception {
  129.23 +    }
  129.24 +
  129.25 +    @Override
  129.26 +    protected void tearDown() throws Exception {
  129.27 +    }
  129.28 +
  129.29 +    /** Create convertor that understands two currencies, CZK and
  129.30 +     *  USD. Make 1 USD == 17 CZK.
  129.31 +     *
  129.32 +     * Creation of the convertor shall not require subclassing of any class
  129.33 +     * or interface on the client side.
  129.34 +     *
  129.35 +     * @return prepared convertor ready for converting USD to CZK and CZK to USD
  129.36 +     */
  129.37 +    public static Convertor<Integer, String> createCZKtoUSD() {
  129.38 +        return Convertor.getConvertorIntegerString(
  129.39 +                CurrencyValue.getCurrencyValue(1, "USD"),
  129.40 +                CurrencyValue.getCurrencyValue(17, "CZK")
  129.41 +        );
  129.42 +    }
  129.43 +
  129.44 +    /** Create convertor that understands two currencies, CZK and
  129.45 +     *  SKK. Make 100 SKK == 80 CZK.
  129.46 +     *
  129.47 +     * Creation of the convertor shall not require subclassing of any class
  129.48 +     * or interface on the client side.
  129.49 +     * 
  129.50 +     * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
  129.51 +     */
  129.52 +    public static Convertor<Integer, String> createSKKtoCZK() {
  129.53 +        return Convertor.getConvertorIntegerString(
  129.54 +                CurrencyValue.getCurrencyValue(100, "SKK"),
  129.55 +                CurrencyValue.getCurrencyValue(80, "CZK")
  129.56 +        );
  129.57 +    }
  129.58 +    
  129.59 +    /** Use the convertor from <code>createCZKtoUSD</code> method and do few conversions
  129.60 +     * with it.
  129.61 +     */
  129.62 +    public void testCurrencyCZKUSD() throws Exception {
  129.63 +        Convertor<Integer, String> c = createCZKtoUSD();
  129.64 +        
  129.65 +        CurrencyValue<Integer, String> result;
  129.66 +        
  129.67 +        // convert $5 to CZK using c:
  129.68 +        // assertEquals("Result is 85 CZK");
  129.69 +        result = c.convert(CurrencyValue.getCurrencyValue(5, "USD"));
  129.70 +        assertEquals(CurrencyValue.getCurrencyValue(85, "CZK"), result);
  129.71 +
  129.72 +        // convert $8 to CZK
  129.73 +        // assertEquals("Result is 136 CZK");
  129.74 +        result = c.convert(CurrencyValue.getCurrencyValue(8, "USD"));
  129.75 +        assertEquals(CurrencyValue.getCurrencyValue(136, "CZK"), result);
  129.76 +
  129.77 +        // convert 1003CZK to USD
  129.78 +        // assertEquals("Result is 59 USD");
  129.79 +        result = c.convert(CurrencyValue.getCurrencyValue(1003, "CZK"));
  129.80 +        assertEquals(CurrencyValue.getCurrencyValue(59, "USD"), result);
  129.81 +    }
  129.82 +
  129.83 +    /** Use the convertor from <code>createSKKtoCZK</code> method and do few conversions
  129.84 +     * with it.
  129.85 +     */
  129.86 +    public void testCurrencySKKCZK() throws Exception {
  129.87 +        Convertor<Integer, String> c = createSKKtoCZK();
  129.88 +        
  129.89 +        CurrencyValue<Integer, String> result;
  129.90 +        
  129.91 +        // convert 16CZK using c:
  129.92 +        // assertEquals("Result is 20 SKK");
  129.93 +        result = c.convert(CurrencyValue.getCurrencyValue(16, "CZK"));
  129.94 +        assertEquals(CurrencyValue.getCurrencyValue(20, "SKK"), result);
  129.95 +
  129.96 +        // convert 500SKK to CZK
  129.97 +        // assertEquals("Result is 400 CZK");
  129.98 +        result = c.convert(CurrencyValue.getCurrencyValue(500, "SKK"));
  129.99 +        assertEquals(CurrencyValue.getCurrencyValue(400, "CZK"), result);
 129.100 +    }
 129.101 +}
 129.102 +
   130.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.2 +++ b/task1/solution12/build.xml	Sun Sep 28 14:12:38 2008 +0200
   130.3 @@ -0,0 +1,69 @@
   130.4 +<?xml version="1.0" encoding="UTF-8"?>
   130.5 +<!-- You may freely edit this file. See commented blocks below for -->
   130.6 +<!-- some examples of how to customize the build. -->
   130.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   130.8 +<project name="currency" default="default" basedir=".">
   130.9 +    <description>Builds, tests, and runs the project.</description>
  130.10 +    <import file="nbproject/build-impl.xml"/>
  130.11 +    <!--
  130.12 +
  130.13 +    There exist several targets which are by default empty and which can be 
  130.14 +    used for execution of your tasks. These targets are usually executed 
  130.15 +    before and after some main targets. They are: 
  130.16 +
  130.17 +      -pre-init:                 called before initialization of project properties
  130.18 +      -post-init:                called after initialization of project properties
  130.19 +      -pre-compile:              called before javac compilation
  130.20 +      -post-compile:             called after javac compilation
  130.21 +      -pre-compile-single:       called before javac compilation of single file
  130.22 +      -post-compile-single:      called after javac compilation of single file
  130.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  130.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  130.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  130.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  130.27 +      -pre-jar:                  called before JAR building
  130.28 +      -post-jar:                 called after JAR building
  130.29 +      -post-clean:               called after cleaning build products
  130.30 +
  130.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  130.32 +
  130.33 +    Example of inserting an obfuscator after compilation could look like this:
  130.34 +
  130.35 +        <target name="-post-compile">
  130.36 +            <obfuscate>
  130.37 +                <fileset dir="${build.classes.dir}"/>
  130.38 +            </obfuscate>
  130.39 +        </target>
  130.40 +
  130.41 +    For list of available properties check the imported 
  130.42 +    nbproject/build-impl.xml file. 
  130.43 +
  130.44 +
  130.45 +    Another way to customize the build is by overriding existing main targets.
  130.46 +    The targets of interest are: 
  130.47 +
  130.48 +      -init-macrodef-javac:     defines macro for javac compilation
  130.49 +      -init-macrodef-junit:     defines macro for junit execution
  130.50 +      -init-macrodef-debug:     defines macro for class debugging
  130.51 +      -init-macrodef-java:      defines macro for class execution
  130.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  130.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  130.54 +      run:                      execution of project 
  130.55 +      -javadoc-build:           Javadoc generation
  130.56 +      test-report:              JUnit report generation
  130.57 +
  130.58 +    An example of overriding the target for project execution could look like this:
  130.59 +
  130.60 +        <target name="run" depends="currency-impl.jar">
  130.61 +            <exec dir="bin" executable="launcher.exe">
  130.62 +                <arg file="${dist.jar}"/>
  130.63 +            </exec>
  130.64 +        </target>
  130.65 +
  130.66 +    Notice that the overridden target depends on the jar target and not only on 
  130.67 +    the compile target as the regular run target does. Again, for a list of available 
  130.68 +    properties which you can use, check the target you are overriding in the
  130.69 +    nbproject/build-impl.xml file. 
  130.70 +
  130.71 +    -->
  130.72 +</project>
   131.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   131.2 +++ b/task1/solution12/nbproject/build-impl.xml	Sun Sep 28 14:12:38 2008 +0200
   131.3 @@ -0,0 +1,642 @@
   131.4 +<?xml version="1.0" encoding="UTF-8"?>
   131.5 +<!--
   131.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   131.7 +***         EDIT ../build.xml INSTEAD         ***
   131.8 +
   131.9 +For the purpose of easier reading the script
  131.10 +is divided into following sections:
  131.11 +
  131.12 +  - initialization
  131.13 +  - compilation
  131.14 +  - jar
  131.15 +  - execution
  131.16 +  - debugging
  131.17 +  - javadoc
  131.18 +  - junit compilation
  131.19 +  - junit execution
  131.20 +  - junit debugging
  131.21 +  - applet
  131.22 +  - cleanup
  131.23 +
  131.24 +        -->
  131.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Currency_Convertor_Solution_12-impl">
  131.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
  131.27 +    <!-- 
  131.28 +                ======================
  131.29 +                INITIALIZATION SECTION 
  131.30 +                ======================
  131.31 +            -->
  131.32 +    <target name="-pre-init">
  131.33 +        <!-- Empty placeholder for easier customization. -->
  131.34 +        <!-- You can override this target in the ../build.xml file. -->
  131.35 +    </target>
  131.36 +    <target depends="-pre-init" name="-init-private">
  131.37 +        <property file="nbproject/private/config.properties"/>
  131.38 +        <property file="nbproject/private/configs/${config}.properties"/>
  131.39 +        <property file="nbproject/private/private.properties"/>
  131.40 +    </target>
  131.41 +    <target depends="-pre-init,-init-private" name="-init-user">
  131.42 +        <property file="${user.properties.file}"/>
  131.43 +        <!-- The two properties below are usually overridden -->
  131.44 +        <!-- by the active platform. Just a fallback. -->
  131.45 +        <property name="default.javac.source" value="1.4"/>
  131.46 +        <property name="default.javac.target" value="1.4"/>
  131.47 +    </target>
  131.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
  131.49 +        <property file="nbproject/configs/${config}.properties"/>
  131.50 +        <property file="nbproject/project.properties"/>
  131.51 +    </target>
  131.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
  131.53 +        <available file="${manifest.file}" property="manifest.available"/>
  131.54 +        <condition property="manifest.available+main.class">
  131.55 +            <and>
  131.56 +                <isset property="manifest.available"/>
  131.57 +                <isset property="main.class"/>
  131.58 +                <not>
  131.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  131.60 +                </not>
  131.61 +            </and>
  131.62 +        </condition>
  131.63 +        <condition property="manifest.available+main.class+mkdist.available">
  131.64 +            <and>
  131.65 +                <istrue value="${manifest.available+main.class}"/>
  131.66 +                <isset property="libs.CopyLibs.classpath"/>
  131.67 +            </and>
  131.68 +        </condition>
  131.69 +        <condition property="have.tests">
  131.70 +            <or>
  131.71 +                <available file="${test.src.dir}"/>
  131.72 +            </or>
  131.73 +        </condition>
  131.74 +        <condition property="have.sources">
  131.75 +            <or>
  131.76 +                <available file="${src.dir}"/>
  131.77 +            </or>
  131.78 +        </condition>
  131.79 +        <condition property="netbeans.home+have.tests">
  131.80 +            <and>
  131.81 +                <isset property="netbeans.home"/>
  131.82 +                <isset property="have.tests"/>
  131.83 +            </and>
  131.84 +        </condition>
  131.85 +        <condition property="no.javadoc.preview">
  131.86 +            <and>
  131.87 +                <isset property="javadoc.preview"/>
  131.88 +                <isfalse value="${javadoc.preview}"/>
  131.89 +            </and>
  131.90 +        </condition>
  131.91 +        <property name="run.jvmargs" value=""/>
  131.92 +        <property name="javac.compilerargs" value=""/>
  131.93 +        <property name="work.dir" value="${basedir}"/>
  131.94 +        <condition property="no.deps">
  131.95 +            <and>
  131.96 +                <istrue value="${no.dependencies}"/>
  131.97 +            </and>
  131.98 +        </condition>
  131.99 +        <property name="javac.debug" value="true"/>
 131.100 +        <property name="javadoc.preview" value="true"/>
 131.101 +        <property name="application.args" value=""/>
 131.102 +        <property name="source.encoding" value="${file.encoding}"/>
 131.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
 131.104 +            <and>
 131.105 +                <isset property="javadoc.encoding"/>
 131.106 +                <not>
 131.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
 131.108 +                </not>
 131.109 +            </and>
 131.110 +        </condition>
 131.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
 131.112 +        <property name="includes" value="**"/>
 131.113 +        <property name="excludes" value=""/>
 131.114 +        <property name="do.depend" value="false"/>
 131.115 +        <condition property="do.depend.true">
 131.116 +            <istrue value="${do.depend}"/>
 131.117 +        </condition>
 131.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
 131.119 +            <and>
 131.120 +                <isset property="jaxws.endorsed.dir"/>
 131.121 +                <available file="nbproject/jaxws-build.xml"/>
 131.122 +            </and>
 131.123 +        </condition>
 131.124 +    </target>
 131.125 +    <target name="-post-init">
 131.126 +        <!-- Empty placeholder for easier customization. -->
 131.127 +        <!-- You can override this target in the ../build.xml file. -->
 131.128 +    </target>
 131.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
 131.130 +        <fail unless="src.dir">Must set src.dir</fail>
 131.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 131.132 +        <fail unless="build.dir">Must set build.dir</fail>
 131.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
 131.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 131.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 131.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 131.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 131.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 131.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
 131.140 +    </target>
 131.141 +    <target name="-init-macrodef-property">
 131.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 131.143 +            <attribute name="name"/>
 131.144 +            <attribute name="value"/>
 131.145 +            <sequential>
 131.146 +                <property name="@{name}" value="${@{value}}"/>
 131.147 +            </sequential>
 131.148 +        </macrodef>
 131.149 +    </target>
 131.150 +    <target name="-init-macrodef-javac">
 131.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 131.152 +            <attribute default="${src.dir}" name="srcdir"/>
 131.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
 131.154 +            <attribute default="${javac.classpath}" name="classpath"/>
 131.155 +            <attribute default="${includes}" name="includes"/>
 131.156 +            <attribute default="${excludes}" name="excludes"/>
 131.157 +            <attribute default="${javac.debug}" name="debug"/>
 131.158 +            <attribute default="" name="sourcepath"/>
 131.159 +            <element name="customize" optional="true"/>
 131.160 +            <sequential>
 131.161 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
 131.162 +                    <classpath>
 131.163 +                        <path path="@{classpath}"/>
 131.164 +                    </classpath>
 131.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
 131.166 +                    <customize/>
 131.167 +                </javac>
 131.168 +            </sequential>
 131.169 +        </macrodef>
 131.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
 131.171 +            <attribute default="${src.dir}" name="srcdir"/>
 131.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
 131.173 +            <attribute default="${javac.classpath}" name="classpath"/>
 131.174 +            <sequential>
 131.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
 131.176 +                    <classpath>
 131.177 +                        <path path="@{classpath}"/>
 131.178 +                    </classpath>
 131.179 +                </depend>
 131.180 +            </sequential>
 131.181 +        </macrodef>
 131.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
 131.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
 131.184 +            <sequential>
 131.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
 131.186 +                <pathconvert pathsep="," property="javac.includes.binary">
 131.187 +                    <path>
 131.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
 131.189 +                    </path>
 131.190 +                    <globmapper from="*.java" to="*.class"/>
 131.191 +                </pathconvert>
 131.192 +                <delete>
 131.193 +                    <files includes="${javac.includes.binary}"/>
 131.194 +                </delete>
 131.195 +            </sequential>
 131.196 +        </macrodef>
 131.197 +    </target>
 131.198 +    <target name="-init-macrodef-junit">
 131.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 131.200 +            <attribute default="${includes}" name="includes"/>
 131.201 +            <attribute default="${excludes}" name="excludes"/>
 131.202 +            <attribute default="**" name="testincludes"/>
 131.203 +            <sequential>
 131.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
 131.205 +                    <batchtest todir="${build.test.results.dir}">
 131.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
 131.207 +                            <filename name="@{testincludes}"/>
 131.208 +                        </fileset>
 131.209 +                    </batchtest>
 131.210 +                    <classpath>
 131.211 +                        <path path="${run.test.classpath}"/>
 131.212 +                    </classpath>
 131.213 +                    <syspropertyset>
 131.214 +                        <propertyref prefix="test-sys-prop."/>
 131.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
 131.216 +                    </syspropertyset>
 131.217 +                    <formatter type="brief" usefile="false"/>
 131.218 +                    <formatter type="xml"/>
 131.219 +                    <jvmarg line="${run.jvmargs}"/>
 131.220 +                </junit>
 131.221 +            </sequential>
 131.222 +        </macrodef>
 131.223 +    </target>
 131.224 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
 131.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 131.226 +            <attribute default="${main.class}" name="name"/>
 131.227 +            <attribute default="${debug.classpath}" name="classpath"/>
 131.228 +            <attribute default="" name="stopclassname"/>
 131.229 +            <sequential>
 131.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
 131.231 +                    <classpath>
 131.232 +                        <path path="@{classpath}"/>
 131.233 +                    </classpath>
 131.234 +                </nbjpdastart>
 131.235 +            </sequential>
 131.236 +        </macrodef>
 131.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 131.238 +            <attribute default="${build.classes.dir}" name="dir"/>
 131.239 +            <sequential>
 131.240 +                <nbjpdareload>
 131.241 +                    <fileset dir="@{dir}" includes="${fix.classes}">
 131.242 +                        <include name="${fix.includes}*.class"/>
 131.243 +                    </fileset>
 131.244 +                </nbjpdareload>
 131.245 +            </sequential>
 131.246 +        </macrodef>
 131.247 +    </target>
 131.248 +    <target name="-init-debug-args">
 131.249 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
 131.250 +        <condition property="have-jdk-older-than-1.4">
 131.251 +            <or>
 131.252 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
 131.253 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
 131.254 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
 131.255 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
 131.256 +            </or>
 131.257 +        </condition>
 131.258 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
 131.259 +            <istrue value="${have-jdk-older-than-1.4}"/>
 131.260 +        </condition>
 131.261 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
 131.262 +            <os family="windows"/>
 131.263 +        </condition>
 131.264 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
 131.265 +            <isset property="debug.transport"/>
 131.266 +        </condition>
 131.267 +    </target>
 131.268 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
 131.269 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 131.270 +            <attribute default="${main.class}" name="classname"/>
 131.271 +            <attribute default="${debug.classpath}" name="classpath"/>
 131.272 +            <element name="customize" optional="true"/>
 131.273 +            <sequential>
 131.274 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
 131.275 +                    <jvmarg line="${debug-args-line}"/>
 131.276 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
 131.277 +                    <jvmarg line="${run.jvmargs}"/>
 131.278 +                    <classpath>
 131.279 +                        <path path="@{classpath}"/>
 131.280 +                    </classpath>
 131.281 +                    <syspropertyset>
 131.282 +                        <propertyref prefix="run-sys-prop."/>
 131.283 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 131.284 +                    </syspropertyset>
 131.285 +                    <customize/>
 131.286 +                </java>
 131.287 +            </sequential>
 131.288 +        </macrodef>
 131.289 +    </target>
 131.290 +    <target name="-init-macrodef-java">
 131.291 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 131.292 +            <attribute default="${main.class}" name="classname"/>
 131.293 +            <element name="customize" optional="true"/>
 131.294 +            <sequential>
 131.295 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
 131.296 +                    <jvmarg line="${run.jvmargs}"/>
 131.297 +                    <classpath>
 131.298 +                        <path path="${run.classpath}"/>
 131.299 +                    </classpath>
 131.300 +                    <syspropertyset>
 131.301 +                        <propertyref prefix="run-sys-prop."/>
 131.302 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
 131.303 +                    </syspropertyset>
 131.304 +                    <customize/>
 131.305 +                </java>
 131.306 +            </sequential>
 131.307 +        </macrodef>
 131.308 +    </target>
 131.309 +    <target name="-init-presetdef-jar">
 131.310 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 131.311 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
 131.312 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 131.313 +            </jar>
 131.314 +        </presetdef>
 131.315 +    </target>
 131.316 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
 131.317 +    <!--
 131.318 +                ===================
 131.319 +                COMPILATION SECTION
 131.320 +                ===================
 131.321 +            -->
 131.322 +    <target depends="init" name="deps-jar" unless="no.deps"/>
 131.323 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
 131.324 +    <target depends="init" name="-check-automatic-build">
 131.325 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
 131.326 +    </target>
 131.327 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
 131.328 +        <antcall target="clean"/>
 131.329 +    </target>
 131.330 +    <target depends="init,deps-jar" name="-pre-pre-compile">
 131.331 +        <mkdir dir="${build.classes.dir}"/>
 131.332 +    </target>
 131.333 +    <target name="-pre-compile">
 131.334 +        <!-- Empty placeholder for easier customization. -->
 131.335 +        <!-- You can override this target in the ../build.xml file. -->
 131.336 +    </target>
 131.337 +    <target if="do.depend.true" name="-compile-depend">
 131.338 +        <j2seproject3:depend/>
 131.339 +    </target>
 131.340 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
 131.341 +        <j2seproject3:javac/>
 131.342 +        <copy todir="${build.classes.dir}">
 131.343 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 131.344 +        </copy>
 131.345 +    </target>
 131.346 +    <target name="-post-compile">
 131.347 +        <!-- Empty placeholder for easier customization. -->
 131.348 +        <!-- You can override this target in the ../build.xml file. -->
 131.349 +    </target>
 131.350 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
 131.351 +    <target name="-pre-compile-single">
 131.352 +        <!-- Empty placeholder for easier customization. -->
 131.353 +        <!-- You can override this target in the ../build.xml file. -->
 131.354 +    </target>
 131.355 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
 131.356 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 131.357 +        <j2seproject3:force-recompile/>
 131.358 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
 131.359 +    </target>
 131.360 +    <target name="-post-compile-single">
 131.361 +        <!-- Empty placeholder for easier customization. -->
 131.362 +        <!-- You can override this target in the ../build.xml file. -->
 131.363 +    </target>
 131.364 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
 131.365 +    <!--
 131.366 +                ====================
 131.367 +                JAR BUILDING SECTION
 131.368 +                ====================
 131.369 +            -->
 131.370 +    <target depends="init" name="-pre-pre-jar">
 131.371 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
 131.372 +        <mkdir dir="${dist.jar.dir}"/>
 131.373 +    </target>
 131.374 +    <target name="-pre-jar">
 131.375 +        <!-- Empty placeholder for easier customization. -->
 131.376 +        <!-- You can override this target in the ../build.xml file. -->
 131.377 +    </target>
 131.378 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
 131.379 +        <j2seproject1:jar/>
 131.380 +    </target>
 131.381 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
 131.382 +        <j2seproject1:jar manifest="${manifest.file}"/>
 131.383 +    </target>
 131.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
 131.385 +        <j2seproject1:jar manifest="${manifest.file}">
 131.386 +            <j2seproject1:manifest>
 131.387 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 131.388 +            </j2seproject1:manifest>
 131.389 +        </j2seproject1:jar>
 131.390 +        <echo>To run this application from the command line without Ant, try:</echo>
 131.391 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 131.392 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 131.393 +        <pathconvert property="run.classpath.with.dist.jar">
 131.394 +            <path path="${run.classpath}"/>
 131.395 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 131.396 +        </pathconvert>
 131.397 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 131.398 +    </target>
 131.399 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
 131.400 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 131.401 +        <pathconvert property="run.classpath.without.build.classes.dir">
 131.402 +            <path path="${run.classpath}"/>
 131.403 +            <map from="${build.classes.dir.resolved}" to=""/>
 131.404 +        </pathconvert>
 131.405 +        <pathconvert pathsep=" " property="jar.classpath">
 131.406 +            <path path="${run.classpath.without.build.classes.dir}"/>
 131.407 +            <chainedmapper>
 131.408 +                <flattenmapper/>
 131.409 +                <globmapper from="*" to="lib/*"/>
 131.410 +            </chainedmapper>
 131.411 +        </pathconvert>
 131.412 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
 131.413 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
 131.414 +            <fileset dir="${build.classes.dir}"/>
 131.415 +            <manifest>
 131.416 +                <attribute name="Main-Class" value="${main.class}"/>
 131.417 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 131.418 +            </manifest>
 131.419 +        </copylibs>
 131.420 +        <echo>To run this application from the command line without Ant, try:</echo>
 131.421 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
 131.422 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 131.423 +    </target>
 131.424 +    <target name="-post-jar">
 131.425 +        <!-- Empty placeholder for easier customization. -->
 131.426 +        <!-- You can override this target in the ../build.xml file. -->
 131.427 +    </target>
 131.428 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
 131.429 +    <!--
 131.430 +                =================
 131.431 +                EXECUTION SECTION
 131.432 +                =================
 131.433 +            -->
 131.434 +    <target depends="init,compile" description="Run a main class." name="run">
 131.435 +        <j2seproject1:java>
 131.436 +            <customize>
 131.437 +                <arg line="${application.args}"/>
 131.438 +            </customize>
 131.439 +        </j2seproject1:java>
 131.440 +    </target>
 131.441 +    <target name="-do-not-recompile">
 131.442 +        <property name="javac.includes.binary" value=""/>
 131.443 +    </target>
 131.444 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
 131.445 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 131.446 +        <j2seproject1:java classname="${run.class}"/>
 131.447 +    </target>
 131.448 +    <!--
 131.449 +                =================
 131.450 +                DEBUGGING SECTION
 131.451 +                =================
 131.452 +            -->
 131.453 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 131.454 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 131.455 +    </target>
 131.456 +    <target depends="init,compile" name="-debug-start-debuggee">
 131.457 +        <j2seproject3:debug>
 131.458 +            <customize>
 131.459 +                <arg line="${application.args}"/>
 131.460 +            </customize>
 131.461 +        </j2seproject3:debug>
 131.462 +    </target>
 131.463 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 131.464 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 131.465 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 131.466 +    </target>
 131.467 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 131.468 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 131.469 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 131.470 +        <j2seproject3:debug classname="${debug.class}"/>
 131.471 +    </target>
 131.472 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 131.473 +    <target depends="init" name="-pre-debug-fix">
 131.474 +        <fail unless="fix.includes">Must set fix.includes</fail>
 131.475 +        <property name="javac.includes" value="${fix.includes}.java"/>
 131.476 +    </target>
 131.477 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 131.478 +        <j2seproject1:nbjpdareload/>
 131.479 +    </target>
 131.480 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 131.481 +    <!--
 131.482 +                ===============
 131.483 +                JAVADOC SECTION
 131.484 +                ===============
 131.485 +            -->
 131.486 +    <target depends="init" name="-javadoc-build">
 131.487 +        <mkdir dir="${dist.javadoc.dir}"/>
 131.488 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
 131.489 +            <classpath>
 131.490 +                <path path="${javac.classpath}"/>
 131.491 +            </classpath>
 131.492 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 131.493 +                <filename name="**/*.java"/>
 131.494 +            </fileset>
 131.495 +        </javadoc>
 131.496 +    </target>
 131.497 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 131.498 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 131.499 +    </target>
 131.500 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 131.501 +    <!--
 131.502 +                =========================
 131.503 +                JUNIT COMPILATION SECTION
 131.504 +                =========================
 131.505 +            -->
 131.506 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 131.507 +        <mkdir dir="${build.test.classes.dir}"/>
 131.508 +    </target>
 131.509 +    <target name="-pre-compile-test">
 131.510 +        <!-- Empty placeholder for easier customization. -->
 131.511 +        <!-- You can override this target in the ../build.xml file. -->
 131.512 +    </target>
 131.513 +    <target if="do.depend.true" name="-compile-test-depend">
 131.514 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 131.515 +    </target>
 131.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 131.517 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 131.518 +        <copy todir="${build.test.classes.dir}">
 131.519 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 131.520 +        </copy>
 131.521 +    </target>
 131.522 +    <target name="-post-compile-test">
 131.523 +        <!-- Empty placeholder for easier customization. -->
 131.524 +        <!-- You can override this target in the ../build.xml file. -->
 131.525 +    </target>
 131.526 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 131.527 +    <target name="-pre-compile-test-single">
 131.528 +        <!-- Empty placeholder for easier customization. -->
 131.529 +        <!-- You can override this target in the ../build.xml file. -->
 131.530 +    </target>
 131.531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 131.532 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 131.533 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 131.534 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
 131.535 +        <copy todir="${build.test.classes.dir}">
 131.536 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 131.537 +        </copy>
 131.538 +    </target>
 131.539 +    <target name="-post-compile-test-single">
 131.540 +        <!-- Empty placeholder for easier customization. -->
 131.541 +        <!-- You can override this target in the ../build.xml file. -->
 131.542 +    </target>
 131.543 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 131.544 +    <!--
 131.545 +                =======================
 131.546 +                JUNIT EXECUTION SECTION
 131.547 +                =======================
 131.548 +            -->
 131.549 +    <target depends="init" if="have.tests" name="-pre-test-run">
 131.550 +        <mkdir dir="${build.test.results.dir}"/>
 131.551 +    </target>
 131.552 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 131.553 +        <j2seproject3:junit testincludes="**/*Test.java"/>
 131.554 +    </target>
 131.555 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 131.556 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 131.557 +    </target>
 131.558 +    <target depends="init" if="have.tests" name="test-report"/>
 131.559 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 131.560 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 131.561 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
 131.562 +        <mkdir dir="${build.test.results.dir}"/>
 131.563 +    </target>
 131.564 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 131.565 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 131.566 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
 131.567 +    </target>
 131.568 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 131.569 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 131.570 +    </target>
 131.571 +    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
 131.572 +    <!--
 131.573 +                =======================
 131.574 +                JUNIT DEBUGGING SECTION
 131.575 +                =======================
 131.576 +            -->
 131.577 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
 131.578 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 131.579 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
 131.580 +        <delete file="${test.report.file}"/>
 131.581 +        <mkdir dir="${build.test.results.dir}"/>
 131.582 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
 131.583 +            <customize>
 131.584 +                <syspropertyset>
 131.585 +                    <propertyref prefix="test-sys-prop."/>
 131.586 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
 131.587 +                </syspropertyset>
 131.588 +                <arg value="${test.class}"/>
 131.589 +                <arg value="showoutput=true"/>
 131.590 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 131.591 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
 131.592 +            </customize>
 131.593 +        </j2seproject3:debug>
 131.594 +    </target>
 131.595 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 131.596 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 131.597 +    </target>
 131.598 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 131.599 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 131.600 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 131.601 +    </target>
 131.602 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 131.603 +    <!--
 131.604 +                =========================
 131.605 +                APPLET EXECUTION SECTION
 131.606 +                =========================
 131.607 +            -->
 131.608 +    <target depends="init,compile-single" name="run-applet">
 131.609 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 131.610 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 131.611 +            <customize>
 131.612 +                <arg value="${applet.url}"/>
 131.613 +            </customize>
 131.614 +        </j2seproject1:java>
 131.615 +    </target>
 131.616 +    <!--
 131.617 +                =========================
 131.618 +                APPLET DEBUGGING  SECTION
 131.619 +                =========================
 131.620 +            -->
 131.621 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 131.622 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 131.623 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 131.624 +            <customize>
 131.625 +                <arg value="${applet.url}"/>
 131.626 +            </customize>
 131.627 +        </j2seproject3:debug>
 131.628 +    </target>
 131.629 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 131.630 +    <!--
 131.631 +                ===============
 131.632 +                CLEANUP SECTION
 131.633 +                ===============
 131.634 +            -->
 131.635 +    <target depends="init" name="deps-clean" unless="no.deps"/>
 131.636 +    <target depends="init" name="-do-clean">
 131.637 +        <delete dir="${build.dir}"/>
 131.638 +        <delete dir="${dist.dir}"/>
 131.639 +    </target>
 131.640 +    <target name="-post-clean">
 131.641 +        <!-- Empty placeholder for easier customization. -->
 131.642 +        <!-- You can override this target in the ../build.xml file. -->
 131.643 +    </target>
 131.644 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 131.645 +</project>
   132.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   132.2 +++ b/task1/solution12/nbproject/genfiles.properties	Sun Sep 28 14:12:38 2008 +0200
   132.3 @@ -0,0 +1,8 @@
   132.4 +build.xml.data.CRC32=2ab820eb
   132.5 +build.xml.script.CRC32=58a52595
   132.6 +build.xml.stylesheet.CRC32=be360661
   132.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   132.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   132.9 +nbproject/build-impl.xml.data.CRC32=b63e115b
  132.10 +nbproject/build-impl.xml.script.CRC32=3bdfc4fa
  132.11 +nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5
   133.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   133.2 +++ b/task1/solution12/nbproject/project.properties	Sun Sep 28 14:12:38 2008 +0200
   133.3 @@ -0,0 +1,68 @@
   133.4 +application.title=currency
   133.5 +application.vendor=apidesign.org
   133.6 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
   133.7 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
   133.8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
   133.9 +build.classes.dir=${build.dir}/classes
  133.10 +build.classes.excludes=**/*.java,**/*.form
  133.11 +# This directory is removed when the project is cleaned:
  133.12 +build.dir=build
  133.13 +build.generated.dir=${build.dir}/generated
  133.14 +# Only compile against the classpath explicitly listed here:
  133.15 +build.sysclasspath=ignore
  133.16 +build.test.classes.dir=${build.dir}/test/classes
  133.17 +build.test.results.dir=${build.dir}/test/results
  133.18 +debug.classpath=\
  133.19 +    ${run.classpath}
  133.20 +debug.test.classpath=\
  133.21 +    ${run.test.classpath}
  133.22 +# This directory is removed when the project is cleaned:
  133.23 +dist.dir=dist
  133.24 +dist.jar=${dist.dir}/currency.jar
  133.25 +dist.javadoc.dir=${dist.dir}/javadoc
  133.26 +excludes=
  133.27 +file.reference.junit-4.4.jar=../libs/junit-4.4.jar
  133.28 +file.reference.src-apifest08=..
  133.29 +includes=**
  133.30 +jar.compress=false
  133.31 +javac.classpath=
  133.32 +# Space-separated list of extra javac options
  133.33 +javac.compilerargs=
  133.34 +javac.deprecation=false
  133.35 +javac.source=1.5
  133.36 +javac.target=1.5
  133.37 +javac.test.classpath=\
  133.38 +    ${javac.classpath}:\
  133.39 +    ${build.classes.dir}:\
  133.40 +    ${file.reference.junit-4.4.jar}
  133.41 +javadoc.additionalparam=
  133.42 +javadoc.author=false
  133.43 +javadoc.encoding=
  133.44 +javadoc.noindex=false
  133.45 +javadoc.nonavbar=false
  133.46 +javadoc.notree=false
  133.47 +javadoc.private=false
  133.48 +javadoc.splitindex=true
  133.49 +javadoc.use=true
  133.50 +javadoc.version=false
  133.51 +javadoc.windowtitle=
  133.52 +jnlp.codebase.type=local
  133.53 +jnlp.codebase.url=file:/home/jarda/src/apifest08/currency/dist
  133.54 +jnlp.descriptor=application
  133.55 +jnlp.enabled=false
  133.56 +jnlp.offline-allowed=false
  133.57 +jnlp.signed=false
  133.58 +meta.inf.dir=${src.dir}/META-INF
  133.59 +platform.active=default_platform
  133.60 +run.classpath=\
  133.61 +    ${javac.classpath}:\
  133.62 +    ${build.classes.dir}
  133.63 +# Space-separated list of JVM arguments used when running the project
  133.64 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  133.65 +# or test-sys-prop.name=value to set system properties for unit tests):
  133.66 +run.jvmargs=
  133.67 +run.test.classpath=\
  133.68 +    ${javac.test.classpath}:\
  133.69 +    ${build.test.classes.dir}
  133.70 +src.dir=src
  133.71 +test.src.dir=test
   134.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   134.2 +++ b/task1/solution12/nbproject/project.xml	Sun Sep 28 14:12:38 2008 +0200
   134.3 @@ -0,0 +1,16 @@
   134.4 +<?xml version="1.0" encoding="UTF-8"?>
   134.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   134.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   134.7 +    <configuration>
   134.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   134.9 +            <name>Currency Convertor Solution 12</name>
  134.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  134.11 +            <source-roots>
  134.12 +                <root id="src.dir"/>
  134.13 +            </source-roots>
  134.14 +            <test-roots>
  134.15 +                <root id="test.src.dir"/>
  134.16 +            </test-roots>
  134.17 +        </data>
  134.18 +    </configuration>
  134.19 +</project>
   135.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   135.2 +++ b/task1/solution12/src/org/apidesign/apifest08/currency/Convertor.java	Sun Sep 28 14:12:38 2008 +0200
   135.3 @@ -0,0 +1,110 @@
   135.4 +package org.apidesign.apifest08.currency;
   135.5 +
   135.6 +import java.util.Currency;
   135.7 +
   135.8 +/**
   135.9 + * This is the skeleton class for your API. You need to make it public, so it is accessible to your client code
  135.10 + * (currently in Task1Test.java) file.
  135.11 + * <p>
  135.12 + * Feel free to create additional classes or rename this one, just keep all the API and its implementation in this
  135.13 + * package. Do not spread it outside to other packages.
  135.14 + */
  135.15 +public class Convertor {
  135.16 +
  135.17 +  private Currency currency1;
  135.18 +  private Currency currency2;
  135.19 +
  135.20 +  private Convertor(Currency currency1, Currency currency2) {
  135.21 +    this.currency1 = currency1;
  135.22 +    this.currency2 = currency2;
  135.23 +  }
  135.24 +
  135.25 +  /**
  135.26 +   * Creates new instance of convertor.
  135.27 +   * @param currency1
  135.28 +   *          one of the currencies we want to convert to/from
  135.29 +   * @param currency2
  135.30 +   *          the other currency
  135.31 +   * @return new instance of convertor
  135.32 +   */
  135.33 +  public static Convertor getConvertorInstance(Currency currency1, Currency currency2) {
  135.34 +    if (currency1 == null || currency2 == null)
  135.35 +      throw new ConvertorException("None of the currencies should be null!!!");
  135.36 +    return new Convertor(currency1, currency2);
  135.37 +  }
  135.38 +
  135.39 +  /**
  135.40 +   * Converts selected amout of selected currency to other currency of this convertor instance.
  135.41 +   * @param amount
  135.42 +   *          amount to convert
  135.43 +   * @param actualCurrency
  135.44 +   *          currency of this amount
  135.45 +   * @return converted amount
  135.46 +   */
  135.47 +  public double convert(double amount, Currency actualCurrency) {
  135.48 +    ExchangeRate exchangeRate = null;
  135.49 +
  135.50 +    if (actualCurrency == null) {
  135.51 +      throw new ConvertorException("Selected currency is null!!!");
  135.52 +    }
  135.53 +
  135.54 +    if (currency1.getSymbol().equals(actualCurrency.getSymbol())
  135.55 +        || currency2.getSymbol().equals(actualCurrency.getSymbol())) {
  135.56 +      exchangeRate = getExchangeRate(actualCurrency);
  135.57 +    } else {
  135.58 +      throw new ConvertorException("This convertor could not be used for selected currency("
  135.59 +          + actualCurrency.getCurrencyCode() + ") " + this + "!!!");
  135.60 +    }
  135.61 +
  135.62 +    return countResult(exchangeRate, amount);
  135.63 +  }
  135.64 +
  135.65 +  private double countResult(ExchangeRate exchangeRate, double amount) {
  135.66 +    return amount * exchangeRate.getRate() / exchangeRate.getUnit();
  135.67 +  }
  135.68 +
  135.69 +  /**
  135.70 +   * Decides the direction of conversion and returns instance of actual exchange rate.
  135.71 +   * @param actualCurrency
  135.72 +   *          actual currency we want to convert
  135.73 +   * @return actual exchange rate of this convertor for selected currency
  135.74 +   */
  135.75 +  private ExchangeRate getExchangeRate(Currency actualCurrency) {
  135.76 +    ExchangeRate exchangeRate = null;
  135.77 +
  135.78 +    if (actualCurrency.getCurrencyCode().equals(currency1.getCurrencyCode())) {
  135.79 +      exchangeRate = getExchangeRateInstance(actualCurrency, currency2);
  135.80 +    } else if (actualCurrency.getCurrencyCode().equals(currency2.getCurrencyCode())) {
  135.81 +      exchangeRate = getExchangeRateInstance(actualCurrency, currency1);
  135.82 +    }
  135.83 +
  135.84 +    return exchangeRate;
  135.85 +  }
  135.86 +
  135.87 +  /**
  135.88 +   * Returns actual exchange rate between original and destination currency.
  135.89 +   * @param originalCurrency
  135.90 +   *          original currency, from which we want to convert
  135.91 +   * @param newCurrency
  135.92 +   *          destination currency, to which we want to convert
  135.93 +   * @return exchange rate between this two currencies
  135.94 +   */
  135.95 +  private ExchangeRate getExchangeRateInstance(Currency originalCurrency, Currency newCurrency) {
  135.96 +    if ("USD".equals(originalCurrency.getCurrencyCode()) && "CZK".equals(newCurrency.getCurrencyCode())) {
  135.97 +      return new ExchangeRate(originalCurrency, newCurrency, 17d, 1d);
  135.98 +    } else if ("CZK".equals(originalCurrency.getCurrencyCode()) && "USD".equals(newCurrency.getCurrencyCode())) {
  135.99 +      return new ExchangeRate(originalCurrency, newCurrency, 1d / 17d, 1d);
 135.100 +    } else if ("SKK".equals(originalCurrency.getCurrencyCode()) && "CZK".equals(newCurrency.getCurrencyCode())) {
 135.101 +      return new ExchangeRate(originalCurrency, newCurrency, 80d, 100d);
 135.102 +    } else if ("CZK".equals(originalCurrency.getCurrencyCode()) && "SKK".equals(newCurrency.getCurrencyCode())) {
 135.103 +      return new ExchangeRate(originalCurrency, newCurrency, 100d / (80d / 100d), 100d);
 135.104 +    } else {
 135.105 +      throw new ConvertorException("Defined currencies don't have secified rates ["
 135.106 +          + originalCurrency.getCurrencyCode() + ", " + newCurrency.getCurrencyCode() + "]!!!");
 135.107 +    }
 135.108 +  }
 135.109 +
 135.110 +  public String toString() {
 135.111 +    return "Converter [" + currency1.getCurrencyCode() + ", " + currency2.getCurrencyCode() + "]";
 135.112 +  }
 135.113 +}
   136.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   136.2 +++ b/task1/solution12/src/org/apidesign/apifest08/currency/ConvertorException.java	Sun Sep 28 14:12:38 2008 +0200
   136.3 @@ -0,0 +1,20 @@
   136.4 +package org.apidesign.apifest08.currency;
   136.5 +
   136.6 +public class ConvertorException extends RuntimeException {
   136.7 +
   136.8 +  public ConvertorException() {
   136.9 +  }
  136.10 +
  136.11 +  public ConvertorException(String message) {
  136.12 +    super(message);
  136.13 +  }
  136.14 +
  136.15 +  public ConvertorException(Throwable cause) {
  136.16 +    super(cause);
  136.17 +  }
  136.18 +
  136.19 +  public ConvertorException(String message, Throwable cause) {
  136.20 +    super(message, cause);
  136.21 +  }
  136.22 +
  136.23 +}
   137.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   137.2 +++ b/task1/solution12/src/org/apidesign/apifest08/currency/ExchangeRate.java	Sun Sep 28 14:12:38 2008 +0200
   137.3 @@ -0,0 +1,35 @@
   137.4 +package org.apidesign.apifest08.currency;
   137.5 +
   137.6 +import java.util.Currency;
   137.7 +
   137.8 +public class ExchangeRate {
   137.9 +
  137.10 +  private Currency originalCurrency;
  137.11 +  private Currency newCurrency;
  137.12 +  private double unit;
  137.13 +  private double rate;
  137.14 +
  137.15 +  public ExchangeRate(Currency originalCurrency, Currency newCurrency, double rate, double unit) {
  137.16 +    this.newCurrency = newCurrency;
  137.17 +    this.originalCurrency = originalCurrency;
  137.18 +    this.rate = rate;
  137.19 +    this.unit = unit;
  137.20 +  }
  137.21 +
  137.22 +  public Currency getOriginalCurrency() {
  137.23 +    return originalCurrency;
  137.24 +  }
  137.25 +
  137.26 +  public Currency getNewCurrency() {
  137.27 +    return newCurrency;
  137.28 +  }
  137.29 +
  137.30 +  public double getUnit() {
  137.31 +    return unit;
  137.32 +  }
  137.33 +
  137.34 +  public double getRate() {
  137.35 +    return rate;
  137.36 +  }
  137.37 +
  137.38 +}
   138.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   138.2 +++ b/task1/solution12/test/org/apidesign/apifest08/test/Task1Test.java	Sun Sep 28 14:12:38 2008 +0200
   138.3 @@ -0,0 +1,78 @@
   138.4 +package org.apidesign.apifest08.test;
   138.5 +
   138.6 +import java.util.Currency;
   138.7 +
   138.8 +import junit.framework.TestCase;
   138.9 +
  138.10 +import org.apidesign.apifest08.currency.Convertor;
  138.11 +
  138.12 +/**
  138.13 + * Finish the Convertor API, and then write bodies of methods inside of this class to match the given tasks. To fullfil
  138.14 + * your task, use the API define in the <code>org.apidesign.apifest08.currency</code> package. Do not you reflection, or
  138.15 + * other hacks as your code shall run without any runtime permissions.
  138.16 + */
  138.17 +public class Task1Test extends TestCase {
  138.18 +  public Task1Test(String testName) {
  138.19 +    super(testName);
  138.20 +  }
  138.21 +
  138.22 +  @Override
  138.23 +  protected void setUp() throws Exception {
  138.24 +  }
  138.25 +
  138.26 +  @Override
  138.27 +  protected void tearDown() throws Exception {
  138.28 +  }
  138.29 +
  138.30 +  /**
  138.31 +   * Create convertor that understands two currencies, CZK and USD. Make 1 USD == 17 CZK. Creation of the convertor
  138.32 +   * shall not require subclassing of any class or interface on the client side.
  138.33 +   * @return prepared convertor ready for converting USD to CZK and CZK to USD
  138.34 +   */
  138.35 +  public static Convertor createCZKtoUSD() {
  138.36 +    return Convertor.getConvertorInstance(Currency.getInstance("CZK"), Currency.getInstance("USD"));
  138.37 +  }
  138.38 +
  138.39 +  /**
  138.40 +   * Create convertor that understands two currencies, CZK and SKK. Make 100 SKK == 80 CZK. Creation of the convertor
  138.41 +   * shall not require subclassing of any class or interface on the client side.
  138.42 +   * @return prepared convertor ready for converting SKK to CZK and CZK to SKK
  138.43 +   */
  138.44 +  public static Convertor createSKKtoCZK() {
  138.45 +    return Convertor.getConvertorInstance(Currency.getInstance("SKK"), Currency.getInstance("CZK"));
  138.46 +  }
  138.47 +
  138.48 +  /**
  138.49 +   * Use the convertor from <code>createCZKtoUSD</code> method and do few conversions with it.
  138.50 +   */
  138.51 +  public void testCurrencyCZKUSD() throws Exception {
  138.52 +    Convertor c = createCZKtoUSD();
  138.53 +
  138.54 +    // convert $5 to CZK using c:
  138.55 +    double result = c.convert(5, Currency.getInstance("USD"));
  138.56 +    assertEquals("Result is not 85 CZK", 85.0, result);
  138.57 +
  138.58 +    // convert $8 to CZK
  138.59 +    result = c.convert(8, Currency.getInstance("USD"));
  138.60 +    assertEquals("Result is not 136 CZK", 136.0, result);
  138.61 +
  138.62 +    // convert 1003CZK to USD
  138.63 +    result = c.convert(1003, Currency.getInstance("CZK"));
  138.64 +    assertEquals("Result is not 59 USD", 59.0, result);
  138.65 +  }
  138.66 +
  138.67 +  /**
  138.68 +   * Use the convertor from <code>createSKKtoCZK</code> method and do few conversions with it.
  138.69 +   */
  138.70 +  public void testCurrencySKKCZK() throws Exception {
  138.71 +    Convertor c = createSKKtoCZK();
  138.72 +
  138.73 +    // convert 16CZK using c:
  138.74 +    double result = c.convert(16, Currency.getInstance("CZK"));
  138.75 +    assertEquals("Result is not 20 SKK", 20.0, result);
  138.76 +
  138.77 +    // convert 500SKK to CZK
  138.78 +    result = c.convert(500, Currency.getInstance("SKK"));
  138.79 +    assertEquals("Result is not 400 CZK", 400.0, result);
  138.80 +  }
  138.81 +}