Adding samples from API fest to the repository, including pieces of their code in the document, not just links
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:52:45 +0200
changeset 524257f4cf226b
parent 51 130e099942d8
child 53 a0b47629aad8
Adding samples from API fest to the repository, including pieces of their code in the document, not just links
samples/apifest1/boolcircuit/build.xml
samples/apifest1/boolcircuit/nbproject/build-impl.xml
samples/apifest1/boolcircuit/nbproject/genfiles.properties
samples/apifest1/boolcircuit/nbproject/project.properties
samples/apifest1/boolcircuit/nbproject/project.xml
samples/apifest1/boolcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/alwayscreatenewcircuit/build.xml
samples/apifest1/day1/alwayscreatenewcircuit/nbproject/build-impl.xml
samples/apifest1/day1/alwayscreatenewcircuit/nbproject/genfiles.properties
samples/apifest1/day1/alwayscreatenewcircuit/nbproject/project.properties
samples/apifest1/day1/alwayscreatenewcircuit/nbproject/project.xml
samples/apifest1/day1/alwayscreatenewcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/elementbasedsolution/build.xml
samples/apifest1/day1/elementbasedsolution/nbproject/build-impl.xml
samples/apifest1/day1/elementbasedsolution/nbproject/genfiles.properties
samples/apifest1/day1/elementbasedsolution/nbproject/project.properties
samples/apifest1/day1/elementbasedsolution/nbproject/project.xml
samples/apifest1/day1/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/inputandoperation/build.xml
samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml
samples/apifest1/day1/inputandoperation/nbproject/genfiles.properties
samples/apifest1/day1/inputandoperation/nbproject/project.properties
samples/apifest1/day1/inputandoperation/nbproject/project.xml
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/AndOperation.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/BooleanInput.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Factory.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Input.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/NotOperation.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Operation.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/OperationInput.java
samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/OrOperation.java
samples/apifest1/day1/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/parsingsolution/build.xml
samples/apifest1/day1/parsingsolution/nbproject/build-impl.xml
samples/apifest1/day1/parsingsolution/nbproject/genfiles.properties
samples/apifest1/day1/parsingsolution/nbproject/project.properties
samples/apifest1/day1/parsingsolution/nbproject/project.xml
samples/apifest1/day1/parsingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/parsingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/pinbasedsolution/build.xml
samples/apifest1/day1/pinbasedsolution/nbproject/build-impl.xml
samples/apifest1/day1/pinbasedsolution/nbproject/genfiles.properties
samples/apifest1/day1/pinbasedsolution/nbproject/project.properties
samples/apifest1/day1/pinbasedsolution/nbproject/project.xml
samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java
samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/UnstableException.java
samples/apifest1/day1/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/stackbasedsolution/build.xml
samples/apifest1/day1/stackbasedsolution/nbproject/build-impl.xml
samples/apifest1/day1/stackbasedsolution/nbproject/genfiles.properties
samples/apifest1/day1/stackbasedsolution/nbproject/project.properties
samples/apifest1/day1/stackbasedsolution/nbproject/project.xml
samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/CircuitFactory.java
samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Operation.java
samples/apifest1/day1/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/subclassingsolution/build.xml
samples/apifest1/day1/subclassingsolution/nbproject/build-impl.xml
samples/apifest1/day1/subclassingsolution/nbproject/genfiles.properties
samples/apifest1/day1/subclassingsolution/nbproject/project.properties
samples/apifest1/day1/subclassingsolution/nbproject/project.xml
samples/apifest1/day1/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/subclassingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day1/welltestedsolution/build.xml
samples/apifest1/day1/welltestedsolution/nbproject/build-impl.xml
samples/apifest1/day1/welltestedsolution/nbproject/genfiles.properties
samples/apifest1/day1/welltestedsolution/nbproject/project.properties
samples/apifest1/day1/welltestedsolution/nbproject/project.xml
samples/apifest1/day1/welltestedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day1/welltestedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/alwayscreatenewcircuit/build.xml
samples/apifest1/day2/alwayscreatenewcircuit/nbproject/build-impl.xml
samples/apifest1/day2/alwayscreatenewcircuit/nbproject/genfiles.properties
samples/apifest1/day2/alwayscreatenewcircuit/nbproject/project.properties
samples/apifest1/day2/alwayscreatenewcircuit/nbproject/project.xml
samples/apifest1/day2/alwayscreatenewcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/elementbasedsolution/build.xml
samples/apifest1/day2/elementbasedsolution/nbproject/build-impl.xml
samples/apifest1/day2/elementbasedsolution/nbproject/genfiles.properties
samples/apifest1/day2/elementbasedsolution/nbproject/project.properties
samples/apifest1/day2/elementbasedsolution/nbproject/project.xml
samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/inputandoperation/build.xml
samples/apifest1/day2/inputandoperation/nbproject/build-impl.xml
samples/apifest1/day2/inputandoperation/nbproject/genfiles.properties
samples/apifest1/day2/inputandoperation/nbproject/project.properties
samples/apifest1/day2/inputandoperation/nbproject/project.xml
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/AndOperation.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/BooleanInput.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Factory.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Input.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/NotOperation.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Operation.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/OperationInput.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/OrOperation.java
samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/VariableInput.java
samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/pinbasedsolution/build.xml
samples/apifest1/day2/pinbasedsolution/nbproject/build-impl.xml
samples/apifest1/day2/pinbasedsolution/nbproject/genfiles.properties
samples/apifest1/day2/pinbasedsolution/nbproject/project.properties
samples/apifest1/day2/pinbasedsolution/nbproject/project.xml
samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java
samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Function.java
samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/UnstableException.java
samples/apifest1/day2/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/stackbasedsolution/build.xml
samples/apifest1/day2/stackbasedsolution/nbproject/build-impl.xml
samples/apifest1/day2/stackbasedsolution/nbproject/genfiles.properties
samples/apifest1/day2/stackbasedsolution/nbproject/project.properties
samples/apifest1/day2/stackbasedsolution/nbproject/project.xml
samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit2.java
samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/CircuitFactory.java
samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Operation.java
samples/apifest1/day2/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/subclassingsolution/build.xml
samples/apifest1/day2/subclassingsolution/nbproject/build-impl.xml
samples/apifest1/day2/subclassingsolution/nbproject/genfiles.properties
samples/apifest1/day2/subclassingsolution/nbproject/project.properties
samples/apifest1/day2/subclassingsolution/nbproject/project.xml
samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/FuzzyCircuit.java
samples/apifest1/day2/subclassingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/subclassingsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day2/welltestedsolution/build.xml
samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml
samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties
samples/apifest1/day2/welltestedsolution/nbproject/project.properties
samples/apifest1/day2/welltestedsolution/nbproject/project.xml
samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/custom/Gte.java
samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java
samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/build.xml
samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/nbproject/project.xml
samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/project.properties
samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/test/apifest/CircuitTest.java
samples/apifest1/infrastructure/testing-template/build.xml
samples/apifest1/infrastructure/testing-template/manifest.mf
samples/apifest1/infrastructure/testing-template/nbproject/build-impl.xml
samples/apifest1/infrastructure/testing-template/nbproject/genfiles.properties
samples/apifest1/infrastructure/testing-template/nbproject/platform.properties
samples/apifest1/infrastructure/testing-template/nbproject/project.xml
samples/apifest1/infrastructure/testing-template/project/build.xml
samples/apifest1/infrastructure/testing-template/project/nbproject/project.xml
samples/apifest1/infrastructure/testing-template/project/project.properties
samples/apifest1/infrastructure/testing-template/project/test/apifest/CircuitTest.java
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/Bundle.properties
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateDescription.html
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplatePanelVisual.form
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplatePanelVisual.java
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateWizardIterator.java
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateWizardPanel.java
samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/layer.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/apifest1/boolcircuit/build.xml	Sat Jun 14 09:52:45 2008 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!-- You may freely edit this file. See commented blocks below for -->
     1.6 +<!-- some examples of how to customize the build. -->
     1.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
     1.8 +<project name="boolcircuit" default="default" basedir=".">
     1.9 +    <description>Builds, tests, and runs the project boolcircuit.</description>
    1.10 +    <import file="nbproject/build-impl.xml"/>
    1.11 +    <!--
    1.12 +
    1.13 +    There exist several targets which are by default empty and which can be 
    1.14 +    used for execution of your tasks. These targets are usually executed 
    1.15 +    before and after some main targets. They are: 
    1.16 +
    1.17 +      -pre-init:                 called before initialization of project properties
    1.18 +      -post-init:                called after initialization of project properties
    1.19 +      -pre-compile:              called before javac compilation
    1.20 +      -post-compile:             called after javac compilation
    1.21 +      -pre-compile-single:       called before javac compilation of single file
    1.22 +      -post-compile-single:      called after javac compilation of single file
    1.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
    1.24 +      -post-compile-test:        called after javac compilation of JUnit tests
    1.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
    1.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
    1.27 +      -pre-jar:                  called before JAR building
    1.28 +      -post-jar:                 called after JAR building
    1.29 +      -post-clean:               called after cleaning build products
    1.30 +
    1.31 +    (Targets beginning with '-' are not intended to be called on their own.)
    1.32 +
    1.33 +    Example of inserting an obfuscator after compilation could look like this:
    1.34 +
    1.35 +        <target name="-post-compile">
    1.36 +            <obfuscate>
    1.37 +                <fileset dir="${build.classes.dir}"/>
    1.38 +            </obfuscate>
    1.39 +        </target>
    1.40 +
    1.41 +    For list of available properties check the imported 
    1.42 +    nbproject/build-impl.xml file. 
    1.43 +
    1.44 +
    1.45 +    Another way to customize the build is by overriding existing main targets.
    1.46 +    The targets of interest are: 
    1.47 +
    1.48 +      -init-macrodef-javac:     defines macro for javac compilation
    1.49 +      -init-macrodef-junit:     defines macro for junit execution
    1.50 +      -init-macrodef-debug:     defines macro for class debugging
    1.51 +      -init-macrodef-java:      defines macro for class execution
    1.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    1.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    1.54 +      run:                      execution of project 
    1.55 +      -javadoc-build:           Javadoc generation
    1.56 +      test-report:              JUnit report generation
    1.57 +
    1.58 +    An example of overriding the target for project execution could look like this:
    1.59 +
    1.60 +        <target name="run" depends="boolcircuit-impl.jar">
    1.61 +            <exec dir="bin" executable="launcher.exe">
    1.62 +                <arg file="${dist.jar}"/>
    1.63 +            </exec>
    1.64 +        </target>
    1.65 +
    1.66 +    Notice that the overridden target depends on the jar target and not only on 
    1.67 +    the compile target as the regular run target does. Again, for a list of available 
    1.68 +    properties which you can use, check the target you are overriding in the
    1.69 +    nbproject/build-impl.xml file. 
    1.70 +
    1.71 +    -->
    1.72 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/samples/apifest1/boolcircuit/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
     2.3 @@ -0,0 +1,627 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<!--
     2.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     2.7 +***         EDIT ../build.xml INSTEAD         ***
     2.8 +
     2.9 +For the purpose of easier reading the script
    2.10 +is divided into following sections:
    2.11 +
    2.12 +  - initialization
    2.13 +  - compilation
    2.14 +  - jar
    2.15 +  - execution
    2.16 +  - debugging
    2.17 +  - javadoc
    2.18 +  - junit compilation
    2.19 +  - junit execution
    2.20 +  - junit debugging
    2.21 +  - applet
    2.22 +  - cleanup
    2.23 +
    2.24 +        -->
    2.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="boolcircuit-impl">
    2.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    2.27 +    <!-- 
    2.28 +                ======================
    2.29 +                INITIALIZATION SECTION 
    2.30 +                ======================
    2.31 +            -->
    2.32 +    <target name="-pre-init">
    2.33 +        <!-- Empty placeholder for easier customization. -->
    2.34 +        <!-- You can override this target in the ../build.xml file. -->
    2.35 +    </target>
    2.36 +    <target depends="-pre-init" name="-init-private">
    2.37 +        <property file="nbproject/private/config.properties"/>
    2.38 +        <property file="nbproject/private/configs/${config}.properties"/>
    2.39 +        <property file="nbproject/private/private.properties"/>
    2.40 +    </target>
    2.41 +    <target depends="-pre-init,-init-private" name="-init-user">
    2.42 +        <property file="${user.properties.file}"/>
    2.43 +        <!-- The two properties below are usually overridden -->
    2.44 +        <!-- by the active platform. Just a fallback. -->
    2.45 +        <property name="default.javac.source" value="1.4"/>
    2.46 +        <property name="default.javac.target" value="1.4"/>
    2.47 +    </target>
    2.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    2.49 +        <property file="nbproject/configs/${config}.properties"/>
    2.50 +        <property file="nbproject/project.properties"/>
    2.51 +    </target>
    2.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    2.53 +        <available file="${manifest.file}" property="manifest.available"/>
    2.54 +        <condition property="manifest.available+main.class">
    2.55 +            <and>
    2.56 +                <isset property="manifest.available"/>
    2.57 +                <isset property="main.class"/>
    2.58 +                <not>
    2.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    2.60 +                </not>
    2.61 +            </and>
    2.62 +        </condition>
    2.63 +        <condition property="manifest.available+main.class+mkdist.available">
    2.64 +            <and>
    2.65 +                <istrue value="${manifest.available+main.class}"/>
    2.66 +                <isset property="libs.CopyLibs.classpath"/>
    2.67 +            </and>
    2.68 +        </condition>
    2.69 +        <condition property="have.tests">
    2.70 +            <or>
    2.71 +                <available file="${test.src.dir}"/>
    2.72 +            </or>
    2.73 +        </condition>
    2.74 +        <condition property="have.sources">
    2.75 +            <or>
    2.76 +                <available file="${src.dir}"/>
    2.77 +            </or>
    2.78 +        </condition>
    2.79 +        <condition property="netbeans.home+have.tests">
    2.80 +            <and>
    2.81 +                <isset property="netbeans.home"/>
    2.82 +                <isset property="have.tests"/>
    2.83 +            </and>
    2.84 +        </condition>
    2.85 +        <condition property="no.javadoc.preview">
    2.86 +            <and>
    2.87 +                <isset property="javadoc.preview"/>
    2.88 +                <isfalse value="${javadoc.preview}"/>
    2.89 +            </and>
    2.90 +        </condition>
    2.91 +        <property name="run.jvmargs" value=""/>
    2.92 +        <property name="javac.compilerargs" value=""/>
    2.93 +        <property name="work.dir" value="${basedir}"/>
    2.94 +        <condition property="no.deps">
    2.95 +            <and>
    2.96 +                <istrue value="${no.dependencies}"/>
    2.97 +            </and>
    2.98 +        </condition>
    2.99 +        <property name="javac.debug" value="true"/>
   2.100 +        <property name="javadoc.preview" value="true"/>
   2.101 +        <property name="application.args" value=""/>
   2.102 +        <property name="source.encoding" value="${file.encoding}"/>
   2.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   2.104 +            <and>
   2.105 +                <isset property="javadoc.encoding"/>
   2.106 +                <not>
   2.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   2.108 +                </not>
   2.109 +            </and>
   2.110 +        </condition>
   2.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   2.112 +        <property name="includes" value="**"/>
   2.113 +        <property name="excludes" value=""/>
   2.114 +        <property name="do.depend" value="false"/>
   2.115 +        <condition property="do.depend.true">
   2.116 +            <istrue value="${do.depend}"/>
   2.117 +        </condition>
   2.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   2.119 +            <and>
   2.120 +                <isset property="jaxws.endorsed.dir"/>
   2.121 +                <available file="nbproject/jaxws-build.xml"/>
   2.122 +            </and>
   2.123 +        </condition>
   2.124 +    </target>
   2.125 +    <target name="-post-init">
   2.126 +        <!-- Empty placeholder for easier customization. -->
   2.127 +        <!-- You can override this target in the ../build.xml file. -->
   2.128 +    </target>
   2.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   2.130 +        <fail unless="src.dir">Must set src.dir</fail>
   2.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   2.132 +        <fail unless="build.dir">Must set build.dir</fail>
   2.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
   2.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   2.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   2.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   2.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   2.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   2.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
   2.140 +    </target>
   2.141 +    <target name="-init-macrodef-property">
   2.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.143 +            <attribute name="name"/>
   2.144 +            <attribute name="value"/>
   2.145 +            <sequential>
   2.146 +                <property name="@{name}" value="${@{value}}"/>
   2.147 +            </sequential>
   2.148 +        </macrodef>
   2.149 +    </target>
   2.150 +    <target name="-init-macrodef-javac">
   2.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.152 +            <attribute default="${src.dir}" name="srcdir"/>
   2.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.154 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.155 +            <attribute default="${includes}" name="includes"/>
   2.156 +            <attribute default="${excludes}" name="excludes"/>
   2.157 +            <attribute default="${javac.debug}" name="debug"/>
   2.158 +            <attribute default="" name="sourcepath"/>
   2.159 +            <element name="customize" optional="true"/>
   2.160 +            <sequential>
   2.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}">
   2.162 +                    <classpath>
   2.163 +                        <path path="@{classpath}"/>
   2.164 +                    </classpath>
   2.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   2.166 +                    <customize/>
   2.167 +                </javac>
   2.168 +            </sequential>
   2.169 +        </macrodef>
   2.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.171 +            <attribute default="${src.dir}" name="srcdir"/>
   2.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.173 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.174 +            <sequential>
   2.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   2.176 +                    <classpath>
   2.177 +                        <path path="@{classpath}"/>
   2.178 +                    </classpath>
   2.179 +                </depend>
   2.180 +            </sequential>
   2.181 +        </macrodef>
   2.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.184 +            <sequential>
   2.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
   2.186 +                <pathconvert pathsep="," property="javac.includes.binary">
   2.187 +                    <path>
   2.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   2.189 +                    </path>
   2.190 +                    <globmapper from="*.java" to="*.class"/>
   2.191 +                </pathconvert>
   2.192 +                <delete>
   2.193 +                    <files includes="${javac.includes.binary}"/>
   2.194 +                </delete>
   2.195 +            </sequential>
   2.196 +        </macrodef>
   2.197 +    </target>
   2.198 +    <target name="-init-macrodef-junit">
   2.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.200 +            <attribute default="${includes}" name="includes"/>
   2.201 +            <attribute default="${excludes}" name="excludes"/>
   2.202 +            <attribute default="**" name="testincludes"/>
   2.203 +            <sequential>
   2.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   2.205 +                    <batchtest todir="${build.test.results.dir}">
   2.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   2.207 +                            <filename name="@{testincludes}"/>
   2.208 +                        </fileset>
   2.209 +                    </batchtest>
   2.210 +                    <classpath>
   2.211 +                        <path path="${run.test.classpath}"/>
   2.212 +                    </classpath>
   2.213 +                    <syspropertyset>
   2.214 +                        <propertyref prefix="test-sys-prop."/>
   2.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.216 +                    </syspropertyset>
   2.217 +                    <formatter type="brief" usefile="false"/>
   2.218 +                    <formatter type="xml"/>
   2.219 +                    <jvmarg line="${run.jvmargs}"/>
   2.220 +                </junit>
   2.221 +            </sequential>
   2.222 +        </macrodef>
   2.223 +    </target>
   2.224 +    <target name="-init-macrodef-nbjpda">
   2.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.226 +            <attribute default="${main.class}" name="name"/>
   2.227 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.228 +            <attribute default="" name="stopclassname"/>
   2.229 +            <sequential>
   2.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
   2.231 +                    <classpath>
   2.232 +                        <path path="@{classpath}"/>
   2.233 +                    </classpath>
   2.234 +                </nbjpdastart>
   2.235 +            </sequential>
   2.236 +        </macrodef>
   2.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.238 +            <attribute default="${build.classes.dir}" name="dir"/>
   2.239 +            <sequential>
   2.240 +                <nbjpdareload>
   2.241 +                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
   2.242 +                </nbjpdareload>
   2.243 +            </sequential>
   2.244 +        </macrodef>
   2.245 +    </target>
   2.246 +    <target name="-init-debug-args">
   2.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   2.248 +        <condition property="have-jdk-older-than-1.4">
   2.249 +            <or>
   2.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   2.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   2.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   2.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   2.254 +            </or>
   2.255 +        </condition>
   2.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   2.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
   2.258 +        </condition>
   2.259 +    </target>
   2.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   2.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.262 +            <attribute default="${main.class}" name="classname"/>
   2.263 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.264 +            <element name="customize" optional="true"/>
   2.265 +            <sequential>
   2.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.267 +                    <jvmarg line="${debug-args-line}"/>
   2.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   2.269 +                    <jvmarg line="${run.jvmargs}"/>
   2.270 +                    <classpath>
   2.271 +                        <path path="@{classpath}"/>
   2.272 +                    </classpath>
   2.273 +                    <syspropertyset>
   2.274 +                        <propertyref prefix="run-sys-prop."/>
   2.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.276 +                    </syspropertyset>
   2.277 +                    <customize/>
   2.278 +                </java>
   2.279 +            </sequential>
   2.280 +        </macrodef>
   2.281 +    </target>
   2.282 +    <target name="-init-macrodef-java">
   2.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.284 +            <attribute default="${main.class}" name="classname"/>
   2.285 +            <element name="customize" optional="true"/>
   2.286 +            <sequential>
   2.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.288 +                    <jvmarg line="${run.jvmargs}"/>
   2.289 +                    <classpath>
   2.290 +                        <path path="${run.classpath}"/>
   2.291 +                    </classpath>
   2.292 +                    <syspropertyset>
   2.293 +                        <propertyref prefix="run-sys-prop."/>
   2.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.295 +                    </syspropertyset>
   2.296 +                    <customize/>
   2.297 +                </java>
   2.298 +            </sequential>
   2.299 +        </macrodef>
   2.300 +    </target>
   2.301 +    <target name="-init-presetdef-jar">
   2.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   2.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
   2.305 +            </jar>
   2.306 +        </presetdef>
   2.307 +    </target>
   2.308 +    <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"/>
   2.309 +    <!--
   2.310 +                ===================
   2.311 +                COMPILATION SECTION
   2.312 +                ===================
   2.313 +            -->
   2.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
   2.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   2.316 +        <mkdir dir="${build.classes.dir}"/>
   2.317 +    </target>
   2.318 +    <target name="-pre-compile">
   2.319 +        <!-- Empty placeholder for easier customization. -->
   2.320 +        <!-- You can override this target in the ../build.xml file. -->
   2.321 +    </target>
   2.322 +    <target if="do.depend.true" name="-compile-depend">
   2.323 +        <j2seproject3:depend/>
   2.324 +    </target>
   2.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   2.326 +        <j2seproject3:javac/>
   2.327 +        <copy todir="${build.classes.dir}">
   2.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.329 +        </copy>
   2.330 +    </target>
   2.331 +    <target name="-post-compile">
   2.332 +        <!-- Empty placeholder for easier customization. -->
   2.333 +        <!-- You can override this target in the ../build.xml file. -->
   2.334 +    </target>
   2.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   2.336 +    <target name="-pre-compile-single">
   2.337 +        <!-- Empty placeholder for easier customization. -->
   2.338 +        <!-- You can override this target in the ../build.xml file. -->
   2.339 +    </target>
   2.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   2.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.342 +        <j2seproject3:force-recompile/>
   2.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   2.344 +    </target>
   2.345 +    <target name="-post-compile-single">
   2.346 +        <!-- Empty placeholder for easier customization. -->
   2.347 +        <!-- You can override this target in the ../build.xml file. -->
   2.348 +    </target>
   2.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   2.350 +    <!--
   2.351 +                ====================
   2.352 +                JAR BUILDING SECTION
   2.353 +                ====================
   2.354 +            -->
   2.355 +    <target depends="init" name="-pre-pre-jar">
   2.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   2.357 +        <mkdir dir="${dist.jar.dir}"/>
   2.358 +    </target>
   2.359 +    <target name="-pre-jar">
   2.360 +        <!-- Empty placeholder for easier customization. -->
   2.361 +        <!-- You can override this target in the ../build.xml file. -->
   2.362 +    </target>
   2.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   2.364 +        <j2seproject1:jar/>
   2.365 +    </target>
   2.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   2.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
   2.368 +    </target>
   2.369 +    <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">
   2.370 +        <j2seproject1:jar manifest="${manifest.file}">
   2.371 +            <j2seproject1:manifest>
   2.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   2.373 +            </j2seproject1:manifest>
   2.374 +        </j2seproject1:jar>
   2.375 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.378 +        <pathconvert property="run.classpath.with.dist.jar">
   2.379 +            <path path="${run.classpath}"/>
   2.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   2.381 +        </pathconvert>
   2.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   2.383 +    </target>
   2.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   2.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
   2.387 +            <path path="${run.classpath}"/>
   2.388 +            <map from="${build.classes.dir.resolved}" to=""/>
   2.389 +        </pathconvert>
   2.390 +        <pathconvert pathsep=" " property="jar.classpath">
   2.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
   2.392 +            <chainedmapper>
   2.393 +                <flattenmapper/>
   2.394 +                <globmapper from="*" to="lib/*"/>
   2.395 +            </chainedmapper>
   2.396 +        </pathconvert>
   2.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   2.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   2.399 +            <fileset dir="${build.classes.dir}"/>
   2.400 +            <manifest>
   2.401 +                <attribute name="Main-Class" value="${main.class}"/>
   2.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
   2.403 +            </manifest>
   2.404 +        </copylibs>
   2.405 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   2.408 +    </target>
   2.409 +    <target name="-post-jar">
   2.410 +        <!-- Empty placeholder for easier customization. -->
   2.411 +        <!-- You can override this target in the ../build.xml file. -->
   2.412 +    </target>
   2.413 +    <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"/>
   2.414 +    <!--
   2.415 +                =================
   2.416 +                EXECUTION SECTION
   2.417 +                =================
   2.418 +            -->
   2.419 +    <target depends="init,compile" description="Run a main class." name="run">
   2.420 +        <j2seproject1:java>
   2.421 +            <customize>
   2.422 +                <arg line="${application.args}"/>
   2.423 +            </customize>
   2.424 +        </j2seproject1:java>
   2.425 +    </target>
   2.426 +    <target name="-do-not-recompile">
   2.427 +        <property name="javac.includes.binary" value=""/>
   2.428 +    </target>
   2.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   2.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   2.431 +        <j2seproject1:java classname="${run.class}"/>
   2.432 +    </target>
   2.433 +    <!--
   2.434 +                =================
   2.435 +                DEBUGGING SECTION
   2.436 +                =================
   2.437 +            -->
   2.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   2.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
   2.440 +    </target>
   2.441 +    <target depends="init,compile" name="-debug-start-debuggee">
   2.442 +        <j2seproject3:debug>
   2.443 +            <customize>
   2.444 +                <arg line="${application.args}"/>
   2.445 +            </customize>
   2.446 +        </j2seproject3:debug>
   2.447 +    </target>
   2.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   2.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   2.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   2.451 +    </target>
   2.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   2.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   2.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   2.455 +        <j2seproject3:debug classname="${debug.class}"/>
   2.456 +    </target>
   2.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   2.458 +    <target depends="init" name="-pre-debug-fix">
   2.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
   2.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
   2.461 +    </target>
   2.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   2.463 +        <j2seproject1:nbjpdareload/>
   2.464 +    </target>
   2.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   2.466 +    <!--
   2.467 +                ===============
   2.468 +                JAVADOC SECTION
   2.469 +                ===============
   2.470 +            -->
   2.471 +    <target depends="init" name="-javadoc-build">
   2.472 +        <mkdir dir="${dist.javadoc.dir}"/>
   2.473 +        <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}">
   2.474 +            <classpath>
   2.475 +                <path path="${javac.classpath}"/>
   2.476 +            </classpath>
   2.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   2.478 +                <filename name="**/*.java"/>
   2.479 +            </fileset>
   2.480 +        </javadoc>
   2.481 +    </target>
   2.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   2.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   2.484 +    </target>
   2.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   2.486 +    <!--
   2.487 +                =========================
   2.488 +                JUNIT COMPILATION SECTION
   2.489 +                =========================
   2.490 +            -->
   2.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   2.492 +        <mkdir dir="${build.test.classes.dir}"/>
   2.493 +    </target>
   2.494 +    <target name="-pre-compile-test">
   2.495 +        <!-- Empty placeholder for easier customization. -->
   2.496 +        <!-- You can override this target in the ../build.xml file. -->
   2.497 +    </target>
   2.498 +    <target if="do.depend.true" name="-compile-test-depend">
   2.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.500 +    </target>
   2.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   2.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.503 +        <copy todir="${build.test.classes.dir}">
   2.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.505 +        </copy>
   2.506 +    </target>
   2.507 +    <target name="-post-compile-test">
   2.508 +        <!-- Empty placeholder for easier customization. -->
   2.509 +        <!-- You can override this target in the ../build.xml file. -->
   2.510 +    </target>
   2.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   2.512 +    <target name="-pre-compile-test-single">
   2.513 +        <!-- Empty placeholder for easier customization. -->
   2.514 +        <!-- You can override this target in the ../build.xml file. -->
   2.515 +    </target>
   2.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   2.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   2.519 +        <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}"/>
   2.520 +        <copy todir="${build.test.classes.dir}">
   2.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.522 +        </copy>
   2.523 +    </target>
   2.524 +    <target name="-post-compile-test-single">
   2.525 +        <!-- Empty placeholder for easier customization. -->
   2.526 +        <!-- You can override this target in the ../build.xml file. -->
   2.527 +    </target>
   2.528 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   2.529 +    <!--
   2.530 +                =======================
   2.531 +                JUNIT EXECUTION SECTION
   2.532 +                =======================
   2.533 +            -->
   2.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
   2.535 +        <mkdir dir="${build.test.results.dir}"/>
   2.536 +    </target>
   2.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   2.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
   2.539 +    </target>
   2.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   2.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.542 +    </target>
   2.543 +    <target depends="init" if="have.tests" name="test-report"/>
   2.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   2.545 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   2.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   2.547 +        <mkdir dir="${build.test.results.dir}"/>
   2.548 +    </target>
   2.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   2.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   2.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   2.552 +    </target>
   2.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   2.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.555 +    </target>
   2.556 +    <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"/>
   2.557 +    <!--
   2.558 +                =======================
   2.559 +                JUNIT DEBUGGING SECTION
   2.560 +                =======================
   2.561 +            -->
   2.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   2.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   2.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   2.565 +        <delete file="${test.report.file}"/>
   2.566 +        <mkdir dir="${build.test.results.dir}"/>
   2.567 +        <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}">
   2.568 +            <customize>
   2.569 +                <syspropertyset>
   2.570 +                    <propertyref prefix="test-sys-prop."/>
   2.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.572 +                </syspropertyset>
   2.573 +                <arg value="${test.class}"/>
   2.574 +                <arg value="showoutput=true"/>
   2.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   2.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   2.577 +            </customize>
   2.578 +        </j2seproject3:debug>
   2.579 +    </target>
   2.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   2.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   2.582 +    </target>
   2.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   2.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   2.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   2.586 +    </target>
   2.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   2.588 +    <!--
   2.589 +                =========================
   2.590 +                APPLET EXECUTION SECTION
   2.591 +                =========================
   2.592 +            -->
   2.593 +    <target depends="init,compile-single" name="run-applet">
   2.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
   2.596 +            <customize>
   2.597 +                <arg value="${applet.url}"/>
   2.598 +            </customize>
   2.599 +        </j2seproject1:java>
   2.600 +    </target>
   2.601 +    <!--
   2.602 +                =========================
   2.603 +                APPLET DEBUGGING  SECTION
   2.604 +                =========================
   2.605 +            -->
   2.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   2.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
   2.609 +            <customize>
   2.610 +                <arg value="${applet.url}"/>
   2.611 +            </customize>
   2.612 +        </j2seproject3:debug>
   2.613 +    </target>
   2.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   2.615 +    <!--
   2.616 +                ===============
   2.617 +                CLEANUP SECTION
   2.618 +                ===============
   2.619 +            -->
   2.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
   2.621 +    <target depends="init" name="-do-clean">
   2.622 +        <delete dir="${build.dir}"/>
   2.623 +        <delete dir="${dist.dir}"/>
   2.624 +    </target>
   2.625 +    <target name="-post-clean">
   2.626 +        <!-- Empty placeholder for easier customization. -->
   2.627 +        <!-- You can override this target in the ../build.xml file. -->
   2.628 +    </target>
   2.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   2.630 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/samples/apifest1/boolcircuit/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
     3.3 @@ -0,0 +1,8 @@
     3.4 +build.xml.data.CRC32=2ab820eb
     3.5 +build.xml.script.CRC32=58a52595
     3.6 +build.xml.stylesheet.CRC32=be360661
     3.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     3.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     3.9 +nbproject/build-impl.xml.data.CRC32=2ab820eb
    3.10 +nbproject/build-impl.xml.script.CRC32=72d8319a
    3.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/samples/apifest1/boolcircuit/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
     4.3 @@ -0,0 +1,58 @@
     4.4 +build.classes.dir=${build.dir}/classes
     4.5 +build.classes.excludes=**/*.java,**/*.form
     4.6 +# This directory is removed when the project is cleaned:
     4.7 +build.dir=build
     4.8 +build.generated.dir=${build.dir}/generated
     4.9 +# Only compile against the classpath explicitly listed here:
    4.10 +build.sysclasspath=ignore
    4.11 +build.test.classes.dir=${build.dir}/test/classes
    4.12 +build.test.results.dir=${build.dir}/test/results
    4.13 +debug.classpath=\
    4.14 +    ${run.classpath}
    4.15 +debug.test.classpath=\
    4.16 +    ${run.test.classpath}
    4.17 +# This directory is removed when the project is cleaned:
    4.18 +dist.dir=dist
    4.19 +dist.jar=${dist.dir}/boolcircuit.jar
    4.20 +dist.javadoc.dir=${dist.dir}/javadoc
    4.21 +excludes=
    4.22 +includes=**
    4.23 +jar.compress=false
    4.24 +javac.classpath=
    4.25 +# Space-separated list of extra javac options
    4.26 +javac.compilerargs=
    4.27 +javac.deprecation=false
    4.28 +javac.source=1.5
    4.29 +javac.target=1.5
    4.30 +javac.test.classpath=\
    4.31 +    ${javac.classpath}:\
    4.32 +    ${build.classes.dir}:\
    4.33 +    ${libs.junit.classpath}
    4.34 +javadoc.additionalparam=
    4.35 +javadoc.author=false
    4.36 +javadoc.encoding=
    4.37 +javadoc.noindex=false
    4.38 +javadoc.nonavbar=false
    4.39 +javadoc.notree=false
    4.40 +javadoc.private=false
    4.41 +javadoc.splitindex=true
    4.42 +javadoc.use=true
    4.43 +javadoc.version=false
    4.44 +javadoc.windowtitle=
    4.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
    4.46 +# The library definition has always preference over this property.
    4.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
    4.48 +meta.inf.dir=${src.dir}/META-INF
    4.49 +platform.active=default_platform
    4.50 +run.classpath=\
    4.51 +    ${javac.classpath}:\
    4.52 +    ${build.classes.dir}
    4.53 +# Space-separated list of JVM arguments used when running the project
    4.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    4.55 +# or test-sys-prop.name=value to set system properties for unit tests):
    4.56 +run.jvmargs=
    4.57 +run.test.classpath=\
    4.58 +    ${javac.test.classpath}:\
    4.59 +    ${build.test.classes.dir}
    4.60 +src.dir=src
    4.61 +test.src.dir=test
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/samples/apifest1/boolcircuit/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
     5.3 @@ -0,0 +1,16 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     5.6 +    <type>org.netbeans.modules.java.j2seproject</type>
     5.7 +    <configuration>
     5.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     5.9 +            <name>boolcircuit</name>
    5.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
    5.11 +            <source-roots>
    5.12 +                <root id="src.dir"/>
    5.13 +            </source-roots>
    5.14 +            <test-roots>
    5.15 +                <root id="test.src.dir"/>
    5.16 +            </test-roots>
    5.17 +        </data>
    5.18 +    </configuration>
    5.19 +</project>
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/samples/apifest1/boolcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
     6.3 @@ -0,0 +1,25 @@
     6.4 +/*
     6.5 + * The contents of this file are subject to the terms of the Common Development
     6.6 + * and Distribution License (the License). You may not use this file except in
     6.7 + * compliance with the License.
     6.8 + *
     6.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    6.10 + * or http://www.netbeans.org/cddl.txt.
    6.11 + *
    6.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
    6.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
    6.14 + * If applicable, add the following below the CDDL Header, with the fields
    6.15 + * enclosed by brackets [] replaced by your own identifying information:
    6.16 + * "Portions Copyrighted [year] [name of copyright owner]"
    6.17 + *
    6.18 + * The Original Software is NetBeans. The Initial Developer of the Original
    6.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    6.20 + * Microsystems, Inc. All Rights Reserved.
    6.21 + */
    6.22 +
    6.23 +package org.netbeans.apifest.boolcircuit;
    6.24 +
    6.25 +/**
    6.26 + */
    6.27 +class Circuit {
    6.28 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
     7.3 @@ -0,0 +1,102 @@
     7.4 +/*
     7.5 + * The contents of this file are subject to the terms of the Common Development
     7.6 + * and Distribution License (the License). You may not use this file except in
     7.7 + * compliance with the License.
     7.8 + *
     7.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    7.10 + * or http://www.netbeans.org/cddl.txt.
    7.11 + *
    7.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
    7.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
    7.14 + * If applicable, add the following below the CDDL Header, with the fields
    7.15 + * enclosed by brackets [] replaced by your own identifying information:
    7.16 + * "Portions Copyrighted [year] [name of copyright owner]"
    7.17 + *
    7.18 + * The Original Software is NetBeans. The Initial Developer of the Original
    7.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    7.20 + * Microsystems, Inc. All Rights Reserved.
    7.21 + */
    7.22 +
    7.23 +package org.netbeans.apifest.boolcircuit;
    7.24 +
    7.25 +import java.security.CodeSource;
    7.26 +import java.security.Permission;
    7.27 +import java.security.PermissionCollection;
    7.28 +import java.security.Policy;
    7.29 +import java.util.Collection;
    7.30 +import java.util.Collections;
    7.31 +import java.util.Enumeration;
    7.32 +import junit.framework.TestCase;
    7.33 +import junit.framework.*;
    7.34 +
    7.35 +// BEGIN: apifest.CircuitTest
    7.36 +/** The initial quest for this APIFest is to create an API for boolean 
    7.37 + * circuits. Such API shall be able to compose a boolean circuit from
    7.38 + * basic elements and evaluate the result given initial values for 
    7.39 + * input variables.
    7.40 + * <p>
    7.41 + * The basic elements include:
    7.42 + * <ul>
    7.43 + *   <li>negation - has one input and one output and changes 0 on input to 
    7.44 + *          on output 1 and 1 to 0
    7.45 + *   <li>and - has two inputs and one output. The output is 1 only if both 
    7.46 + *          inputs are 1, otherwise it is 0
    7.47 + *   <li>or - has two inputs and one output. The output is 1 always, except
    7.48 + *          in the case when both inputs are 0
    7.49 + * </ul>
    7.50 + *
    7.51 + * <p>
    7.52 + * The boolean circuit can be used to represent boolean formulas and compute
    7.53 + * the results for certain values of its inputs. The individual tasks described
    7.54 + * as tests bellow.
    7.55 + *
    7.56 + * <p>
    7.57 + * Links of interest:
    7.58 + * <ul>
    7.59 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
    7.60 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
    7.61 + * </ul>
    7.62 + */
    7.63 +public class CircuitTest extends TestCase {
    7.64 +    static {
    7.65 +        // your code shall run without any permissions
    7.66 +    }
    7.67 +    
    7.68 +    public CircuitTest(String testName) {
    7.69 +        super(testName);
    7.70 +    }
    7.71 +
    7.72 +    protected void setUp() throws Exception {
    7.73 +    }
    7.74 +
    7.75 +    protected void tearDown() throws Exception {
    7.76 +    }
    7.77 +    
    7.78 +    
    7.79 +    /** 
    7.80 +     * Create a circuit to evaluate x1 and x2 and then
    7.81 +     * verify that its result is false for input (false, true) and
    7.82 +     * it is true for input (true, true).
    7.83 +     */
    7.84 +    public void testX1andX2() {
    7.85 +        fail("task1");
    7.86 +    }
    7.87 +    
    7.88 +    /** 
    7.89 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
    7.90 +     * verify that its result is false for input (false, true, false) and
    7.91 +     * it is true for input (false, false, true).
    7.92 +     */
    7.93 +    public void testX1andX2orX3() {
    7.94 +        fail("task2");
    7.95 +    }
    7.96 +    /** 
    7.97 +     * Create a circuit to evaluate (x1 or not(x1)) and then
    7.98 +     * verify that its result is true for all values of x1.
    7.99 +     */
   7.100 +    public void testAlwaysTrue() {
   7.101 +        fail("task3");
   7.102 +    }
   7.103 +    
   7.104 +}
   7.105 +// END: apifest.CircuitTest
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/build.xml	Sat Jun 14 09:52:45 2008 +0200
     8.3 @@ -0,0 +1,69 @@
     8.4 +<?xml version="1.0" encoding="UTF-8"?>
     8.5 +<!-- You may freely edit this file. See commented blocks below for -->
     8.6 +<!-- some examples of how to customize the build. -->
     8.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
     8.8 +<project name="alwayscreatenewcircuit" default="default" basedir=".">
     8.9 +    <description>Builds, tests, and runs the project alwayscreatenewcircuit.</description>
    8.10 +    <import file="nbproject/build-impl.xml"/>
    8.11 +    <!--
    8.12 +
    8.13 +    There exist several targets which are by default empty and which can be 
    8.14 +    used for execution of your tasks. These targets are usually executed 
    8.15 +    before and after some main targets. They are: 
    8.16 +
    8.17 +      -pre-init:                 called before initialization of project properties
    8.18 +      -post-init:                called after initialization of project properties
    8.19 +      -pre-compile:              called before javac compilation
    8.20 +      -post-compile:             called after javac compilation
    8.21 +      -pre-compile-single:       called before javac compilation of single file
    8.22 +      -post-compile-single:      called after javac compilation of single file
    8.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
    8.24 +      -post-compile-test:        called after javac compilation of JUnit tests
    8.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
    8.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
    8.27 +      -pre-jar:                  called before JAR building
    8.28 +      -post-jar:                 called after JAR building
    8.29 +      -post-clean:               called after cleaning build products
    8.30 +
    8.31 +    (Targets beginning with '-' are not intended to be called on their own.)
    8.32 +
    8.33 +    Example of inserting an obfuscator after compilation could look like this:
    8.34 +
    8.35 +        <target name="-post-compile">
    8.36 +            <obfuscate>
    8.37 +                <fileset dir="${build.classes.dir}"/>
    8.38 +            </obfuscate>
    8.39 +        </target>
    8.40 +
    8.41 +    For list of available properties check the imported 
    8.42 +    nbproject/build-impl.xml file. 
    8.43 +
    8.44 +
    8.45 +    Another way to customize the build is by overriding existing main targets.
    8.46 +    The targets of interest are: 
    8.47 +
    8.48 +      -init-macrodef-javac:     defines macro for javac compilation
    8.49 +      -init-macrodef-junit:     defines macro for junit execution
    8.50 +      -init-macrodef-debug:     defines macro for class debugging
    8.51 +      -init-macrodef-java:      defines macro for class execution
    8.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    8.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    8.54 +      run:                      execution of project 
    8.55 +      -javadoc-build:           Javadoc generation
    8.56 +      test-report:              JUnit report generation
    8.57 +
    8.58 +    An example of overriding the target for project execution could look like this:
    8.59 +
    8.60 +        <target name="run" depends="alwayscreatenewcircuit-impl.jar">
    8.61 +            <exec dir="bin" executable="launcher.exe">
    8.62 +                <arg file="${dist.jar}"/>
    8.63 +            </exec>
    8.64 +        </target>
    8.65 +
    8.66 +    Notice that the overridden target depends on the jar target and not only on 
    8.67 +    the compile target as the regular run target does. Again, for a list of available 
    8.68 +    properties which you can use, check the target you are overriding in the
    8.69 +    nbproject/build-impl.xml file. 
    8.70 +
    8.71 +    -->
    8.72 +</project>
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
     9.3 @@ -0,0 +1,627 @@
     9.4 +<?xml version="1.0" encoding="UTF-8"?>
     9.5 +<!--
     9.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     9.7 +***         EDIT ../build.xml INSTEAD         ***
     9.8 +
     9.9 +For the purpose of easier reading the script
    9.10 +is divided into following sections:
    9.11 +
    9.12 +  - initialization
    9.13 +  - compilation
    9.14 +  - jar
    9.15 +  - execution
    9.16 +  - debugging
    9.17 +  - javadoc
    9.18 +  - junit compilation
    9.19 +  - junit execution
    9.20 +  - junit debugging
    9.21 +  - applet
    9.22 +  - cleanup
    9.23 +
    9.24 +        -->
    9.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="alwayscreatenewcircuit-impl">
    9.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    9.27 +    <!-- 
    9.28 +                ======================
    9.29 +                INITIALIZATION SECTION 
    9.30 +                ======================
    9.31 +            -->
    9.32 +    <target name="-pre-init">
    9.33 +        <!-- Empty placeholder for easier customization. -->
    9.34 +        <!-- You can override this target in the ../build.xml file. -->
    9.35 +    </target>
    9.36 +    <target depends="-pre-init" name="-init-private">
    9.37 +        <property file="nbproject/private/config.properties"/>
    9.38 +        <property file="nbproject/private/configs/${config}.properties"/>
    9.39 +        <property file="nbproject/private/private.properties"/>
    9.40 +    </target>
    9.41 +    <target depends="-pre-init,-init-private" name="-init-user">
    9.42 +        <property file="${user.properties.file}"/>
    9.43 +        <!-- The two properties below are usually overridden -->
    9.44 +        <!-- by the active platform. Just a fallback. -->
    9.45 +        <property name="default.javac.source" value="1.4"/>
    9.46 +        <property name="default.javac.target" value="1.4"/>
    9.47 +    </target>
    9.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    9.49 +        <property file="nbproject/configs/${config}.properties"/>
    9.50 +        <property file="nbproject/project.properties"/>
    9.51 +    </target>
    9.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    9.53 +        <available file="${manifest.file}" property="manifest.available"/>
    9.54 +        <condition property="manifest.available+main.class">
    9.55 +            <and>
    9.56 +                <isset property="manifest.available"/>
    9.57 +                <isset property="main.class"/>
    9.58 +                <not>
    9.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    9.60 +                </not>
    9.61 +            </and>
    9.62 +        </condition>
    9.63 +        <condition property="manifest.available+main.class+mkdist.available">
    9.64 +            <and>
    9.65 +                <istrue value="${manifest.available+main.class}"/>
    9.66 +                <isset property="libs.CopyLibs.classpath"/>
    9.67 +            </and>
    9.68 +        </condition>
    9.69 +        <condition property="have.tests">
    9.70 +            <or>
    9.71 +                <available file="${test.src.dir}"/>
    9.72 +            </or>
    9.73 +        </condition>
    9.74 +        <condition property="have.sources">
    9.75 +            <or>
    9.76 +                <available file="${src.dir}"/>
    9.77 +            </or>
    9.78 +        </condition>
    9.79 +        <condition property="netbeans.home+have.tests">
    9.80 +            <and>
    9.81 +                <isset property="netbeans.home"/>
    9.82 +                <isset property="have.tests"/>
    9.83 +            </and>
    9.84 +        </condition>
    9.85 +        <condition property="no.javadoc.preview">
    9.86 +            <and>
    9.87 +                <isset property="javadoc.preview"/>
    9.88 +                <isfalse value="${javadoc.preview}"/>
    9.89 +            </and>
    9.90 +        </condition>
    9.91 +        <property name="run.jvmargs" value=""/>
    9.92 +        <property name="javac.compilerargs" value=""/>
    9.93 +        <property name="work.dir" value="${basedir}"/>
    9.94 +        <condition property="no.deps">
    9.95 +            <and>
    9.96 +                <istrue value="${no.dependencies}"/>
    9.97 +            </and>
    9.98 +        </condition>
    9.99 +        <property name="javac.debug" value="true"/>
   9.100 +        <property name="javadoc.preview" value="true"/>
   9.101 +        <property name="application.args" value=""/>
   9.102 +        <property name="source.encoding" value="${file.encoding}"/>
   9.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   9.104 +            <and>
   9.105 +                <isset property="javadoc.encoding"/>
   9.106 +                <not>
   9.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   9.108 +                </not>
   9.109 +            </and>
   9.110 +        </condition>
   9.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   9.112 +        <property name="includes" value="**"/>
   9.113 +        <property name="excludes" value=""/>
   9.114 +        <property name="do.depend" value="false"/>
   9.115 +        <condition property="do.depend.true">
   9.116 +            <istrue value="${do.depend}"/>
   9.117 +        </condition>
   9.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   9.119 +            <and>
   9.120 +                <isset property="jaxws.endorsed.dir"/>
   9.121 +                <available file="nbproject/jaxws-build.xml"/>
   9.122 +            </and>
   9.123 +        </condition>
   9.124 +    </target>
   9.125 +    <target name="-post-init">
   9.126 +        <!-- Empty placeholder for easier customization. -->
   9.127 +        <!-- You can override this target in the ../build.xml file. -->
   9.128 +    </target>
   9.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   9.130 +        <fail unless="src.dir">Must set src.dir</fail>
   9.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   9.132 +        <fail unless="build.dir">Must set build.dir</fail>
   9.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
   9.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   9.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   9.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   9.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   9.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   9.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
   9.140 +    </target>
   9.141 +    <target name="-init-macrodef-property">
   9.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   9.143 +            <attribute name="name"/>
   9.144 +            <attribute name="value"/>
   9.145 +            <sequential>
   9.146 +                <property name="@{name}" value="${@{value}}"/>
   9.147 +            </sequential>
   9.148 +        </macrodef>
   9.149 +    </target>
   9.150 +    <target name="-init-macrodef-javac">
   9.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   9.152 +            <attribute default="${src.dir}" name="srcdir"/>
   9.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
   9.154 +            <attribute default="${javac.classpath}" name="classpath"/>
   9.155 +            <attribute default="${includes}" name="includes"/>
   9.156 +            <attribute default="${excludes}" name="excludes"/>
   9.157 +            <attribute default="${javac.debug}" name="debug"/>
   9.158 +            <attribute default="" name="sourcepath"/>
   9.159 +            <element name="customize" optional="true"/>
   9.160 +            <sequential>
   9.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}">
   9.162 +                    <classpath>
   9.163 +                        <path path="@{classpath}"/>
   9.164 +                    </classpath>
   9.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   9.166 +                    <customize/>
   9.167 +                </javac>
   9.168 +            </sequential>
   9.169 +        </macrodef>
   9.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   9.171 +            <attribute default="${src.dir}" name="srcdir"/>
   9.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
   9.173 +            <attribute default="${javac.classpath}" name="classpath"/>
   9.174 +            <sequential>
   9.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   9.176 +                    <classpath>
   9.177 +                        <path path="@{classpath}"/>
   9.178 +                    </classpath>
   9.179 +                </depend>
   9.180 +            </sequential>
   9.181 +        </macrodef>
   9.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   9.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
   9.184 +            <sequential>
   9.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
   9.186 +                <pathconvert pathsep="," property="javac.includes.binary">
   9.187 +                    <path>
   9.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   9.189 +                    </path>
   9.190 +                    <globmapper from="*.java" to="*.class"/>
   9.191 +                </pathconvert>
   9.192 +                <delete>
   9.193 +                    <files includes="${javac.includes.binary}"/>
   9.194 +                </delete>
   9.195 +            </sequential>
   9.196 +        </macrodef>
   9.197 +    </target>
   9.198 +    <target name="-init-macrodef-junit">
   9.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   9.200 +            <attribute default="${includes}" name="includes"/>
   9.201 +            <attribute default="${excludes}" name="excludes"/>
   9.202 +            <attribute default="**" name="testincludes"/>
   9.203 +            <sequential>
   9.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   9.205 +                    <batchtest todir="${build.test.results.dir}">
   9.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   9.207 +                            <filename name="@{testincludes}"/>
   9.208 +                        </fileset>
   9.209 +                    </batchtest>
   9.210 +                    <classpath>
   9.211 +                        <path path="${run.test.classpath}"/>
   9.212 +                    </classpath>
   9.213 +                    <syspropertyset>
   9.214 +                        <propertyref prefix="test-sys-prop."/>
   9.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   9.216 +                    </syspropertyset>
   9.217 +                    <formatter type="brief" usefile="false"/>
   9.218 +                    <formatter type="xml"/>
   9.219 +                    <jvmarg line="${run.jvmargs}"/>
   9.220 +                </junit>
   9.221 +            </sequential>
   9.222 +        </macrodef>
   9.223 +    </target>
   9.224 +    <target name="-init-macrodef-nbjpda">
   9.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   9.226 +            <attribute default="${main.class}" name="name"/>
   9.227 +            <attribute default="${debug.classpath}" name="classpath"/>
   9.228 +            <attribute default="" name="stopclassname"/>
   9.229 +            <sequential>
   9.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
   9.231 +                    <classpath>
   9.232 +                        <path path="@{classpath}"/>
   9.233 +                    </classpath>
   9.234 +                </nbjpdastart>
   9.235 +            </sequential>
   9.236 +        </macrodef>
   9.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   9.238 +            <attribute default="${build.classes.dir}" name="dir"/>
   9.239 +            <sequential>
   9.240 +                <nbjpdareload>
   9.241 +                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
   9.242 +                </nbjpdareload>
   9.243 +            </sequential>
   9.244 +        </macrodef>
   9.245 +    </target>
   9.246 +    <target name="-init-debug-args">
   9.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   9.248 +        <condition property="have-jdk-older-than-1.4">
   9.249 +            <or>
   9.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   9.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   9.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   9.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   9.254 +            </or>
   9.255 +        </condition>
   9.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   9.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
   9.258 +        </condition>
   9.259 +    </target>
   9.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   9.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   9.262 +            <attribute default="${main.class}" name="classname"/>
   9.263 +            <attribute default="${debug.classpath}" name="classpath"/>
   9.264 +            <element name="customize" optional="true"/>
   9.265 +            <sequential>
   9.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   9.267 +                    <jvmarg line="${debug-args-line}"/>
   9.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   9.269 +                    <jvmarg line="${run.jvmargs}"/>
   9.270 +                    <classpath>
   9.271 +                        <path path="@{classpath}"/>
   9.272 +                    </classpath>
   9.273 +                    <syspropertyset>
   9.274 +                        <propertyref prefix="run-sys-prop."/>
   9.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   9.276 +                    </syspropertyset>
   9.277 +                    <customize/>
   9.278 +                </java>
   9.279 +            </sequential>
   9.280 +        </macrodef>
   9.281 +    </target>
   9.282 +    <target name="-init-macrodef-java">
   9.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   9.284 +            <attribute default="${main.class}" name="classname"/>
   9.285 +            <element name="customize" optional="true"/>
   9.286 +            <sequential>
   9.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   9.288 +                    <jvmarg line="${run.jvmargs}"/>
   9.289 +                    <classpath>
   9.290 +                        <path path="${run.classpath}"/>
   9.291 +                    </classpath>
   9.292 +                    <syspropertyset>
   9.293 +                        <propertyref prefix="run-sys-prop."/>
   9.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   9.295 +                    </syspropertyset>
   9.296 +                    <customize/>
   9.297 +                </java>
   9.298 +            </sequential>
   9.299 +        </macrodef>
   9.300 +    </target>
   9.301 +    <target name="-init-presetdef-jar">
   9.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   9.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   9.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
   9.305 +            </jar>
   9.306 +        </presetdef>
   9.307 +    </target>
   9.308 +    <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"/>
   9.309 +    <!--
   9.310 +                ===================
   9.311 +                COMPILATION SECTION
   9.312 +                ===================
   9.313 +            -->
   9.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
   9.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   9.316 +        <mkdir dir="${build.classes.dir}"/>
   9.317 +    </target>
   9.318 +    <target name="-pre-compile">
   9.319 +        <!-- Empty placeholder for easier customization. -->
   9.320 +        <!-- You can override this target in the ../build.xml file. -->
   9.321 +    </target>
   9.322 +    <target if="do.depend.true" name="-compile-depend">
   9.323 +        <j2seproject3:depend/>
   9.324 +    </target>
   9.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   9.326 +        <j2seproject3:javac/>
   9.327 +        <copy todir="${build.classes.dir}">
   9.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   9.329 +        </copy>
   9.330 +    </target>
   9.331 +    <target name="-post-compile">
   9.332 +        <!-- Empty placeholder for easier customization. -->
   9.333 +        <!-- You can override this target in the ../build.xml file. -->
   9.334 +    </target>
   9.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   9.336 +    <target name="-pre-compile-single">
   9.337 +        <!-- Empty placeholder for easier customization. -->
   9.338 +        <!-- You can override this target in the ../build.xml file. -->
   9.339 +    </target>
   9.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   9.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   9.342 +        <j2seproject3:force-recompile/>
   9.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   9.344 +    </target>
   9.345 +    <target name="-post-compile-single">
   9.346 +        <!-- Empty placeholder for easier customization. -->
   9.347 +        <!-- You can override this target in the ../build.xml file. -->
   9.348 +    </target>
   9.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   9.350 +    <!--
   9.351 +                ====================
   9.352 +                JAR BUILDING SECTION
   9.353 +                ====================
   9.354 +            -->
   9.355 +    <target depends="init" name="-pre-pre-jar">
   9.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   9.357 +        <mkdir dir="${dist.jar.dir}"/>
   9.358 +    </target>
   9.359 +    <target name="-pre-jar">
   9.360 +        <!-- Empty placeholder for easier customization. -->
   9.361 +        <!-- You can override this target in the ../build.xml file. -->
   9.362 +    </target>
   9.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   9.364 +        <j2seproject1:jar/>
   9.365 +    </target>
   9.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   9.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
   9.368 +    </target>
   9.369 +    <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">
   9.370 +        <j2seproject1:jar manifest="${manifest.file}">
   9.371 +            <j2seproject1:manifest>
   9.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   9.373 +            </j2seproject1:manifest>
   9.374 +        </j2seproject1:jar>
   9.375 +        <echo>To run this application from the command line without Ant, try:</echo>
   9.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   9.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   9.378 +        <pathconvert property="run.classpath.with.dist.jar">
   9.379 +            <path path="${run.classpath}"/>
   9.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   9.381 +        </pathconvert>
   9.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   9.383 +    </target>
   9.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   9.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   9.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
   9.387 +            <path path="${run.classpath}"/>
   9.388 +            <map from="${build.classes.dir.resolved}" to=""/>
   9.389 +        </pathconvert>
   9.390 +        <pathconvert pathsep=" " property="jar.classpath">
   9.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
   9.392 +            <chainedmapper>
   9.393 +                <flattenmapper/>
   9.394 +                <globmapper from="*" to="lib/*"/>
   9.395 +            </chainedmapper>
   9.396 +        </pathconvert>
   9.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   9.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   9.399 +            <fileset dir="${build.classes.dir}"/>
   9.400 +            <manifest>
   9.401 +                <attribute name="Main-Class" value="${main.class}"/>
   9.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
   9.403 +            </manifest>
   9.404 +        </copylibs>
   9.405 +        <echo>To run this application from the command line without Ant, try:</echo>
   9.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   9.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   9.408 +    </target>
   9.409 +    <target name="-post-jar">
   9.410 +        <!-- Empty placeholder for easier customization. -->
   9.411 +        <!-- You can override this target in the ../build.xml file. -->
   9.412 +    </target>
   9.413 +    <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"/>
   9.414 +    <!--
   9.415 +                =================
   9.416 +                EXECUTION SECTION
   9.417 +                =================
   9.418 +            -->
   9.419 +    <target depends="init,compile" description="Run a main class." name="run">
   9.420 +        <j2seproject1:java>
   9.421 +            <customize>
   9.422 +                <arg line="${application.args}"/>
   9.423 +            </customize>
   9.424 +        </j2seproject1:java>
   9.425 +    </target>
   9.426 +    <target name="-do-not-recompile">
   9.427 +        <property name="javac.includes.binary" value=""/>
   9.428 +    </target>
   9.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   9.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   9.431 +        <j2seproject1:java classname="${run.class}"/>
   9.432 +    </target>
   9.433 +    <!--
   9.434 +                =================
   9.435 +                DEBUGGING SECTION
   9.436 +                =================
   9.437 +            -->
   9.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   9.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
   9.440 +    </target>
   9.441 +    <target depends="init,compile" name="-debug-start-debuggee">
   9.442 +        <j2seproject3:debug>
   9.443 +            <customize>
   9.444 +                <arg line="${application.args}"/>
   9.445 +            </customize>
   9.446 +        </j2seproject3:debug>
   9.447 +    </target>
   9.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   9.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   9.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   9.451 +    </target>
   9.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   9.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   9.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   9.455 +        <j2seproject3:debug classname="${debug.class}"/>
   9.456 +    </target>
   9.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   9.458 +    <target depends="init" name="-pre-debug-fix">
   9.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
   9.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
   9.461 +    </target>
   9.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   9.463 +        <j2seproject1:nbjpdareload/>
   9.464 +    </target>
   9.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   9.466 +    <!--
   9.467 +                ===============
   9.468 +                JAVADOC SECTION
   9.469 +                ===============
   9.470 +            -->
   9.471 +    <target depends="init" name="-javadoc-build">
   9.472 +        <mkdir dir="${dist.javadoc.dir}"/>
   9.473 +        <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}">
   9.474 +            <classpath>
   9.475 +                <path path="${javac.classpath}"/>
   9.476 +            </classpath>
   9.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   9.478 +                <filename name="**/*.java"/>
   9.479 +            </fileset>
   9.480 +        </javadoc>
   9.481 +    </target>
   9.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   9.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   9.484 +    </target>
   9.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   9.486 +    <!--
   9.487 +                =========================
   9.488 +                JUNIT COMPILATION SECTION
   9.489 +                =========================
   9.490 +            -->
   9.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   9.492 +        <mkdir dir="${build.test.classes.dir}"/>
   9.493 +    </target>
   9.494 +    <target name="-pre-compile-test">
   9.495 +        <!-- Empty placeholder for easier customization. -->
   9.496 +        <!-- You can override this target in the ../build.xml file. -->
   9.497 +    </target>
   9.498 +    <target if="do.depend.true" name="-compile-test-depend">
   9.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   9.500 +    </target>
   9.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   9.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   9.503 +        <copy todir="${build.test.classes.dir}">
   9.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   9.505 +        </copy>
   9.506 +    </target>
   9.507 +    <target name="-post-compile-test">
   9.508 +        <!-- Empty placeholder for easier customization. -->
   9.509 +        <!-- You can override this target in the ../build.xml file. -->
   9.510 +    </target>
   9.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   9.512 +    <target name="-pre-compile-test-single">
   9.513 +        <!-- Empty placeholder for easier customization. -->
   9.514 +        <!-- You can override this target in the ../build.xml file. -->
   9.515 +    </target>
   9.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   9.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   9.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   9.519 +        <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}"/>
   9.520 +        <copy todir="${build.test.classes.dir}">
   9.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   9.522 +        </copy>
   9.523 +    </target>
   9.524 +    <target name="-post-compile-test-single">
   9.525 +        <!-- Empty placeholder for easier customization. -->
   9.526 +        <!-- You can override this target in the ../build.xml file. -->
   9.527 +    </target>
   9.528 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   9.529 +    <!--
   9.530 +                =======================
   9.531 +                JUNIT EXECUTION SECTION
   9.532 +                =======================
   9.533 +            -->
   9.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
   9.535 +        <mkdir dir="${build.test.results.dir}"/>
   9.536 +    </target>
   9.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   9.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
   9.539 +    </target>
   9.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   9.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   9.542 +    </target>
   9.543 +    <target depends="init" if="have.tests" name="test-report"/>
   9.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   9.545 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   9.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   9.547 +        <mkdir dir="${build.test.results.dir}"/>
   9.548 +    </target>
   9.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   9.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   9.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   9.552 +    </target>
   9.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   9.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   9.555 +    </target>
   9.556 +    <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"/>
   9.557 +    <!--
   9.558 +                =======================
   9.559 +                JUNIT DEBUGGING SECTION
   9.560 +                =======================
   9.561 +            -->
   9.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   9.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   9.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   9.565 +        <delete file="${test.report.file}"/>
   9.566 +        <mkdir dir="${build.test.results.dir}"/>
   9.567 +        <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}">
   9.568 +            <customize>
   9.569 +                <syspropertyset>
   9.570 +                    <propertyref prefix="test-sys-prop."/>
   9.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   9.572 +                </syspropertyset>
   9.573 +                <arg value="${test.class}"/>
   9.574 +                <arg value="showoutput=true"/>
   9.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   9.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   9.577 +            </customize>
   9.578 +        </j2seproject3:debug>
   9.579 +    </target>
   9.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   9.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   9.582 +    </target>
   9.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   9.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   9.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   9.586 +    </target>
   9.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   9.588 +    <!--
   9.589 +                =========================
   9.590 +                APPLET EXECUTION SECTION
   9.591 +                =========================
   9.592 +            -->
   9.593 +    <target depends="init,compile-single" name="run-applet">
   9.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   9.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
   9.596 +            <customize>
   9.597 +                <arg value="${applet.url}"/>
   9.598 +            </customize>
   9.599 +        </j2seproject1:java>
   9.600 +    </target>
   9.601 +    <!--
   9.602 +                =========================
   9.603 +                APPLET DEBUGGING  SECTION
   9.604 +                =========================
   9.605 +            -->
   9.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   9.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   9.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
   9.609 +            <customize>
   9.610 +                <arg value="${applet.url}"/>
   9.611 +            </customize>
   9.612 +        </j2seproject3:debug>
   9.613 +    </target>
   9.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   9.615 +    <!--
   9.616 +                ===============
   9.617 +                CLEANUP SECTION
   9.618 +                ===============
   9.619 +            -->
   9.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
   9.621 +    <target depends="init" name="-do-clean">
   9.622 +        <delete dir="${build.dir}"/>
   9.623 +        <delete dir="${dist.dir}"/>
   9.624 +    </target>
   9.625 +    <target name="-post-clean">
   9.626 +        <!-- Empty placeholder for easier customization. -->
   9.627 +        <!-- You can override this target in the ../build.xml file. -->
   9.628 +    </target>
   9.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   9.630 +</project>
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    10.3 @@ -0,0 +1,8 @@
    10.4 +build.xml.data.CRC32=ffd6778c
    10.5 +build.xml.script.CRC32=f0487089
    10.6 +build.xml.stylesheet.CRC32=be360661
    10.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    10.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    10.9 +nbproject/build-impl.xml.data.CRC32=ffd6778c
   10.10 +nbproject/build-impl.xml.script.CRC32=d54dcd8c
   10.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    11.3 @@ -0,0 +1,58 @@
    11.4 +build.classes.dir=${build.dir}/classes
    11.5 +build.classes.excludes=**/*.java,**/*.form
    11.6 +# This directory is removed when the project is cleaned:
    11.7 +build.dir=build
    11.8 +build.generated.dir=${build.dir}/generated
    11.9 +# Only compile against the classpath explicitly listed here:
   11.10 +build.sysclasspath=ignore
   11.11 +build.test.classes.dir=${build.dir}/test/classes
   11.12 +build.test.results.dir=${build.dir}/test/results
   11.13 +debug.classpath=\
   11.14 +    ${run.classpath}
   11.15 +debug.test.classpath=\
   11.16 +    ${run.test.classpath}
   11.17 +# This directory is removed when the project is cleaned:
   11.18 +dist.dir=dist
   11.19 +dist.jar=${dist.dir}/boolcircuit.jar
   11.20 +dist.javadoc.dir=${dist.dir}/javadoc
   11.21 +excludes=
   11.22 +includes=**
   11.23 +jar.compress=false
   11.24 +javac.classpath=
   11.25 +# Space-separated list of extra javac options
   11.26 +javac.compilerargs=
   11.27 +javac.deprecation=false
   11.28 +javac.source=1.5
   11.29 +javac.target=1.5
   11.30 +javac.test.classpath=\
   11.31 +    ${javac.classpath}:\
   11.32 +    ${build.classes.dir}:\
   11.33 +    ${libs.junit.classpath}
   11.34 +javadoc.additionalparam=
   11.35 +javadoc.author=false
   11.36 +javadoc.encoding=
   11.37 +javadoc.noindex=false
   11.38 +javadoc.nonavbar=false
   11.39 +javadoc.notree=false
   11.40 +javadoc.private=false
   11.41 +javadoc.splitindex=true
   11.42 +javadoc.use=true
   11.43 +javadoc.version=false
   11.44 +javadoc.windowtitle=
   11.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   11.46 +# The library definition has always preference over this property.
   11.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   11.48 +meta.inf.dir=${src.dir}/META-INF
   11.49 +platform.active=default_platform
   11.50 +run.classpath=\
   11.51 +    ${javac.classpath}:\
   11.52 +    ${build.classes.dir}
   11.53 +# Space-separated list of JVM arguments used when running the project
   11.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   11.55 +# or test-sys-prop.name=value to set system properties for unit tests):
   11.56 +run.jvmargs=
   11.57 +run.test.classpath=\
   11.58 +    ${javac.test.classpath}:\
   11.59 +    ${build.test.classes.dir}
   11.60 +src.dir=src
   11.61 +test.src.dir=test
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    12.3 @@ -0,0 +1,16 @@
    12.4 +<?xml version="1.0" encoding="UTF-8"?>
    12.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    12.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    12.7 +    <configuration>
    12.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    12.9 +            <name>alwayscreatenewcircuit</name>
   12.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   12.11 +            <source-roots>
   12.12 +                <root id="src.dir"/>
   12.13 +            </source-roots>
   12.14 +            <test-roots>
   12.15 +                <root id="test.src.dir"/>
   12.16 +            </test-roots>
   12.17 +        </data>
   12.18 +    </configuration>
   12.19 +</project>
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    13.3 @@ -0,0 +1,139 @@
    13.4 +/*
    13.5 + * The contents of this file are subject to the terms of the Common Development
    13.6 + * and Distribution License (the License). You may not use this file except in
    13.7 + * compliance with the License.
    13.8 + *
    13.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   13.10 + * or http://www.netbeans.org/cddl.txt.
   13.11 + *
   13.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   13.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   13.14 + * If applicable, add the following below the CDDL Header, with the fields
   13.15 + * enclosed by brackets [] replaced by your own identifying information:
   13.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   13.17 + *
   13.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   13.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   13.20 + * Microsystems, Inc. All Rights Reserved.
   13.21 + */
   13.22 +
   13.23 +package org.netbeans.apifest.boolcircuit;
   13.24 +
   13.25 +/**
   13.26 + */
   13.27 +public abstract class Circuit {
   13.28 +    /** Creates a new instance of Circuits */
   13.29 +    private Circuit() {
   13.30 +    }
   13.31 +
   13.32 +    public static Circuit negate(boolean input) {
   13.33 +        return new Negation(input);
   13.34 +    }
   13.35 +
   13.36 +    public static Circuit negate(Circuit input) {
   13.37 +        return new Negation(input);
   13.38 +    }
   13.39 +
   13.40 +    public static Circuit and(boolean input1, boolean input2) {
   13.41 +        return new And(input1, input2);
   13.42 +    }
   13.43 +
   13.44 +    public static Circuit and(Circuit  input1, boolean input2) {
   13.45 +        return new And(input1, new Primitive(input2));
   13.46 +    }
   13.47 +
   13.48 +    public static Circuit and(boolean input1, Circuit input2) {
   13.49 +        return new And(new Primitive(input1), input2);
   13.50 +    }
   13.51 +
   13.52 +    public static Circuit and(Circuit input1, Circuit input2) {
   13.53 +        return new And(input1, input2);
   13.54 +    }
   13.55 +
   13.56 +    public static Circuit or(boolean input1, boolean input2) {
   13.57 +        return new Or(input1, input2);
   13.58 +    }
   13.59 +
   13.60 +    public static Circuit or(Circuit input1, boolean input2) {
   13.61 +        return new Or(input1, new Primitive(input2));
   13.62 +    }
   13.63 +
   13.64 +    public static Circuit or(boolean input1, Circuit input2) {
   13.65 +        return new Or(new Primitive(input1), input2);
   13.66 +    }
   13.67 +
   13.68 +    public static Circuit or(Circuit input1, Circuit input2) {
   13.69 +        return new Or(input1, input2);
   13.70 +    }
   13.71 +
   13.72 +
   13.73 +    public abstract boolean output();
   13.74 +
   13.75 +    private final static class Primitive extends Circuit {
   13.76 +        private boolean input;
   13.77 +
   13.78 +        Primitive(boolean input) {
   13.79 +            this.input = input;
   13.80 +        }
   13.81 +
   13.82 +        public final boolean output() {
   13.83 +            return input;
   13.84 +        }
   13.85 +    }
   13.86 +
   13.87 +    private final static class Negation extends Circuit {
   13.88 +        private Circuit input;
   13.89 +
   13.90 +        Negation(boolean input) {
   13.91 +            this.input = new Primitive(input);
   13.92 +        }
   13.93 +
   13.94 +        Negation(Circuit input) {
   13.95 +            this.input = input;
   13.96 +        }
   13.97 +
   13.98 +        public final boolean output() {
   13.99 +            return !(input.output());
  13.100 +        }
  13.101 +    }
  13.102 +
  13.103 +    private final static class And extends Circuit {
  13.104 +        private Circuit input1;
  13.105 +        private Circuit input2;
  13.106 +
  13.107 +
  13.108 +        And(boolean input1, boolean input2) {
  13.109 +            this.input1 = new Primitive(input1);
  13.110 +            this.input2 = new Primitive(input2);
  13.111 +        }
  13.112 +
  13.113 +        And(Circuit input1, Circuit input2) {
  13.114 +            this.input1 = input1;
  13.115 +            this.input2 = input2;
  13.116 +        }
  13.117 +
  13.118 +        public final boolean output() {
  13.119 +            return input1.output() && input2.output();
  13.120 +        }
  13.121 +    }
  13.122 +
  13.123 +    private final static class Or extends Circuit {
  13.124 +        private Circuit input1;
  13.125 +        private Circuit input2;
  13.126 +
  13.127 +
  13.128 +        Or(boolean input1, boolean input2) {
  13.129 +            this.input1 = new Primitive(input1);
  13.130 +            this.input2 = new Primitive(input2);
  13.131 +        }
  13.132 +
  13.133 +        Or(Circuit input1, Circuit input2) {
  13.134 +            this.input1 = input1;
  13.135 +            this.input2 = input2;
  13.136 +        }
  13.137 +
  13.138 +        public final boolean output() {
  13.139 +            return input1.output() || input2.output();
  13.140 +        }
  13.141 +    }
  13.142 +  }
  13.143 \ No newline at end of file
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/samples/apifest1/day1/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    14.3 @@ -0,0 +1,126 @@
    14.4 +/*
    14.5 + * The contents of this file are subject to the terms of the Common Development
    14.6 + * and Distribution License (the License). You may not use this file except in
    14.7 + * compliance with the License.
    14.8 + *
    14.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   14.10 + * or http://www.netbeans.org/cddl.txt.
   14.11 + *
   14.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   14.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   14.14 + * If applicable, add the following below the CDDL Header, with the fields
   14.15 + * enclosed by brackets [] replaced by your own identifying information:
   14.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   14.17 + *
   14.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   14.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   14.20 + * Microsystems, Inc. All Rights Reserved.
   14.21 + */
   14.22 +
   14.23 +package org.netbeans.apifest.boolcircuit;
   14.24 +
   14.25 +import java.security.CodeSource;
   14.26 +import java.security.Permission;
   14.27 +import java.security.PermissionCollection;
   14.28 +import java.security.Policy;
   14.29 +import java.util.Collection;
   14.30 +import java.util.Collections;
   14.31 +import java.util.Enumeration;
   14.32 +import junit.framework.TestCase;
   14.33 +import junit.framework.*;
   14.34 +
   14.35 +/** The initial quest for this APIFest is to create an API for boolean 
   14.36 + * circuits. Such API shall be able to compose a boolean circuit from
   14.37 + * basic elements and evaluate the result given initial values for 
   14.38 + * input variables.
   14.39 + * <p>
   14.40 + * The basic elements include:
   14.41 + * <ul>
   14.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   14.43 + *          on output 1 and 1 to 0
   14.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   14.45 + *          inputs are 1, otherwise it is 0
   14.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   14.47 + *          in the case when both inputs are 0
   14.48 + * </ul>
   14.49 + *
   14.50 + * <p>
   14.51 + * The boolean circuit can be used to represent boolean formulas and compute
   14.52 + * the results for certain values of its inputs. The individual tasks described
   14.53 + * as tests bellow.
   14.54 + *
   14.55 + * <p>
   14.56 + * Links of interest:
   14.57 + * <ul>
   14.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   14.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   14.60 + * </ul>
   14.61 + */
   14.62 +public class CircuitTest extends TestCase {
   14.63 +    static {
   14.64 +        // your code shall run without any permissions
   14.65 +    }
   14.66 +    
   14.67 +    public CircuitTest(String testName) {
   14.68 +        super(testName);
   14.69 +    }
   14.70 +
   14.71 +    protected void setUp() throws Exception {
   14.72 +    }
   14.73 +
   14.74 +    protected void tearDown() throws Exception {
   14.75 +    }
   14.76 +    
   14.77 +    // BEGIN: apifest.day1.alwayscreatenewcircuit.CircuitTest
   14.78 +    /** 
   14.79 +     * Create a circuit to evaluate x1 and x2 and then
   14.80 +     * verify that its result is false for input (false, true) and
   14.81 +     * it is true for input (true, true).
   14.82 +     */
   14.83 +    public void testX1andX2() {
   14.84 +        boolean x1 = true;
   14.85 +        boolean x2 = true;
   14.86 +
   14.87 +        Circuit outputCircuit = Circuit.and(x1, x2);
   14.88 +        assertTrue(outputCircuit.output());
   14.89 +
   14.90 +        x1 = false;
   14.91 +        x2 = true;
   14.92 +        outputCircuit = Circuit.and(x1, x2);
   14.93 +        assertFalse(outputCircuit.output());
   14.94 +    }
   14.95 +    
   14.96 +    /** 
   14.97 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   14.98 +     * verify that its result is false for input (false, true, false) and
   14.99 +     * it is true for input (false, false, true).
  14.100 +     */
  14.101 +    public void testX1andX2orX3() {
  14.102 +        boolean x1 = false;
  14.103 +        boolean x2 = true;
  14.104 +        boolean x3 = false;
  14.105 +        Circuit outputCircuit = Circuit.or(Circuit.and(x1,x2),x3);
  14.106 +        assertFalse(outputCircuit.output());
  14.107 +
  14.108 +        x1 = false;
  14.109 +        x2 = false;
  14.110 +        x3 = true;
  14.111 +        outputCircuit = Circuit.or(Circuit.and(x1,x2),x3);
  14.112 +        assertTrue(outputCircuit.output());
  14.113 +    }
  14.114 +    /** 
  14.115 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  14.116 +     * verify that its result is true for all values of x1.
  14.117 +     */
  14.118 +    public void testAlwaysTrue() {
  14.119 +        boolean x1 = true;
  14.120 +        Circuit outputCircuit = Circuit.or(x1,Circuit.negate(x1));
  14.121 +        assertTrue(outputCircuit.output());
  14.122 +
  14.123 +        x1 = false;
  14.124 +        outputCircuit = Circuit.or(x1,Circuit.negate(x1));
  14.125 +        assertTrue(outputCircuit.output());
  14.126 +    }
  14.127 +    // END: apifest.day1.alwayscreatenewcircuit.CircuitTest
  14.128 +    
  14.129 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/samples/apifest1/day1/elementbasedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
    15.3 @@ -0,0 +1,69 @@
    15.4 +<?xml version="1.0" encoding="UTF-8"?>
    15.5 +<!-- You may freely edit this file. See commented blocks below for -->
    15.6 +<!-- some examples of how to customize the build. -->
    15.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    15.8 +<project name="elementbasedsolution" default="default" basedir=".">
    15.9 +    <description>Builds, tests, and runs the project elementbasedsolution.</description>
   15.10 +    <import file="nbproject/build-impl.xml"/>
   15.11 +    <!--
   15.12 +
   15.13 +    There exist several targets which are by default empty and which can be 
   15.14 +    used for execution of your tasks. These targets are usually executed 
   15.15 +    before and after some main targets. They are: 
   15.16 +
   15.17 +      -pre-init:                 called before initialization of project properties
   15.18 +      -post-init:                called after initialization of project properties
   15.19 +      -pre-compile:              called before javac compilation
   15.20 +      -post-compile:             called after javac compilation
   15.21 +      -pre-compile-single:       called before javac compilation of single file
   15.22 +      -post-compile-single:      called after javac compilation of single file
   15.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   15.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   15.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   15.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   15.27 +      -pre-jar:                  called before JAR building
   15.28 +      -post-jar:                 called after JAR building
   15.29 +      -post-clean:               called after cleaning build products
   15.30 +
   15.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   15.32 +
   15.33 +    Example of inserting an obfuscator after compilation could look like this:
   15.34 +
   15.35 +        <target name="-post-compile">
   15.36 +            <obfuscate>
   15.37 +                <fileset dir="${build.classes.dir}"/>
   15.38 +            </obfuscate>
   15.39 +        </target>
   15.40 +
   15.41 +    For list of available properties check the imported 
   15.42 +    nbproject/build-impl.xml file. 
   15.43 +
   15.44 +
   15.45 +    Another way to customize the build is by overriding existing main targets.
   15.46 +    The targets of interest are: 
   15.47 +
   15.48 +      -init-macrodef-javac:     defines macro for javac compilation
   15.49 +      -init-macrodef-junit:     defines macro for junit execution
   15.50 +      -init-macrodef-debug:     defines macro for class debugging
   15.51 +      -init-macrodef-java:      defines macro for class execution
   15.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   15.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   15.54 +      run:                      execution of project 
   15.55 +      -javadoc-build:           Javadoc generation
   15.56 +      test-report:              JUnit report generation
   15.57 +
   15.58 +    An example of overriding the target for project execution could look like this:
   15.59 +
   15.60 +        <target name="run" depends="elementbasedsolution-impl.jar">
   15.61 +            <exec dir="bin" executable="launcher.exe">
   15.62 +                <arg file="${dist.jar}"/>
   15.63 +            </exec>
   15.64 +        </target>
   15.65 +
   15.66 +    Notice that the overridden target depends on the jar target and not only on 
   15.67 +    the compile target as the regular run target does. Again, for a list of available 
   15.68 +    properties which you can use, check the target you are overriding in the
   15.69 +    nbproject/build-impl.xml file. 
   15.70 +
   15.71 +    -->
   15.72 +</project>
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/samples/apifest1/day1/elementbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    16.3 @@ -0,0 +1,547 @@
    16.4 +<?xml version="1.0" encoding="UTF-8"?>
    16.5 +<!--
    16.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    16.7 +***         EDIT ../build.xml INSTEAD         ***
    16.8 +
    16.9 +For the purpose of easier reading the script
   16.10 +is divided into following sections:
   16.11 +
   16.12 +  - initialization
   16.13 +  - compilation
   16.14 +  - jar
   16.15 +  - execution
   16.16 +  - debugging
   16.17 +  - javadoc
   16.18 +  - junit compilation
   16.19 +  - junit execution
   16.20 +  - junit debugging
   16.21 +  - applet
   16.22 +  - cleanup
   16.23 +
   16.24 +-->
   16.25 +<project name="elementbasedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   16.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   16.27 +    <!-- 
   16.28 +    ======================
   16.29 +    INITIALIZATION SECTION 
   16.30 +    ======================
   16.31 +    -->
   16.32 +    <target name="-pre-init">
   16.33 +        <!-- Empty placeholder for easier customization. -->
   16.34 +        <!-- You can override this target in the ../build.xml file. -->
   16.35 +    </target>
   16.36 +    <target name="-init-private" depends="-pre-init">
   16.37 +        <property file="nbproject/private/private.properties"/>
   16.38 +    </target>
   16.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   16.40 +        <property file="${user.properties.file}"/>
   16.41 +        <!-- The two properties below are usually overridden -->
   16.42 +        <!-- by the active platform. Just a fallback. -->
   16.43 +        <property name="default.javac.source" value="1.4"/>
   16.44 +        <property name="default.javac.target" value="1.4"/>
   16.45 +    </target>
   16.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   16.47 +        <property file="nbproject/project.properties"/>
   16.48 +    </target>
   16.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   16.50 +        <available file="${manifest.file}" property="manifest.available"/>
   16.51 +        <condition property="manifest.available+main.class">
   16.52 +            <and>
   16.53 +                <isset property="manifest.available"/>
   16.54 +                <isset property="main.class"/>
   16.55 +                <not>
   16.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   16.57 +                </not>
   16.58 +            </and>
   16.59 +        </condition>
   16.60 +        <condition property="manifest.available+main.class+mkdist.available">
   16.61 +            <and>
   16.62 +                <istrue value="${manifest.available+main.class}"/>
   16.63 +                <isset property="libs.CopyLibs.classpath"/>
   16.64 +            </and>
   16.65 +        </condition>
   16.66 +        <condition property="have.tests">
   16.67 +            <or>
   16.68 +                <available file="${test.src.dir}"/>
   16.69 +            </or>
   16.70 +        </condition>
   16.71 +        <condition property="have.sources">
   16.72 +            <or>
   16.73 +                <available file="${src.dir}"/>
   16.74 +            </or>
   16.75 +        </condition>
   16.76 +        <condition property="netbeans.home+have.tests">
   16.77 +            <and>
   16.78 +                <isset property="netbeans.home"/>
   16.79 +                <isset property="have.tests"/>
   16.80 +            </and>
   16.81 +        </condition>
   16.82 +        <condition property="no.javadoc.preview">
   16.83 +            <isfalse value="${javadoc.preview}"/>
   16.84 +        </condition>
   16.85 +        <property name="run.jvmargs" value=""/>
   16.86 +        <property name="javac.compilerargs" value=""/>
   16.87 +        <property name="work.dir" value="${basedir}"/>
   16.88 +        <condition property="no.deps">
   16.89 +            <and>
   16.90 +                <istrue value="${no.dependencies}"/>
   16.91 +            </and>
   16.92 +        </condition>
   16.93 +        <property name="javac.debug" value="true"/>
   16.94 +        <property name="javadoc.preview" value="true"/>
   16.95 +        <property name="application.args" value=""/>
   16.96 +    </target>
   16.97 +    <target name="-post-init">
   16.98 +        <!-- Empty placeholder for easier customization. -->
   16.99 +        <!-- You can override this target in the ../build.xml file. -->
  16.100 +    </target>
  16.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  16.102 +        <fail unless="src.dir">Must set src.dir</fail>
  16.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  16.104 +        <fail unless="build.dir">Must set build.dir</fail>
  16.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  16.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  16.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  16.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  16.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  16.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  16.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  16.112 +    </target>
  16.113 +    <target name="-init-macrodef-property">
  16.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  16.115 +            <attribute name="name"/>
  16.116 +            <attribute name="value"/>
  16.117 +            <sequential>
  16.118 +                <property name="@{name}" value="${@{value}}"/>
  16.119 +            </sequential>
  16.120 +        </macrodef>
  16.121 +    </target>
  16.122 +    <target name="-init-macrodef-javac">
  16.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  16.124 +            <attribute name="srcdir" default="${src.dir}"/>
  16.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  16.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  16.127 +            <attribute name="debug" default="${javac.debug}"/>
  16.128 +            <element name="customize" optional="true"/>
  16.129 +            <sequential>
  16.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  16.131 +                    <classpath>
  16.132 +                        <path path="@{classpath}"/>
  16.133 +                    </classpath>
  16.134 +                </depend>
  16.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  16.136 +                    <classpath>
  16.137 +                        <path path="@{classpath}"/>
  16.138 +                    </classpath>
  16.139 +                    <compilerarg line="${javac.compilerargs}"/>
  16.140 +                    <customize/>
  16.141 +                </javac>
  16.142 +            </sequential>
  16.143 +        </macrodef>
  16.144 +    </target>
  16.145 +    <target name="-init-macrodef-junit">
  16.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  16.147 +            <attribute name="includes" default="**/*Test.java"/>
  16.148 +            <sequential>
  16.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  16.150 +                    <batchtest todir="${build.test.results.dir}">
  16.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  16.152 +                    </batchtest>
  16.153 +                    <classpath>
  16.154 +                        <path path="${run.test.classpath}"/>
  16.155 +                    </classpath>
  16.156 +                    <syspropertyset>
  16.157 +                        <propertyref prefix="test-sys-prop."/>
  16.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  16.159 +                    </syspropertyset>
  16.160 +                    <formatter type="brief" usefile="false"/>
  16.161 +                    <formatter type="xml"/>
  16.162 +                    <jvmarg line="${run.jvmargs}"/>
  16.163 +                </junit>
  16.164 +            </sequential>
  16.165 +        </macrodef>
  16.166 +    </target>
  16.167 +    <target name="-init-macrodef-nbjpda">
  16.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  16.169 +            <attribute name="name" default="${main.class}"/>
  16.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  16.171 +            <attribute name="stopclassname" default=""/>
  16.172 +            <sequential>
  16.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  16.174 +                    <classpath>
  16.175 +                        <path path="@{classpath}"/>
  16.176 +                    </classpath>
  16.177 +                </nbjpdastart>
  16.178 +            </sequential>
  16.179 +        </macrodef>
  16.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  16.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  16.182 +            <sequential>
  16.183 +                <nbjpdareload>
  16.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  16.185 +                </nbjpdareload>
  16.186 +            </sequential>
  16.187 +        </macrodef>
  16.188 +    </target>
  16.189 +    <target name="-init-macrodef-debug">
  16.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  16.191 +            <attribute name="classname" default="${main.class}"/>
  16.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  16.193 +            <element name="customize" optional="true"/>
  16.194 +            <sequential>
  16.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  16.196 +                    <jvmarg value="-Xdebug"/>
  16.197 +                    <jvmarg value="-Xnoagent"/>
  16.198 +                    <jvmarg value="-Djava.compiler=none"/>
  16.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  16.200 +                    <jvmarg line="${run.jvmargs}"/>
  16.201 +                    <classpath>
  16.202 +                        <path path="@{classpath}"/>
  16.203 +                    </classpath>
  16.204 +                    <syspropertyset>
  16.205 +                        <propertyref prefix="run-sys-prop."/>
  16.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  16.207 +                    </syspropertyset>
  16.208 +                    <customize/>
  16.209 +                </java>
  16.210 +            </sequential>
  16.211 +        </macrodef>
  16.212 +    </target>
  16.213 +    <target name="-init-macrodef-java">
  16.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  16.215 +            <attribute name="classname" default="${main.class}"/>
  16.216 +            <element name="customize" optional="true"/>
  16.217 +            <sequential>
  16.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  16.219 +                    <jvmarg line="${run.jvmargs}"/>
  16.220 +                    <classpath>
  16.221 +                        <path path="${run.classpath}"/>
  16.222 +                    </classpath>
  16.223 +                    <syspropertyset>
  16.224 +                        <propertyref prefix="run-sys-prop."/>
  16.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  16.226 +                    </syspropertyset>
  16.227 +                    <customize/>
  16.228 +                </java>
  16.229 +            </sequential>
  16.230 +        </macrodef>
  16.231 +    </target>
  16.232 +    <target name="-init-presetdef-jar">
  16.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  16.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  16.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  16.236 +            </jar>
  16.237 +        </presetdef>
  16.238 +    </target>
  16.239 +    <target name="init" 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"/>
  16.240 +    <!--
  16.241 +    ===================
  16.242 +    COMPILATION SECTION
  16.243 +    ===================
  16.244 +    -->
  16.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  16.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  16.247 +        <mkdir dir="${build.classes.dir}"/>
  16.248 +    </target>
  16.249 +    <target name="-pre-compile">
  16.250 +        <!-- Empty placeholder for easier customization. -->
  16.251 +        <!-- You can override this target in the ../build.xml file. -->
  16.252 +    </target>
  16.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  16.254 +        <j2seproject3:javac/>
  16.255 +        <copy todir="${build.classes.dir}">
  16.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  16.257 +        </copy>
  16.258 +    </target>
  16.259 +    <target name="-post-compile">
  16.260 +        <!-- Empty placeholder for easier customization. -->
  16.261 +        <!-- You can override this target in the ../build.xml file. -->
  16.262 +    </target>
  16.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  16.264 +    <target name="-pre-compile-single">
  16.265 +        <!-- Empty placeholder for easier customization. -->
  16.266 +        <!-- You can override this target in the ../build.xml file. -->
  16.267 +    </target>
  16.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  16.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  16.270 +        <j2seproject3:javac>
  16.271 +            <customize>
  16.272 +                <patternset includes="${javac.includes}"/>
  16.273 +            </customize>
  16.274 +        </j2seproject3:javac>
  16.275 +    </target>
  16.276 +    <target name="-post-compile-single">
  16.277 +        <!-- Empty placeholder for easier customization. -->
  16.278 +        <!-- You can override this target in the ../build.xml file. -->
  16.279 +    </target>
  16.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  16.281 +    <!--
  16.282 +    ====================
  16.283 +    JAR BUILDING SECTION
  16.284 +    ====================
  16.285 +    -->
  16.286 +    <target name="-pre-pre-jar" depends="init">
  16.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  16.288 +        <mkdir dir="${dist.jar.dir}"/>
  16.289 +    </target>
  16.290 +    <target name="-pre-jar">
  16.291 +        <!-- Empty placeholder for easier customization. -->
  16.292 +        <!-- You can override this target in the ../build.xml file. -->
  16.293 +    </target>
  16.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  16.295 +        <j2seproject1:jar/>
  16.296 +    </target>
  16.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  16.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  16.299 +    </target>
  16.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  16.301 +        <j2seproject1:jar manifest="${manifest.file}">
  16.302 +            <j2seproject1:manifest>
  16.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  16.304 +            </j2seproject1:manifest>
  16.305 +        </j2seproject1:jar>
  16.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  16.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  16.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  16.309 +        <pathconvert property="run.classpath.with.dist.jar">
  16.310 +            <path path="${run.classpath}"/>
  16.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  16.312 +        </pathconvert>
  16.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  16.314 +    </target>
  16.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  16.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  16.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  16.318 +            <path path="${run.classpath}"/>
  16.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  16.320 +        </pathconvert>
  16.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  16.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  16.323 +            <chainedmapper>
  16.324 +                <flattenmapper/>
  16.325 +                <globmapper from="*" to="lib/*"/>
  16.326 +            </chainedmapper>
  16.327 +        </pathconvert>
  16.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  16.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  16.330 +            <fileset dir="${build.classes.dir}"/>
  16.331 +            <manifest>
  16.332 +                <attribute name="Main-Class" value="${main.class}"/>
  16.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  16.334 +            </manifest>
  16.335 +        </copylibs>
  16.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  16.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  16.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  16.339 +    </target>
  16.340 +    <target name="-post-jar">
  16.341 +        <!-- Empty placeholder for easier customization. -->
  16.342 +        <!-- You can override this target in the ../build.xml file. -->
  16.343 +    </target>
  16.344 +    <target name="jar" 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."/>
  16.345 +    <!--
  16.346 +    =================
  16.347 +    EXECUTION SECTION
  16.348 +    =================
  16.349 +    -->
  16.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  16.351 +        <j2seproject1:java>
  16.352 +            <customize>
  16.353 +                <arg line="${application.args}"/>
  16.354 +            </customize>
  16.355 +        </j2seproject1:java>
  16.356 +    </target>
  16.357 +    <target name="run-single" depends="init,compile-single">
  16.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  16.359 +        <j2seproject1:java classname="${run.class}"/>
  16.360 +    </target>
  16.361 +    <!--
  16.362 +    =================
  16.363 +    DEBUGGING SECTION
  16.364 +    =================
  16.365 +    -->
  16.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  16.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  16.368 +    </target>
  16.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  16.370 +        <j2seproject3:debug>
  16.371 +            <customize>
  16.372 +                <arg line="${application.args}"/>
  16.373 +            </customize>
  16.374 +        </j2seproject3:debug>
  16.375 +    </target>
  16.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  16.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  16.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  16.379 +    </target>
  16.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  16.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  16.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  16.383 +        <j2seproject3:debug classname="${debug.class}"/>
  16.384 +    </target>
  16.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  16.386 +    <target name="-pre-debug-fix" depends="init">
  16.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  16.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  16.389 +    </target>
  16.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  16.391 +        <j2seproject1:nbjpdareload/>
  16.392 +    </target>
  16.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  16.394 +    <!--
  16.395 +    ===============
  16.396 +    JAVADOC SECTION
  16.397 +    ===============
  16.398 +    -->
  16.399 +    <target name="-javadoc-build" depends="init">
  16.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  16.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  16.402 +            <classpath>
  16.403 +                <path path="${javac.classpath}"/>
  16.404 +            </classpath>
  16.405 +            <sourcepath>
  16.406 +                <pathelement location="${src.dir}"/>
  16.407 +            </sourcepath>
  16.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  16.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  16.410 +        </javadoc>
  16.411 +    </target>
  16.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  16.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  16.414 +    </target>
  16.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  16.416 +    <!--
  16.417 +    =========================
  16.418 +    JUNIT COMPILATION SECTION
  16.419 +    =========================
  16.420 +    -->
  16.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  16.422 +        <mkdir dir="${build.test.classes.dir}"/>
  16.423 +    </target>
  16.424 +    <target name="-pre-compile-test">
  16.425 +        <!-- Empty placeholder for easier customization. -->
  16.426 +        <!-- You can override this target in the ../build.xml file. -->
  16.427 +    </target>
  16.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  16.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  16.430 +        <copy todir="${build.test.classes.dir}">
  16.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  16.432 +        </copy>
  16.433 +    </target>
  16.434 +    <target name="-post-compile-test">
  16.435 +        <!-- Empty placeholder for easier customization. -->
  16.436 +        <!-- You can override this target in the ../build.xml file. -->
  16.437 +    </target>
  16.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  16.439 +    <target name="-pre-compile-test-single">
  16.440 +        <!-- Empty placeholder for easier customization. -->
  16.441 +        <!-- You can override this target in the ../build.xml file. -->
  16.442 +    </target>
  16.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  16.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  16.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  16.446 +            <customize>
  16.447 +                <patternset includes="${javac.includes}"/>
  16.448 +            </customize>
  16.449 +        </j2seproject3:javac>
  16.450 +        <copy todir="${build.test.classes.dir}">
  16.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  16.452 +        </copy>
  16.453 +    </target>
  16.454 +    <target name="-post-compile-test-single">
  16.455 +        <!-- Empty placeholder for easier customization. -->
  16.456 +        <!-- You can override this target in the ../build.xml file. -->
  16.457 +    </target>
  16.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  16.459 +    <!--
  16.460 +    =======================
  16.461 +    JUNIT EXECUTION SECTION
  16.462 +    =======================
  16.463 +    -->
  16.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  16.465 +        <mkdir dir="${build.test.results.dir}"/>
  16.466 +    </target>
  16.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  16.468 +        <j2seproject3:junit/>
  16.469 +    </target>
  16.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  16.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  16.472 +    </target>
  16.473 +    <target name="test-report" if="have.tests" depends="init"/>
  16.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  16.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  16.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  16.477 +        <mkdir dir="${build.test.results.dir}"/>
  16.478 +    </target>
  16.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  16.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  16.481 +        <j2seproject3:junit includes="${test.includes}"/>
  16.482 +    </target>
  16.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  16.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  16.485 +    </target>
  16.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  16.487 +    <!--
  16.488 +    =======================
  16.489 +    JUNIT DEBUGGING SECTION
  16.490 +    =======================
  16.491 +    -->
  16.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  16.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  16.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  16.495 +            <customize>
  16.496 +                <arg line="${test.class}"/>
  16.497 +            </customize>
  16.498 +        </j2seproject3:debug>
  16.499 +    </target>
  16.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  16.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  16.502 +    </target>
  16.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  16.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  16.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  16.506 +    </target>
  16.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  16.508 +    <!--
  16.509 +    =========================
  16.510 +    APPLET EXECUTION SECTION
  16.511 +    =========================
  16.512 +    -->
  16.513 +    <target name="run-applet" depends="init,compile-single">
  16.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  16.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  16.516 +            <customize>
  16.517 +                <arg value="${applet.url}"/>
  16.518 +            </customize>
  16.519 +        </j2seproject1:java>
  16.520 +    </target>
  16.521 +    <!--
  16.522 +    =========================
  16.523 +    APPLET DEBUGGING  SECTION
  16.524 +    =========================
  16.525 +    -->
  16.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  16.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  16.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  16.529 +            <customize>
  16.530 +                <arg value="${applet.url}"/>
  16.531 +            </customize>
  16.532 +        </j2seproject3:debug>
  16.533 +    </target>
  16.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  16.535 +    <!--
  16.536 +    ===============
  16.537 +    CLEANUP SECTION
  16.538 +    ===============
  16.539 +    -->
  16.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  16.541 +    <target name="-do-clean" depends="init">
  16.542 +        <delete dir="${build.dir}"/>
  16.543 +        <delete dir="${dist.dir}"/>
  16.544 +    </target>
  16.545 +    <target name="-post-clean">
  16.546 +        <!-- Empty placeholder for easier customization. -->
  16.547 +        <!-- You can override this target in the ../build.xml file. -->
  16.548 +    </target>
  16.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  16.550 +</project>
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/samples/apifest1/day1/elementbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    17.3 @@ -0,0 +1,8 @@
    17.4 +build.xml.data.CRC32=3856b393
    17.5 +build.xml.script.CRC32=5c47136e
    17.6 +build.xml.stylesheet.CRC32=a12b3d02
    17.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    17.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    17.9 +nbproject/build-impl.xml.data.CRC32=3856b393
   17.10 +nbproject/build-impl.xml.script.CRC32=6771a052
   17.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/samples/apifest1/day1/elementbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    18.3 @@ -0,0 +1,56 @@
    18.4 +build.classes.dir=${build.dir}/classes
    18.5 +build.classes.excludes=**/*.java,**/*.form
    18.6 +# This directory is removed when the project is cleaned:
    18.7 +build.dir=build
    18.8 +build.generated.dir=${build.dir}/generated
    18.9 +# Only compile against the classpath explicitly listed here:
   18.10 +build.sysclasspath=ignore
   18.11 +build.test.classes.dir=${build.dir}/test/classes
   18.12 +build.test.results.dir=${build.dir}/test/results
   18.13 +debug.classpath=\
   18.14 +    ${run.classpath}
   18.15 +debug.test.classpath=\
   18.16 +    ${run.test.classpath}
   18.17 +# This directory is removed when the project is cleaned:
   18.18 +dist.dir=dist
   18.19 +dist.jar=${dist.dir}/boolcircuit.jar
   18.20 +dist.javadoc.dir=${dist.dir}/javadoc
   18.21 +jar.compress=false
   18.22 +javac.classpath=
   18.23 +# Space-separated list of extra javac options
   18.24 +javac.compilerargs=
   18.25 +javac.deprecation=false
   18.26 +javac.source=1.5
   18.27 +javac.target=1.5
   18.28 +javac.test.classpath=\
   18.29 +    ${javac.classpath}:\
   18.30 +    ${build.classes.dir}:\
   18.31 +    ${libs.junit.classpath}
   18.32 +javadoc.additionalparam=
   18.33 +javadoc.author=false
   18.34 +javadoc.encoding=
   18.35 +javadoc.noindex=false
   18.36 +javadoc.nonavbar=false
   18.37 +javadoc.notree=false
   18.38 +javadoc.private=false
   18.39 +javadoc.splitindex=true
   18.40 +javadoc.use=true
   18.41 +javadoc.version=false
   18.42 +javadoc.windowtitle=
   18.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   18.44 +# The library definition has always preference over this property.
   18.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   18.46 +meta.inf.dir=${src.dir}/META-INF
   18.47 +platform.active=default_platform
   18.48 +run.classpath=\
   18.49 +    ${javac.classpath}:\
   18.50 +    ${build.classes.dir}
   18.51 +# Space-separated list of JVM arguments used when running the project
   18.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   18.53 +# or test-sys-prop.name=value to set system properties for unit tests):
   18.54 +run.jvmargs=
   18.55 +run.test.classpath=\
   18.56 +    ${javac.test.classpath}:\
   18.57 +    ${build.test.classes.dir}
   18.58 +src.dir=src
   18.59 +test.src.dir=test
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/samples/apifest1/day1/elementbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    19.3 @@ -0,0 +1,16 @@
    19.4 +<?xml version="1.0" encoding="UTF-8"?>
    19.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    19.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    19.7 +    <configuration>
    19.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    19.9 +            <name>elementbasedsolution</name>
   19.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   19.11 +            <source-roots>
   19.12 +                <root id="src.dir"/>
   19.13 +            </source-roots>
   19.14 +            <test-roots>
   19.15 +                <root id="test.src.dir"/>
   19.16 +            </test-roots>
   19.17 +        </data>
   19.18 +    </configuration>
   19.19 +</project>
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/samples/apifest1/day1/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    20.3 @@ -0,0 +1,73 @@
    20.4 +/*
    20.5 + * The contents of this file are subject to the terms of the Common Development
    20.6 + * and Distribution License (the License). You may not use this file except in
    20.7 + * compliance with the License.
    20.8 + *
    20.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   20.10 + * or http://www.netbeans.org/cddl.txt.
   20.11 + *
   20.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   20.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   20.14 + * If applicable, add the following below the CDDL Header, with the fields
   20.15 + * enclosed by brackets [] replaced by your own identifying information:
   20.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   20.17 + *
   20.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   20.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   20.20 + * Microsystems, Inc. All Rights Reserved.
   20.21 + */
   20.22 +
   20.23 +package org.netbeans.apifest.boolcircuit;
   20.24 +
   20.25 +/**
   20.26 + */
   20.27 +public final class Circuit {
   20.28 +    private Circuit() {
   20.29 +    }
   20.30 +    
   20.31 +    public static Element and(final Element e1, final Element e2) {
   20.32 +        return new Element() {
   20.33 +            public boolean result() {
   20.34 +                return e1.result() && e2.result();
   20.35 +            }
   20.36 +        };
   20.37 +    }
   20.38 +    public static Element or(final Element e1, final Element e2) {
   20.39 +        return new Element() {
   20.40 +            public boolean result() {
   20.41 +                return e1.result() || e2.result();
   20.42 +            }
   20.43 +        };
   20.44 +    }
   20.45 +
   20.46 +    public static Element not(final Element e1) {
   20.47 +        return new Element() {
   20.48 +            public boolean result() {
   20.49 +                return !e1.result();
   20.50 +            }
   20.51 +        };
   20.52 +    }
   20.53 +    
   20.54 +    public static Variable var() {
   20.55 +        return new Variable();
   20.56 +    }
   20.57 +    
   20.58 +    public static abstract class Element {
   20.59 +        private Element() {
   20.60 +        }
   20.61 +        
   20.62 +        public abstract boolean result();
   20.63 +    }
   20.64 +    
   20.65 +    public static final class Variable extends Element {
   20.66 +        private boolean value;
   20.67 +        
   20.68 +        public void assignValue(boolean b) {
   20.69 +            value = b;
   20.70 +        }
   20.71 +
   20.72 +        public boolean result() {
   20.73 +            return value;
   20.74 +        }
   20.75 +    }
   20.76 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/samples/apifest1/day1/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    21.3 @@ -0,0 +1,132 @@
    21.4 +/*
    21.5 + * The contents of this file are subject to the terms of the Common Development
    21.6 + * and Distribution License (the License). You may not use this file except in
    21.7 + * compliance with the License.
    21.8 + *
    21.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   21.10 + * or http://www.netbeans.org/cddl.txt.
   21.11 + *
   21.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   21.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   21.14 + * If applicable, add the following below the CDDL Header, with the fields
   21.15 + * enclosed by brackets [] replaced by your own identifying information:
   21.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   21.17 + *
   21.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   21.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   21.20 + * Microsystems, Inc. All Rights Reserved.
   21.21 + */
   21.22 +
   21.23 +package org.netbeans.apifest.boolcircuit;
   21.24 +
   21.25 +import java.security.CodeSource;
   21.26 +import java.security.Permission;
   21.27 +import java.security.PermissionCollection;
   21.28 +import java.security.Policy;
   21.29 +import java.util.Collection;
   21.30 +import java.util.Collections;
   21.31 +import java.util.Enumeration;
   21.32 +import junit.framework.TestCase;
   21.33 +import junit.framework.*;
   21.34 +
   21.35 +/** The initial quest for this APIFest is to create an API for boolean 
   21.36 + * circuits. Such API shall be able to compose a boolean circuit from
   21.37 + * basic elements and evaluate the result given initial values for 
   21.38 + * input variables.
   21.39 + * <p>
   21.40 + * The basic elements include:
   21.41 + * <ul>
   21.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   21.43 + *          on output 1 and 1 to 0
   21.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   21.45 + *          inputs are 1, otherwise it is 0
   21.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   21.47 + *          in the case when both inputs are 0
   21.48 + * </ul>
   21.49 + *
   21.50 + * <p>
   21.51 + * The boolean circuit can be used to represent boolean formulas and compute
   21.52 + * the results for certain values of its inputs. The individual tasks described
   21.53 + * as tests bellow.
   21.54 + *
   21.55 + * <p>
   21.56 + * Links of interest:
   21.57 + * <ul>
   21.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   21.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   21.60 + * </ul>
   21.61 + */
   21.62 +public class CircuitTest extends TestCase {
   21.63 +    static {
   21.64 +        // your code shall run without any permissions
   21.65 +    }
   21.66 +    
   21.67 +    public CircuitTest(String testName) {
   21.68 +        super(testName);
   21.69 +    }
   21.70 +
   21.71 +    protected void setUp() throws Exception {
   21.72 +    }
   21.73 +
   21.74 +    protected void tearDown() throws Exception {
   21.75 +    }
   21.76 +    
   21.77 +    
   21.78 +    /** 
   21.79 +     * Create a circuit to evaluate x1 and x2 and then
   21.80 +     * verify that its result is false for input (false, true) and
   21.81 +     * it is true for input (true, true).
   21.82 +     */
   21.83 +    public void testX1andX2() {
   21.84 +        Circuit.Variable x1 = Circuit.var();
   21.85 +        Circuit.Variable x2 = Circuit.var();
   21.86 +        
   21.87 +        Circuit.Element res = Circuit.and(x1, x2);
   21.88 +        
   21.89 +        x1.assignValue(false);
   21.90 +        x2.assignValue(true);
   21.91 +        assertFalse(res.result());
   21.92 +        
   21.93 +        x1.assignValue(true);
   21.94 +        x2.assignValue(true);
   21.95 +        assertTrue(res.result());
   21.96 +    }
   21.97 +    
   21.98 +    /** 
   21.99 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  21.100 +     * verify that its result is false for input (false, true, false) and
  21.101 +     * it is true for input (false, false, true).
  21.102 +     */
  21.103 +    public void testX1andX2orX3() {
  21.104 +        Circuit.Variable x1 = Circuit.var();
  21.105 +        Circuit.Variable x2 = Circuit.var();
  21.106 +        Circuit.Variable x3 = Circuit.var();
  21.107 +
  21.108 +        Circuit.Element res = Circuit.or(Circuit.and(x1, x2), x3);
  21.109 +        
  21.110 +        x1.assignValue(false);
  21.111 +        x2.assignValue(true);
  21.112 +        x3.assignValue(false);
  21.113 +        assertFalse(res.result());
  21.114 +        
  21.115 +        x1.assignValue(false);
  21.116 +        x2.assignValue(false);
  21.117 +        x3.assignValue(true);
  21.118 +        assertTrue(res.result());
  21.119 +    }
  21.120 +    /** 
  21.121 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  21.122 +     * verify that its result is true for all values of x1.
  21.123 +     */
  21.124 +    public void testAlwaysTrue() {
  21.125 +        Circuit.Variable x1 = Circuit.var();
  21.126 +        
  21.127 +        Circuit.Element res = Circuit.or(x1, Circuit.not(x1));
  21.128 +        
  21.129 +        x1.assignValue(false);
  21.130 +        assertTrue(res.result());
  21.131 +        x1.assignValue(true);
  21.132 +        assertTrue(res.result());
  21.133 +    }
  21.134 +    
  21.135 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/samples/apifest1/day1/inputandoperation/build.xml	Sat Jun 14 09:52:45 2008 +0200
    22.3 @@ -0,0 +1,69 @@
    22.4 +<?xml version="1.0" encoding="UTF-8"?>
    22.5 +<!-- You may freely edit this file. See commented blocks below for -->
    22.6 +<!-- some examples of how to customize the build. -->
    22.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    22.8 +<project name="inputandoperation" default="default" basedir=".">
    22.9 +    <description>Builds, tests, and runs the project boolcircuit.</description>
   22.10 +    <import file="nbproject/build-impl.xml"/>
   22.11 +    <!--
   22.12 +
   22.13 +    There exist several targets which are by default empty and which can be 
   22.14 +    used for execution of your tasks. These targets are usually executed 
   22.15 +    before and after some main targets. They are: 
   22.16 +
   22.17 +      -pre-init:                 called before initialization of project properties
   22.18 +      -post-init:                called after initialization of project properties
   22.19 +      -pre-compile:              called before javac compilation
   22.20 +      -post-compile:             called after javac compilation
   22.21 +      -pre-compile-single:       called before javac compilation of single file
   22.22 +      -post-compile-single:      called after javac compilation of single file
   22.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   22.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   22.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   22.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   22.27 +      -pre-jar:                  called before JAR building
   22.28 +      -post-jar:                 called after JAR building
   22.29 +      -post-clean:               called after cleaning build products
   22.30 +
   22.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   22.32 +
   22.33 +    Example of inserting an obfuscator after compilation could look like this:
   22.34 +
   22.35 +        <target name="-post-compile">
   22.36 +            <obfuscate>
   22.37 +                <fileset dir="${build.classes.dir}"/>
   22.38 +            </obfuscate>
   22.39 +        </target>
   22.40 +
   22.41 +    For list of available properties check the imported 
   22.42 +    nbproject/build-impl.xml file. 
   22.43 +
   22.44 +
   22.45 +    Another way to customize the build is by overriding existing main targets.
   22.46 +    The targets of interest are: 
   22.47 +
   22.48 +      -init-macrodef-javac:     defines macro for javac compilation
   22.49 +      -init-macrodef-junit:     defines macro for junit execution
   22.50 +      -init-macrodef-debug:     defines macro for class debugging
   22.51 +      -init-macrodef-java:      defines macro for class execution
   22.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   22.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   22.54 +      run:                      execution of project 
   22.55 +      -javadoc-build:           Javadoc generation
   22.56 +      test-report:              JUnit report generation
   22.57 +
   22.58 +    An example of overriding the target for project execution could look like this:
   22.59 +
   22.60 +        <target name="run" depends="boolcircuit-impl.jar">
   22.61 +            <exec dir="bin" executable="launcher.exe">
   22.62 +                <arg file="${dist.jar}"/>
   22.63 +            </exec>
   22.64 +        </target>
   22.65 +
   22.66 +    Notice that the overridden target depends on the jar target and not only on 
   22.67 +    the compile target as the regular run target does. Again, for a list of available 
   22.68 +    properties which you can use, check the target you are overriding in the
   22.69 +    nbproject/build-impl.xml file. 
   22.70 +
   22.71 +    -->
   22.72 +</project>
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    23.3 @@ -0,0 +1,627 @@
    23.4 +<?xml version="1.0" encoding="UTF-8"?>
    23.5 +<!--
    23.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    23.7 +***         EDIT ../build.xml INSTEAD         ***
    23.8 +
    23.9 +For the purpose of easier reading the script
   23.10 +is divided into following sections:
   23.11 +
   23.12 +  - initialization
   23.13 +  - compilation
   23.14 +  - jar
   23.15 +  - execution
   23.16 +  - debugging
   23.17 +  - javadoc
   23.18 +  - junit compilation
   23.19 +  - junit execution
   23.20 +  - junit debugging
   23.21 +  - applet
   23.22 +  - cleanup
   23.23 +
   23.24 +        -->
   23.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="inputandoperation-impl">
   23.26 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   23.27 +    <!-- 
   23.28 +                ======================
   23.29 +                INITIALIZATION SECTION 
   23.30 +                ======================
   23.31 +            -->
   23.32 +    <target name="-pre-init">
   23.33 +        <!-- Empty placeholder for easier customization. -->
   23.34 +        <!-- You can override this target in the ../build.xml file. -->
   23.35 +    </target>
   23.36 +    <target depends="-pre-init" name="-init-private">
   23.37 +        <property file="nbproject/private/config.properties"/>
   23.38 +        <property file="nbproject/private/configs/${config}.properties"/>
   23.39 +        <property file="nbproject/private/private.properties"/>
   23.40 +    </target>
   23.41 +    <target depends="-pre-init,-init-private" name="-init-user">
   23.42 +        <property file="${user.properties.file}"/>
   23.43 +        <!-- The two properties below are usually overridden -->
   23.44 +        <!-- by the active platform. Just a fallback. -->
   23.45 +        <property name="default.javac.source" value="1.4"/>
   23.46 +        <property name="default.javac.target" value="1.4"/>
   23.47 +    </target>
   23.48 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   23.49 +        <property file="nbproject/configs/${config}.properties"/>
   23.50 +        <property file="nbproject/project.properties"/>
   23.51 +    </target>
   23.52 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   23.53 +        <available file="${manifest.file}" property="manifest.available"/>
   23.54 +        <condition property="manifest.available+main.class">
   23.55 +            <and>
   23.56 +                <isset property="manifest.available"/>
   23.57 +                <isset property="main.class"/>
   23.58 +                <not>
   23.59 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   23.60 +                </not>
   23.61 +            </and>
   23.62 +        </condition>
   23.63 +        <condition property="manifest.available+main.class+mkdist.available">
   23.64 +            <and>
   23.65 +                <istrue value="${manifest.available+main.class}"/>
   23.66 +                <isset property="libs.CopyLibs.classpath"/>
   23.67 +            </and>
   23.68 +        </condition>
   23.69 +        <condition property="have.tests">
   23.70 +            <or>
   23.71 +                <available file="${test.src.dir}"/>
   23.72 +            </or>
   23.73 +        </condition>
   23.74 +        <condition property="have.sources">
   23.75 +            <or>
   23.76 +                <available file="${src.dir}"/>
   23.77 +            </or>
   23.78 +        </condition>
   23.79 +        <condition property="netbeans.home+have.tests">
   23.80 +            <and>
   23.81 +                <isset property="netbeans.home"/>
   23.82 +                <isset property="have.tests"/>
   23.83 +            </and>
   23.84 +        </condition>
   23.85 +        <condition property="no.javadoc.preview">
   23.86 +            <and>
   23.87 +                <isset property="javadoc.preview"/>
   23.88 +                <isfalse value="${javadoc.preview}"/>
   23.89 +            </and>
   23.90 +        </condition>
   23.91 +        <property name="run.jvmargs" value=""/>
   23.92 +        <property name="javac.compilerargs" value=""/>
   23.93 +        <property name="work.dir" value="${basedir}"/>
   23.94 +        <condition property="no.deps">
   23.95 +            <and>
   23.96 +                <istrue value="${no.dependencies}"/>
   23.97 +            </and>
   23.98 +        </condition>
   23.99 +        <property name="javac.debug" value="true"/>
  23.100 +        <property name="javadoc.preview" value="true"/>
  23.101 +        <property name="application.args" value=""/>
  23.102 +        <property name="source.encoding" value="${file.encoding}"/>
  23.103 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  23.104 +            <and>
  23.105 +                <isset property="javadoc.encoding"/>
  23.106 +                <not>
  23.107 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
  23.108 +                </not>
  23.109 +            </and>
  23.110 +        </condition>
  23.111 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  23.112 +        <property name="includes" value="**"/>
  23.113 +        <property name="excludes" value=""/>
  23.114 +        <property name="do.depend" value="false"/>
  23.115 +        <condition property="do.depend.true">
  23.116 +            <istrue value="${do.depend}"/>
  23.117 +        </condition>
  23.118 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
  23.119 +            <and>
  23.120 +                <isset property="jaxws.endorsed.dir"/>
  23.121 +                <available file="nbproject/jaxws-build.xml"/>
  23.122 +            </and>
  23.123 +        </condition>
  23.124 +    </target>
  23.125 +    <target name="-post-init">
  23.126 +        <!-- Empty placeholder for easier customization. -->
  23.127 +        <!-- You can override this target in the ../build.xml file. -->
  23.128 +    </target>
  23.129 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  23.130 +        <fail unless="src.dir">Must set src.dir</fail>
  23.131 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  23.132 +        <fail unless="build.dir">Must set build.dir</fail>
  23.133 +        <fail unless="dist.dir">Must set dist.dir</fail>
  23.134 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  23.135 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  23.136 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  23.137 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  23.138 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  23.139 +        <fail unless="dist.jar">Must set dist.jar</fail>
  23.140 +    </target>
  23.141 +    <target name="-init-macrodef-property">
  23.142 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  23.143 +            <attribute name="name"/>
  23.144 +            <attribute name="value"/>
  23.145 +            <sequential>
  23.146 +                <property name="@{name}" value="${@{value}}"/>
  23.147 +            </sequential>
  23.148 +        </macrodef>
  23.149 +    </target>
  23.150 +    <target name="-init-macrodef-javac">
  23.151 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  23.152 +            <attribute default="${src.dir}" name="srcdir"/>
  23.153 +            <attribute default="${build.classes.dir}" name="destdir"/>
  23.154 +            <attribute default="${javac.classpath}" name="classpath"/>
  23.155 +            <attribute default="${includes}" name="includes"/>
  23.156 +            <attribute default="${excludes}" name="excludes"/>
  23.157 +            <attribute default="${javac.debug}" name="debug"/>
  23.158 +            <attribute default="" name="sourcepath"/>
  23.159 +            <element name="customize" optional="true"/>
  23.160 +            <sequential>
  23.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}">
  23.162 +                    <classpath>
  23.163 +                        <path path="@{classpath}"/>
  23.164 +                    </classpath>
  23.165 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
  23.166 +                    <customize/>
  23.167 +                </javac>
  23.168 +            </sequential>
  23.169 +        </macrodef>
  23.170 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  23.171 +            <attribute default="${src.dir}" name="srcdir"/>
  23.172 +            <attribute default="${build.classes.dir}" name="destdir"/>
  23.173 +            <attribute default="${javac.classpath}" name="classpath"/>
  23.174 +            <sequential>
  23.175 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  23.176 +                    <classpath>
  23.177 +                        <path path="@{classpath}"/>
  23.178 +                    </classpath>
  23.179 +                </depend>
  23.180 +            </sequential>
  23.181 +        </macrodef>
  23.182 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  23.183 +            <attribute default="${build.classes.dir}" name="destdir"/>
  23.184 +            <sequential>
  23.185 +                <fail unless="javac.includes">Must set javac.includes</fail>
  23.186 +                <pathconvert pathsep="," property="javac.includes.binary">
  23.187 +                    <path>
  23.188 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  23.189 +                    </path>
  23.190 +                    <globmapper from="*.java" to="*.class"/>
  23.191 +                </pathconvert>
  23.192 +                <delete>
  23.193 +                    <files includes="${javac.includes.binary}"/>
  23.194 +                </delete>
  23.195 +            </sequential>
  23.196 +        </macrodef>
  23.197 +    </target>
  23.198 +    <target name="-init-macrodef-junit">
  23.199 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  23.200 +            <attribute default="${includes}" name="includes"/>
  23.201 +            <attribute default="${excludes}" name="excludes"/>
  23.202 +            <attribute default="**" name="testincludes"/>
  23.203 +            <sequential>
  23.204 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
  23.205 +                    <batchtest todir="${build.test.results.dir}">
  23.206 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  23.207 +                            <filename name="@{testincludes}"/>
  23.208 +                        </fileset>
  23.209 +                    </batchtest>
  23.210 +                    <classpath>
  23.211 +                        <path path="${run.test.classpath}"/>
  23.212 +                    </classpath>
  23.213 +                    <syspropertyset>
  23.214 +                        <propertyref prefix="test-sys-prop."/>
  23.215 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  23.216 +                    </syspropertyset>
  23.217 +                    <formatter type="brief" usefile="false"/>
  23.218 +                    <formatter type="xml"/>
  23.219 +                    <jvmarg line="${run.jvmargs}"/>
  23.220 +                </junit>
  23.221 +            </sequential>
  23.222 +        </macrodef>
  23.223 +    </target>
  23.224 +    <target name="-init-macrodef-nbjpda">
  23.225 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  23.226 +            <attribute default="${main.class}" name="name"/>
  23.227 +            <attribute default="${debug.classpath}" name="classpath"/>
  23.228 +            <attribute default="" name="stopclassname"/>
  23.229 +            <sequential>
  23.230 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
  23.231 +                    <classpath>
  23.232 +                        <path path="@{classpath}"/>
  23.233 +                    </classpath>
  23.234 +                </nbjpdastart>
  23.235 +            </sequential>
  23.236 +        </macrodef>
  23.237 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  23.238 +            <attribute default="${build.classes.dir}" name="dir"/>
  23.239 +            <sequential>
  23.240 +                <nbjpdareload>
  23.241 +                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
  23.242 +                </nbjpdareload>
  23.243 +            </sequential>
  23.244 +        </macrodef>
  23.245 +    </target>
  23.246 +    <target name="-init-debug-args">
  23.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  23.248 +        <condition property="have-jdk-older-than-1.4">
  23.249 +            <or>
  23.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  23.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  23.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  23.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  23.254 +            </or>
  23.255 +        </condition>
  23.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  23.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
  23.258 +        </condition>
  23.259 +    </target>
  23.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  23.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  23.262 +            <attribute default="${main.class}" name="classname"/>
  23.263 +            <attribute default="${debug.classpath}" name="classpath"/>
  23.264 +            <element name="customize" optional="true"/>
  23.265 +            <sequential>
  23.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  23.267 +                    <jvmarg line="${debug-args-line}"/>
  23.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  23.269 +                    <jvmarg line="${run.jvmargs}"/>
  23.270 +                    <classpath>
  23.271 +                        <path path="@{classpath}"/>
  23.272 +                    </classpath>
  23.273 +                    <syspropertyset>
  23.274 +                        <propertyref prefix="run-sys-prop."/>
  23.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  23.276 +                    </syspropertyset>
  23.277 +                    <customize/>
  23.278 +                </java>
  23.279 +            </sequential>
  23.280 +        </macrodef>
  23.281 +    </target>
  23.282 +    <target name="-init-macrodef-java">
  23.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  23.284 +            <attribute default="${main.class}" name="classname"/>
  23.285 +            <element name="customize" optional="true"/>
  23.286 +            <sequential>
  23.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  23.288 +                    <jvmarg line="${run.jvmargs}"/>
  23.289 +                    <classpath>
  23.290 +                        <path path="${run.classpath}"/>
  23.291 +                    </classpath>
  23.292 +                    <syspropertyset>
  23.293 +                        <propertyref prefix="run-sys-prop."/>
  23.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  23.295 +                    </syspropertyset>
  23.296 +                    <customize/>
  23.297 +                </java>
  23.298 +            </sequential>
  23.299 +        </macrodef>
  23.300 +    </target>
  23.301 +    <target name="-init-presetdef-jar">
  23.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  23.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  23.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  23.305 +            </jar>
  23.306 +        </presetdef>
  23.307 +    </target>
  23.308 +    <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"/>
  23.309 +    <!--
  23.310 +                ===================
  23.311 +                COMPILATION SECTION
  23.312 +                ===================
  23.313 +            -->
  23.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  23.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  23.316 +        <mkdir dir="${build.classes.dir}"/>
  23.317 +    </target>
  23.318 +    <target name="-pre-compile">
  23.319 +        <!-- Empty placeholder for easier customization. -->
  23.320 +        <!-- You can override this target in the ../build.xml file. -->
  23.321 +    </target>
  23.322 +    <target if="do.depend.true" name="-compile-depend">
  23.323 +        <j2seproject3:depend/>
  23.324 +    </target>
  23.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  23.326 +        <j2seproject3:javac/>
  23.327 +        <copy todir="${build.classes.dir}">
  23.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  23.329 +        </copy>
  23.330 +    </target>
  23.331 +    <target name="-post-compile">
  23.332 +        <!-- Empty placeholder for easier customization. -->
  23.333 +        <!-- You can override this target in the ../build.xml file. -->
  23.334 +    </target>
  23.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  23.336 +    <target name="-pre-compile-single">
  23.337 +        <!-- Empty placeholder for easier customization. -->
  23.338 +        <!-- You can override this target in the ../build.xml file. -->
  23.339 +    </target>
  23.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  23.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  23.342 +        <j2seproject3:force-recompile/>
  23.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  23.344 +    </target>
  23.345 +    <target name="-post-compile-single">
  23.346 +        <!-- Empty placeholder for easier customization. -->
  23.347 +        <!-- You can override this target in the ../build.xml file. -->
  23.348 +    </target>
  23.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  23.350 +    <!--
  23.351 +                ====================
  23.352 +                JAR BUILDING SECTION
  23.353 +                ====================
  23.354 +            -->
  23.355 +    <target depends="init" name="-pre-pre-jar">
  23.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  23.357 +        <mkdir dir="${dist.jar.dir}"/>
  23.358 +    </target>
  23.359 +    <target name="-pre-jar">
  23.360 +        <!-- Empty placeholder for easier customization. -->
  23.361 +        <!-- You can override this target in the ../build.xml file. -->
  23.362 +    </target>
  23.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  23.364 +        <j2seproject1:jar/>
  23.365 +    </target>
  23.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  23.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
  23.368 +    </target>
  23.369 +    <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">
  23.370 +        <j2seproject1:jar manifest="${manifest.file}">
  23.371 +            <j2seproject1:manifest>
  23.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  23.373 +            </j2seproject1:manifest>
  23.374 +        </j2seproject1:jar>
  23.375 +        <echo>To run this application from the command line without Ant, try:</echo>
  23.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  23.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  23.378 +        <pathconvert property="run.classpath.with.dist.jar">
  23.379 +            <path path="${run.classpath}"/>
  23.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  23.381 +        </pathconvert>
  23.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  23.383 +    </target>
  23.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  23.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  23.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
  23.387 +            <path path="${run.classpath}"/>
  23.388 +            <map from="${build.classes.dir.resolved}" to=""/>
  23.389 +        </pathconvert>
  23.390 +        <pathconvert pathsep=" " property="jar.classpath">
  23.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
  23.392 +            <chainedmapper>
  23.393 +                <flattenmapper/>
  23.394 +                <globmapper from="*" to="lib/*"/>
  23.395 +            </chainedmapper>
  23.396 +        </pathconvert>
  23.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  23.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  23.399 +            <fileset dir="${build.classes.dir}"/>
  23.400 +            <manifest>
  23.401 +                <attribute name="Main-Class" value="${main.class}"/>
  23.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  23.403 +            </manifest>
  23.404 +        </copylibs>
  23.405 +        <echo>To run this application from the command line without Ant, try:</echo>
  23.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  23.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  23.408 +    </target>
  23.409 +    <target name="-post-jar">
  23.410 +        <!-- Empty placeholder for easier customization. -->
  23.411 +        <!-- You can override this target in the ../build.xml file. -->
  23.412 +    </target>
  23.413 +    <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"/>
  23.414 +    <!--
  23.415 +                =================
  23.416 +                EXECUTION SECTION
  23.417 +                =================
  23.418 +            -->
  23.419 +    <target depends="init,compile" description="Run a main class." name="run">
  23.420 +        <j2seproject1:java>
  23.421 +            <customize>
  23.422 +                <arg line="${application.args}"/>
  23.423 +            </customize>
  23.424 +        </j2seproject1:java>
  23.425 +    </target>
  23.426 +    <target name="-do-not-recompile">
  23.427 +        <property name="javac.includes.binary" value=""/>
  23.428 +    </target>
  23.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  23.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  23.431 +        <j2seproject1:java classname="${run.class}"/>
  23.432 +    </target>
  23.433 +    <!--
  23.434 +                =================
  23.435 +                DEBUGGING SECTION
  23.436 +                =================
  23.437 +            -->
  23.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  23.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  23.440 +    </target>
  23.441 +    <target depends="init,compile" name="-debug-start-debuggee">
  23.442 +        <j2seproject3:debug>
  23.443 +            <customize>
  23.444 +                <arg line="${application.args}"/>
  23.445 +            </customize>
  23.446 +        </j2seproject3:debug>
  23.447 +    </target>
  23.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  23.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  23.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  23.451 +    </target>
  23.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  23.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  23.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  23.455 +        <j2seproject3:debug classname="${debug.class}"/>
  23.456 +    </target>
  23.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  23.458 +    <target depends="init" name="-pre-debug-fix">
  23.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
  23.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
  23.461 +    </target>
  23.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  23.463 +        <j2seproject1:nbjpdareload/>
  23.464 +    </target>
  23.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  23.466 +    <!--
  23.467 +                ===============
  23.468 +                JAVADOC SECTION
  23.469 +                ===============
  23.470 +            -->
  23.471 +    <target depends="init" name="-javadoc-build">
  23.472 +        <mkdir dir="${dist.javadoc.dir}"/>
  23.473 +        <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}">
  23.474 +            <classpath>
  23.475 +                <path path="${javac.classpath}"/>
  23.476 +            </classpath>
  23.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  23.478 +                <filename name="**/*.java"/>
  23.479 +            </fileset>
  23.480 +        </javadoc>
  23.481 +    </target>
  23.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  23.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  23.484 +    </target>
  23.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  23.486 +    <!--
  23.487 +                =========================
  23.488 +                JUNIT COMPILATION SECTION
  23.489 +                =========================
  23.490 +            -->
  23.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  23.492 +        <mkdir dir="${build.test.classes.dir}"/>
  23.493 +    </target>
  23.494 +    <target name="-pre-compile-test">
  23.495 +        <!-- Empty placeholder for easier customization. -->
  23.496 +        <!-- You can override this target in the ../build.xml file. -->
  23.497 +    </target>
  23.498 +    <target if="do.depend.true" name="-compile-test-depend">
  23.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  23.500 +    </target>
  23.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  23.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  23.503 +        <copy todir="${build.test.classes.dir}">
  23.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  23.505 +        </copy>
  23.506 +    </target>
  23.507 +    <target name="-post-compile-test">
  23.508 +        <!-- Empty placeholder for easier customization. -->
  23.509 +        <!-- You can override this target in the ../build.xml file. -->
  23.510 +    </target>
  23.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  23.512 +    <target name="-pre-compile-test-single">
  23.513 +        <!-- Empty placeholder for easier customization. -->
  23.514 +        <!-- You can override this target in the ../build.xml file. -->
  23.515 +    </target>
  23.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  23.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  23.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  23.519 +        <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}"/>
  23.520 +        <copy todir="${build.test.classes.dir}">
  23.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  23.522 +        </copy>
  23.523 +    </target>
  23.524 +    <target name="-post-compile-test-single">
  23.525 +        <!-- Empty placeholder for easier customization. -->
  23.526 +        <!-- You can override this target in the ../build.xml file. -->
  23.527 +    </target>
  23.528 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
  23.529 +    <!--
  23.530 +                =======================
  23.531 +                JUNIT EXECUTION SECTION
  23.532 +                =======================
  23.533 +            -->
  23.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
  23.535 +        <mkdir dir="${build.test.results.dir}"/>
  23.536 +    </target>
  23.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  23.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  23.539 +    </target>
  23.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  23.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  23.542 +    </target>
  23.543 +    <target depends="init" if="have.tests" name="test-report"/>
  23.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  23.545 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
  23.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  23.547 +        <mkdir dir="${build.test.results.dir}"/>
  23.548 +    </target>
  23.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  23.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  23.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  23.552 +    </target>
  23.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  23.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  23.555 +    </target>
  23.556 +    <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"/>
  23.557 +    <!--
  23.558 +                =======================
  23.559 +                JUNIT DEBUGGING SECTION
  23.560 +                =======================
  23.561 +            -->
  23.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  23.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  23.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  23.565 +        <delete file="${test.report.file}"/>
  23.566 +        <mkdir dir="${build.test.results.dir}"/>
  23.567 +        <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}">
  23.568 +            <customize>
  23.569 +                <syspropertyset>
  23.570 +                    <propertyref prefix="test-sys-prop."/>
  23.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  23.572 +                </syspropertyset>
  23.573 +                <arg value="${test.class}"/>
  23.574 +                <arg value="showoutput=true"/>
  23.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  23.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  23.577 +            </customize>
  23.578 +        </j2seproject3:debug>
  23.579 +    </target>
  23.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  23.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  23.582 +    </target>
  23.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  23.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  23.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  23.586 +    </target>
  23.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  23.588 +    <!--
  23.589 +                =========================
  23.590 +                APPLET EXECUTION SECTION
  23.591 +                =========================
  23.592 +            -->
  23.593 +    <target depends="init,compile-single" name="run-applet">
  23.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  23.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  23.596 +            <customize>
  23.597 +                <arg value="${applet.url}"/>
  23.598 +            </customize>
  23.599 +        </j2seproject1:java>
  23.600 +    </target>
  23.601 +    <!--
  23.602 +                =========================
  23.603 +                APPLET DEBUGGING  SECTION
  23.604 +                =========================
  23.605 +            -->
  23.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  23.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  23.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  23.609 +            <customize>
  23.610 +                <arg value="${applet.url}"/>
  23.611 +            </customize>
  23.612 +        </j2seproject3:debug>
  23.613 +    </target>
  23.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  23.615 +    <!--
  23.616 +                ===============
  23.617 +                CLEANUP SECTION
  23.618 +                ===============
  23.619 +            -->
  23.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  23.621 +    <target depends="init" name="-do-clean">
  23.622 +        <delete dir="${build.dir}"/>
  23.623 +        <delete dir="${dist.dir}"/>
  23.624 +    </target>
  23.625 +    <target name="-post-clean">
  23.626 +        <!-- Empty placeholder for easier customization. -->
  23.627 +        <!-- You can override this target in the ../build.xml file. -->
  23.628 +    </target>
  23.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  23.630 +</project>
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    24.3 @@ -0,0 +1,5 @@
    24.4 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    24.5 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    24.6 +nbproject/build-impl.xml.data.CRC32=835ca895
    24.7 +nbproject/build-impl.xml.script.CRC32=d896881b
    24.8 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    25.3 @@ -0,0 +1,58 @@
    25.4 +build.classes.dir=${build.dir}/classes
    25.5 +build.classes.excludes=**/*.java,**/*.form
    25.6 +# This directory is removed when the project is cleaned:
    25.7 +build.dir=build
    25.8 +build.generated.dir=${build.dir}/generated
    25.9 +# Only compile against the classpath explicitly listed here:
   25.10 +build.sysclasspath=ignore
   25.11 +build.test.classes.dir=${build.dir}/test/classes
   25.12 +build.test.results.dir=${build.dir}/test/results
   25.13 +debug.classpath=\
   25.14 +    ${run.classpath}
   25.15 +debug.test.classpath=\
   25.16 +    ${run.test.classpath}
   25.17 +# This directory is removed when the project is cleaned:
   25.18 +dist.dir=dist
   25.19 +dist.jar=${dist.dir}/boolcircuit.jar
   25.20 +dist.javadoc.dir=${dist.dir}/javadoc
   25.21 +excludes=
   25.22 +includes=**
   25.23 +jar.compress=false
   25.24 +javac.classpath=
   25.25 +# Space-separated list of extra javac options
   25.26 +javac.compilerargs=
   25.27 +javac.deprecation=false
   25.28 +javac.source=1.5
   25.29 +javac.target=1.5
   25.30 +javac.test.classpath=\
   25.31 +    ${javac.classpath}:\
   25.32 +    ${build.classes.dir}:\
   25.33 +    ${libs.junit.classpath}
   25.34 +javadoc.additionalparam=
   25.35 +javadoc.author=false
   25.36 +javadoc.encoding=
   25.37 +javadoc.noindex=false
   25.38 +javadoc.nonavbar=false
   25.39 +javadoc.notree=false
   25.40 +javadoc.private=false
   25.41 +javadoc.splitindex=true
   25.42 +javadoc.use=true
   25.43 +javadoc.version=false
   25.44 +javadoc.windowtitle=
   25.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   25.46 +# The library definition has always preference over this property.
   25.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   25.48 +meta.inf.dir=${src.dir}/META-INF
   25.49 +platform.active=default_platform
   25.50 +run.classpath=\
   25.51 +    ${javac.classpath}:\
   25.52 +    ${build.classes.dir}
   25.53 +# Space-separated list of JVM arguments used when running the project
   25.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   25.55 +# or test-sys-prop.name=value to set system properties for unit tests):
   25.56 +run.jvmargs=
   25.57 +run.test.classpath=\
   25.58 +    ${javac.test.classpath}:\
   25.59 +    ${build.test.classes.dir}
   25.60 +src.dir=src
   25.61 +test.src.dir=test
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    26.3 @@ -0,0 +1,16 @@
    26.4 +<?xml version="1.0" encoding="UTF-8"?>
    26.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    26.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    26.7 +    <configuration>
    26.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    26.9 +            <name>inputandoperation</name>
   26.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   26.11 +            <source-roots>
   26.12 +                <root id="src.dir"/>
   26.13 +            </source-roots>
   26.14 +            <test-roots>
   26.15 +                <root id="test.src.dir"/>
   26.16 +            </test-roots>
   26.17 +        </data>
   26.18 +    </configuration>
   26.19 +</project>
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/AndOperation.java	Sat Jun 14 09:52:45 2008 +0200
    27.3 @@ -0,0 +1,31 @@
    27.4 +/*
    27.5 + * AndOperation.java
    27.6 + *
    27.7 + * Created on July 12, 2006, 2:34 PM
    27.8 + *
    27.9 + * To change this template, choose Tools | Template Manager
   27.10 + * and open the template in the editor.
   27.11 + */
   27.12 +
   27.13 +package org.netbeans.apifest.boolcircuit;
   27.14 +
   27.15 +/**
   27.16 + *
   27.17 + */
   27.18 +final class AndOperation extends Operation {
   27.19 +
   27.20 +    private Input input1;
   27.21 +
   27.22 +    private Input input2;
   27.23 +    
   27.24 +    /** Creates a new instance of AndOperation */
   27.25 +    AndOperation(Input in1, Input in2) {
   27.26 +        input1 = in1;
   27.27 +        input2 = in2;
   27.28 +    }
   27.29 +
   27.30 +    boolean performBooleanOperation() {
   27.31 +        return input1.getBooleanValue() && input2.getBooleanValue();
   27.32 +    }
   27.33 +    
   27.34 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/BooleanInput.java	Sat Jun 14 09:52:45 2008 +0200
    28.3 @@ -0,0 +1,28 @@
    28.4 +/*
    28.5 + * BooleanInput.java
    28.6 + *
    28.7 + * Created on July 12, 2006, 2:31 PM
    28.8 + *
    28.9 + * To change this template, choose Tools | Template Manager
   28.10 + * and open the template in the editor.
   28.11 + */
   28.12 +
   28.13 +package org.netbeans.apifest.boolcircuit;
   28.14 +
   28.15 +/**
   28.16 + *
   28.17 + */
   28.18 +final class BooleanInput extends Input {
   28.19 +
   28.20 +    private boolean value;
   28.21 +    
   28.22 +    /** Creates a new instance of BooleanInput */
   28.23 +    public BooleanInput(boolean val) {
   28.24 +        value = val;
   28.25 +    }
   28.26 +
   28.27 +    public boolean getBooleanValue() {
   28.28 +        return value;
   28.29 +    }
   28.30 +    
   28.31 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    29.3 @@ -0,0 +1,29 @@
    29.4 +/*
    29.5 + * The contents of this file are subject to the terms of the Common Development
    29.6 + * and Distribution License (the License). You may not use this file except in
    29.7 + * compliance with the License.
    29.8 + *
    29.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   29.10 + * or http://www.netbeans.org/cddl.txt.
   29.11 + *
   29.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   29.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   29.14 + * If applicable, add the following below the CDDL Header, with the fields
   29.15 + * enclosed by brackets [] replaced by your own identifying information:
   29.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   29.17 + *
   29.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   29.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   29.20 + * Microsystems, Inc. All Rights Reserved.
   29.21 + */
   29.22 +
   29.23 +package org.netbeans.apifest.boolcircuit;
   29.24 +
   29.25 +/**
   29.26 + */
   29.27 +class Circuit {
   29.28 +    
   29.29 +    public static boolean evaluateBooleanOperation(Operation op) {
   29.30 +        return op.performBooleanOperation();
   29.31 +    }
   29.32 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Factory.java	Sat Jun 14 09:52:45 2008 +0200
    30.3 @@ -0,0 +1,55 @@
    30.4 +/*
    30.5 + * Factory.java
    30.6 + *
    30.7 + * Created on July 12, 2006, 2:21 PM
    30.8 + *
    30.9 + * To change this template, choose Tools | Template Manager
   30.10 + * and open the template in the editor.
   30.11 + */
   30.12 +
   30.13 +package org.netbeans.apifest.boolcircuit;
   30.14 +
   30.15 +/**
   30.16 + *
   30.17 + */
   30.18 +public class Factory {
   30.19 +    
   30.20 +    /** Creates a new instance of Factory */
   30.21 +    private Factory() {
   30.22 +    }
   30.23 +    
   30.24 +    public static Input createSimpleBooleanInput(boolean value) {
   30.25 +        return new BooleanInput(value);
   30.26 +    }
   30.27 +    
   30.28 +    /**
   30.29 +     * @throws IllegalArgument if the boolean operation was already used as input for another operation..
   30.30 +     */
   30.31 +    public static Input createOperationBasedBooleanInput(Operation op) throws IllegalArgumentException {
   30.32 +        assert op != null;
   30.33 +        if (op.isUsed()) {
   30.34 +            throw new IllegalArgumentException("Cannot use a single operation repeatedly.");
   30.35 +        }
   30.36 +        op.markOperationAsUsed();
   30.37 +        return new OperationInput(op);
   30.38 +    }
   30.39 +    
   30.40 +    public static Operation createAndOperation(Input one, Input two) {
   30.41 +        assert one != null;
   30.42 +        assert two != null;
   30.43 +        return new AndOperation(one, two);
   30.44 +    }
   30.45 +    
   30.46 +    public static Operation createOrOperation(Input one, Input two) {
   30.47 +        assert one != null;
   30.48 +        assert two != null;
   30.49 +        return new OrOperation(one, two);
   30.50 +    }
   30.51 +    
   30.52 +    public static Operation createNotOperation(Input one) {
   30.53 +        assert one != null;
   30.54 +        return new NotOperation(one);
   30.55 +    }
   30.56 +    
   30.57 +    
   30.58 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Input.java	Sat Jun 14 09:52:45 2008 +0200
    31.3 @@ -0,0 +1,22 @@
    31.4 +/*
    31.5 + * Input.java
    31.6 + *
    31.7 + * Created on July 12, 2006, 2:20 PM
    31.8 + *
    31.9 + * To change this template, choose Tools | Template Manager
   31.10 + * and open the template in the editor.
   31.11 + */
   31.12 +
   31.13 +package org.netbeans.apifest.boolcircuit;
   31.14 +
   31.15 +/**
   31.16 + *
   31.17 + */
   31.18 +public abstract class Input {
   31.19 +
   31.20 +    Input() {
   31.21 +        
   31.22 +    }
   31.23 +    
   31.24 +    public abstract boolean getBooleanValue();
   31.25 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/NotOperation.java	Sat Jun 14 09:52:45 2008 +0200
    32.3 @@ -0,0 +1,28 @@
    32.4 +/*
    32.5 + * NotOperation.java
    32.6 + *
    32.7 + * Created on July 12, 2006, 2:35 PM
    32.8 + *
    32.9 + * To change this template, choose Tools | Template Manager
   32.10 + * and open the template in the editor.
   32.11 + */
   32.12 +
   32.13 +package org.netbeans.apifest.boolcircuit;
   32.14 +
   32.15 +/**
   32.16 + *
   32.17 + */
   32.18 +final class NotOperation extends Operation {
   32.19 +
   32.20 +    private Input input;
   32.21 +    
   32.22 +    /** Creates a new instance of NotOperation */
   32.23 +    NotOperation(Input input) {
   32.24 +        this.input = input;
   32.25 +    }
   32.26 +
   32.27 +    boolean performBooleanOperation() {
   32.28 +        return !input.getBooleanValue();
   32.29 +    }
   32.30 +    
   32.31 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/Operation.java	Sat Jun 14 09:52:45 2008 +0200
    33.3 @@ -0,0 +1,33 @@
    33.4 +/*
    33.5 + * Operation.java
    33.6 + *
    33.7 + * Created on July 12, 2006, 2:26 PM
    33.8 + *
    33.9 + * To change this template, choose Tools | Template Manager
   33.10 + * and open the template in the editor.
   33.11 + */
   33.12 +
   33.13 +package org.netbeans.apifest.boolcircuit;
   33.14 +
   33.15 +/**
   33.16 + *
   33.17 + */
   33.18 +public abstract class Operation {
   33.19 +
   33.20 +    private boolean used;
   33.21 +    
   33.22 +    /** Creates a new instance of Operation */
   33.23 +    Operation() {
   33.24 +    }
   33.25 +    
   33.26 +    abstract boolean performBooleanOperation();
   33.27 +    
   33.28 +    void markOperationAsUsed() {
   33.29 +        used = true;
   33.30 +    }
   33.31 +    
   33.32 +    boolean isUsed() {
   33.33 +        return used;
   33.34 +    }
   33.35 +    
   33.36 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/OperationInput.java	Sat Jun 14 09:52:45 2008 +0200
    34.3 @@ -0,0 +1,26 @@
    34.4 +/*
    34.5 + * OperationInput.java
    34.6 + *
    34.7 + * Created on July 12, 2006, 2:32 PM
    34.8 + *
    34.9 + * To change this template, choose Tools | Template Manager
   34.10 + * and open the template in the editor.
   34.11 + */
   34.12 +
   34.13 +package org.netbeans.apifest.boolcircuit;
   34.14 +
   34.15 +/**
   34.16 + *
   34.17 + */
   34.18 +final class OperationInput extends Input {
   34.19 +    private Operation operation;
   34.20 +    /** Creates a new instance of OperationInput */
   34.21 +    public OperationInput(Operation oper) {
   34.22 +        operation = oper;
   34.23 +    }
   34.24 +
   34.25 +    public boolean getBooleanValue() {
   34.26 +        return operation.performBooleanOperation();
   34.27 +    }
   34.28 +    
   34.29 +}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/samples/apifest1/day1/inputandoperation/src/org/netbeans/apifest/boolcircuit/OrOperation.java	Sat Jun 14 09:52:45 2008 +0200
    35.3 @@ -0,0 +1,31 @@
    35.4 +/*
    35.5 + * OrOperation.java
    35.6 + *
    35.7 + * Created on July 12, 2006, 2:34 PM
    35.8 + *
    35.9 + * To change this template, choose Tools | Template Manager
   35.10 + * and open the template in the editor.
   35.11 + */
   35.12 +
   35.13 +package org.netbeans.apifest.boolcircuit;
   35.14 +
   35.15 +/**
   35.16 + *
   35.17 + */
   35.18 +final class OrOperation extends Operation {
   35.19 +    
   35.20 +    private Input input1;
   35.21 +
   35.22 +    private Input input2;
   35.23 +    
   35.24 +    /** Creates a new instance of orOperation */
   35.25 +    OrOperation(Input in1, Input in2) {
   35.26 +        input1 = in1;
   35.27 +        input2 = in2;
   35.28 +    }
   35.29 +
   35.30 +    boolean performBooleanOperation() {
   35.31 +        return input1.getBooleanValue() || input2.getBooleanValue();
   35.32 +    }
   35.33 +    
   35.34 +}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/samples/apifest1/day1/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    36.3 @@ -0,0 +1,116 @@
    36.4 +/*
    36.5 + * The contents of this file are subject to the terms of the Common Development
    36.6 + * and Distribution License (the License). You may not use this file except in
    36.7 + * compliance with the License.
    36.8 + *
    36.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   36.10 + * or http://www.netbeans.org/cddl.txt.
   36.11 + *
   36.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   36.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   36.14 + * If applicable, add the following below the CDDL Header, with the fields
   36.15 + * enclosed by brackets [] replaced by your own identifying information:
   36.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   36.17 + *
   36.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   36.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   36.20 + * Microsystems, Inc. All Rights Reserved.
   36.21 + */
   36.22 +
   36.23 +package org.netbeans.apifest.boolcircuit;
   36.24 +
   36.25 +import java.security.CodeSource;
   36.26 +import java.security.Permission;
   36.27 +import java.security.PermissionCollection;
   36.28 +import java.security.Policy;
   36.29 +import java.util.Collection;
   36.30 +import java.util.Collections;
   36.31 +import java.util.Enumeration;
   36.32 +import junit.framework.TestCase;
   36.33 +import junit.framework.*;
   36.34 +
   36.35 +/** The initial quest for this APIFest is to create an API for boolean 
   36.36 + * circuits. Such API shall be able to compose a boolean circuit from
   36.37 + * basic elements and evaluate the result given initial values for 
   36.38 + * input variables.
   36.39 + * <p>
   36.40 + * The basic elements include:
   36.41 + * <ul>
   36.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   36.43 + *          on output 1 and 1 to 0
   36.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   36.45 + *          inputs are 1, otherwise it is 0
   36.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   36.47 + *          in the case when both inputs are 0
   36.48 + * </ul>
   36.49 + *
   36.50 + * <p>
   36.51 + * The boolean circuit can be used to represent boolean formulas and compute
   36.52 + * the results for certain values of its inputs. The individual tasks described
   36.53 + * as tests bellow.
   36.54 + *
   36.55 + * <p>
   36.56 + * Links of interest:
   36.57 + * <ul>
   36.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   36.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   36.60 + * </ul>
   36.61 + */
   36.62 +public class CircuitTest extends TestCase {
   36.63 +    static {
   36.64 +        // your code shall run without any permissions
   36.65 +    }
   36.66 +    
   36.67 +    Input inTrue;
   36.68 +    Input inFalse;
   36.69 +    public CircuitTest(String testName) {
   36.70 +        super(testName);
   36.71 +    }
   36.72 +
   36.73 +    // BEGIN: apifest.day1.inputandoperation.CircuitTest
   36.74 +    /** 
   36.75 +     * Create a circuit to evaluate x1 and x2 and then
   36.76 +     * verify that its result is false for input (false, true) and
   36.77 +     * it is true for input (true, true).
   36.78 +     */
   36.79 +    public void testX1andX2() {
   36.80 +        inTrue = Factory.createSimpleBooleanInput(true);
   36.81 +        inFalse = Factory.createSimpleBooleanInput(false);
   36.82 +        Operation op1 = Factory.createAndOperation(inFalse, inTrue);
   36.83 +        assertFalse(Circuit.evaluateBooleanOperation(op1));
   36.84 +        Operation op2 = Factory.createAndOperation(inTrue, inTrue);
   36.85 +        assertTrue(Circuit.evaluateBooleanOperation(op2));
   36.86 +    }
   36.87 +    
   36.88 +    /** 
   36.89 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   36.90 +     * verify that its result is false for input (false, true, false) and
   36.91 +     * it is true for input (false, false, true).
   36.92 +     */
   36.93 +    public void testX1andX2orX3() {
   36.94 +        inTrue = Factory.createSimpleBooleanInput(true);
   36.95 +        inFalse = Factory.createSimpleBooleanInput(false);
   36.96 +        Operation op1 = Factory.createAndOperation(inFalse, inTrue);
   36.97 +        Operation op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inFalse);
   36.98 +        assertFalse(Circuit.evaluateBooleanOperation(op2));
   36.99 +        
  36.100 +        op1 = Factory.createAndOperation(inFalse, inFalse);
  36.101 +        op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inTrue);
  36.102 +        assertTrue(Circuit.evaluateBooleanOperation(op2));
  36.103 +    }
  36.104 +    /** 
  36.105 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  36.106 +     * verify that its result is true for all values of x1.
  36.107 +     */
  36.108 +    public void testAlwaysTrue() {
  36.109 +        inTrue = Factory.createSimpleBooleanInput(true);
  36.110 +        inFalse = Factory.createSimpleBooleanInput(false);
  36.111 +        Operation not = Factory.createNotOperation(inTrue);
  36.112 +        Operation or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inTrue);
  36.113 +        assertTrue(Circuit.evaluateBooleanOperation(or));
  36.114 +        not = Factory.createNotOperation(inFalse);
  36.115 +        or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inFalse);
  36.116 +        assertTrue(Circuit.evaluateBooleanOperation(or));
  36.117 +    }
  36.118 +    // END: apifest.day1.inputandoperation.CircuitTest
  36.119 +}
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/samples/apifest1/day1/parsingsolution/build.xml	Sat Jun 14 09:52:45 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="parsingsolution" default="default" basedir=".">
    37.9 +    <description>Builds, tests, and runs the project parsingsolution.</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="parsingsolution-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/samples/apifest1/day1/parsingsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    38.3 @@ -0,0 +1,627 @@
    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:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="parsingsolution-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 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="dt_socket">
  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.includes}*.class"/>
  38.242 +                </nbjpdareload>
  38.243 +            </sequential>
  38.244 +        </macrodef>
  38.245 +    </target>
  38.246 +    <target name="-init-debug-args">
  38.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  38.248 +        <condition property="have-jdk-older-than-1.4">
  38.249 +            <or>
  38.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  38.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  38.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  38.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  38.254 +            </or>
  38.255 +        </condition>
  38.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  38.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
  38.258 +        </condition>
  38.259 +    </target>
  38.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  38.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  38.262 +            <attribute default="${main.class}" name="classname"/>
  38.263 +            <attribute default="${debug.classpath}" name="classpath"/>
  38.264 +            <element name="customize" optional="true"/>
  38.265 +            <sequential>
  38.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  38.267 +                    <jvmarg line="${debug-args-line}"/>
  38.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  38.269 +                    <jvmarg line="${run.jvmargs}"/>
  38.270 +                    <classpath>
  38.271 +                        <path path="@{classpath}"/>
  38.272 +                    </classpath>
  38.273 +                    <syspropertyset>
  38.274 +                        <propertyref prefix="run-sys-prop."/>
  38.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  38.276 +                    </syspropertyset>
  38.277 +                    <customize/>
  38.278 +                </java>
  38.279 +            </sequential>
  38.280 +        </macrodef>
  38.281 +    </target>
  38.282 +    <target name="-init-macrodef-java">
  38.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.284 +            <attribute default="${main.class}" name="classname"/>
  38.285 +            <element name="customize" optional="true"/>
  38.286 +            <sequential>
  38.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  38.288 +                    <jvmarg line="${run.jvmargs}"/>
  38.289 +                    <classpath>
  38.290 +                        <path path="${run.classpath}"/>
  38.291 +                    </classpath>
  38.292 +                    <syspropertyset>
  38.293 +                        <propertyref prefix="run-sys-prop."/>
  38.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  38.295 +                    </syspropertyset>
  38.296 +                    <customize/>
  38.297 +                </java>
  38.298 +            </sequential>
  38.299 +        </macrodef>
  38.300 +    </target>
  38.301 +    <target name="-init-presetdef-jar">
  38.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  38.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  38.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  38.305 +            </jar>
  38.306 +        </presetdef>
  38.307 +    </target>
  38.308 +    <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.309 +    <!--
  38.310 +                ===================
  38.311 +                COMPILATION SECTION
  38.312 +                ===================
  38.313 +            -->
  38.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  38.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  38.316 +        <mkdir dir="${build.classes.dir}"/>
  38.317 +    </target>
  38.318 +    <target name="-pre-compile">
  38.319 +        <!-- Empty placeholder for easier customization. -->
  38.320 +        <!-- You can override this target in the ../build.xml file. -->
  38.321 +    </target>
  38.322 +    <target if="do.depend.true" name="-compile-depend">
  38.323 +        <j2seproject3:depend/>
  38.324 +    </target>
  38.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  38.326 +        <j2seproject3:javac/>
  38.327 +        <copy todir="${build.classes.dir}">
  38.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.329 +        </copy>
  38.330 +    </target>
  38.331 +    <target name="-post-compile">
  38.332 +        <!-- Empty placeholder for easier customization. -->
  38.333 +        <!-- You can override this target in the ../build.xml file. -->
  38.334 +    </target>
  38.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  38.336 +    <target name="-pre-compile-single">
  38.337 +        <!-- Empty placeholder for easier customization. -->
  38.338 +        <!-- You can override this target in the ../build.xml file. -->
  38.339 +    </target>
  38.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  38.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  38.342 +        <j2seproject3:force-recompile/>
  38.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  38.344 +    </target>
  38.345 +    <target name="-post-compile-single">
  38.346 +        <!-- Empty placeholder for easier customization. -->
  38.347 +        <!-- You can override this target in the ../build.xml file. -->
  38.348 +    </target>
  38.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  38.350 +    <!--
  38.351 +                ====================
  38.352 +                JAR BUILDING SECTION
  38.353 +                ====================
  38.354 +            -->
  38.355 +    <target depends="init" name="-pre-pre-jar">
  38.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  38.357 +        <mkdir dir="${dist.jar.dir}"/>
  38.358 +    </target>
  38.359 +    <target name="-pre-jar">
  38.360 +        <!-- Empty placeholder for easier customization. -->
  38.361 +        <!-- You can override this target in the ../build.xml file. -->
  38.362 +    </target>
  38.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  38.364 +        <j2seproject1:jar/>
  38.365 +    </target>
  38.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  38.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
  38.368 +    </target>
  38.369 +    <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.370 +        <j2seproject1:jar manifest="${manifest.file}">
  38.371 +            <j2seproject1:manifest>
  38.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  38.373 +            </j2seproject1:manifest>
  38.374 +        </j2seproject1:jar>
  38.375 +        <echo>To run this application from the command line without Ant, try:</echo>
  38.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  38.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  38.378 +        <pathconvert property="run.classpath.with.dist.jar">
  38.379 +            <path path="${run.classpath}"/>
  38.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  38.381 +        </pathconvert>
  38.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  38.383 +    </target>
  38.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  38.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  38.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
  38.387 +            <path path="${run.classpath}"/>
  38.388 +            <map from="${build.classes.dir.resolved}" to=""/>
  38.389 +        </pathconvert>
  38.390 +        <pathconvert pathsep=" " property="jar.classpath">
  38.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
  38.392 +            <chainedmapper>
  38.393 +                <flattenmapper/>
  38.394 +                <globmapper from="*" to="lib/*"/>
  38.395 +            </chainedmapper>
  38.396 +        </pathconvert>
  38.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  38.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  38.399 +            <fileset dir="${build.classes.dir}"/>
  38.400 +            <manifest>
  38.401 +                <attribute name="Main-Class" value="${main.class}"/>
  38.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  38.403 +            </manifest>
  38.404 +        </copylibs>
  38.405 +        <echo>To run this application from the command line without Ant, try:</echo>
  38.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  38.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  38.408 +    </target>
  38.409 +    <target name="-post-jar">
  38.410 +        <!-- Empty placeholder for easier customization. -->
  38.411 +        <!-- You can override this target in the ../build.xml file. -->
  38.412 +    </target>
  38.413 +    <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.414 +    <!--
  38.415 +                =================
  38.416 +                EXECUTION SECTION
  38.417 +                =================
  38.418 +            -->
  38.419 +    <target depends="init,compile" description="Run a main class." name="run">
  38.420 +        <j2seproject1:java>
  38.421 +            <customize>
  38.422 +                <arg line="${application.args}"/>
  38.423 +            </customize>
  38.424 +        </j2seproject1:java>
  38.425 +    </target>
  38.426 +    <target name="-do-not-recompile">
  38.427 +        <property name="javac.includes.binary" value=""/>
  38.428 +    </target>
  38.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  38.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  38.431 +        <j2seproject1:java classname="${run.class}"/>
  38.432 +    </target>
  38.433 +    <!--
  38.434 +                =================
  38.435 +                DEBUGGING SECTION
  38.436 +                =================
  38.437 +            -->
  38.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  38.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  38.440 +    </target>
  38.441 +    <target depends="init,compile" name="-debug-start-debuggee">
  38.442 +        <j2seproject3:debug>
  38.443 +            <customize>
  38.444 +                <arg line="${application.args}"/>
  38.445 +            </customize>
  38.446 +        </j2seproject3:debug>
  38.447 +    </target>
  38.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  38.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  38.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  38.451 +    </target>
  38.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  38.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  38.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  38.455 +        <j2seproject3:debug classname="${debug.class}"/>
  38.456 +    </target>
  38.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  38.458 +    <target depends="init" name="-pre-debug-fix">
  38.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
  38.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
  38.461 +    </target>
  38.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  38.463 +        <j2seproject1:nbjpdareload/>
  38.464 +    </target>
  38.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  38.466 +    <!--
  38.467 +                ===============
  38.468 +                JAVADOC SECTION
  38.469 +                ===============
  38.470 +            -->
  38.471 +    <target depends="init" name="-javadoc-build">
  38.472 +        <mkdir dir="${dist.javadoc.dir}"/>
  38.473 +        <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.474 +            <classpath>
  38.475 +                <path path="${javac.classpath}"/>
  38.476 +            </classpath>
  38.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  38.478 +                <filename name="**/*.java"/>
  38.479 +            </fileset>
  38.480 +        </javadoc>
  38.481 +    </target>
  38.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  38.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  38.484 +    </target>
  38.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  38.486 +    <!--
  38.487 +                =========================
  38.488 +                JUNIT COMPILATION SECTION
  38.489 +                =========================
  38.490 +            -->
  38.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  38.492 +        <mkdir dir="${build.test.classes.dir}"/>
  38.493 +    </target>
  38.494 +    <target name="-pre-compile-test">
  38.495 +        <!-- Empty placeholder for easier customization. -->
  38.496 +        <!-- You can override this target in the ../build.xml file. -->
  38.497 +    </target>
  38.498 +    <target if="do.depend.true" name="-compile-test-depend">
  38.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  38.500 +    </target>
  38.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  38.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  38.503 +        <copy todir="${build.test.classes.dir}">
  38.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.505 +        </copy>
  38.506 +    </target>
  38.507 +    <target name="-post-compile-test">
  38.508 +        <!-- Empty placeholder for easier customization. -->
  38.509 +        <!-- You can override this target in the ../build.xml file. -->
  38.510 +    </target>
  38.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  38.512 +    <target name="-pre-compile-test-single">
  38.513 +        <!-- Empty placeholder for easier customization. -->
  38.514 +        <!-- You can override this target in the ../build.xml file. -->
  38.515 +    </target>
  38.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  38.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  38.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  38.519 +        <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.520 +        <copy todir="${build.test.classes.dir}">
  38.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  38.522 +        </copy>
  38.523 +    </target>
  38.524 +    <target name="-post-compile-test-single">
  38.525 +        <!-- Empty placeholder for easier customization. -->
  38.526 +        <!-- You can override this target in the ../build.xml file. -->
  38.527 +    </target>
  38.528 +    <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.529 +    <!--
  38.530 +                =======================
  38.531 +                JUNIT EXECUTION SECTION
  38.532 +                =======================
  38.533 +            -->
  38.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
  38.535 +        <mkdir dir="${build.test.results.dir}"/>
  38.536 +    </target>
  38.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  38.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  38.539 +    </target>
  38.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  38.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  38.542 +    </target>
  38.543 +    <target depends="init" if="have.tests" name="test-report"/>
  38.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  38.545 +    <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.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  38.547 +        <mkdir dir="${build.test.results.dir}"/>
  38.548 +    </target>
  38.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  38.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  38.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  38.552 +    </target>
  38.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  38.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  38.555 +    </target>
  38.556 +    <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.557 +    <!--
  38.558 +                =======================
  38.559 +                JUNIT DEBUGGING SECTION
  38.560 +                =======================
  38.561 +            -->
  38.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  38.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  38.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  38.565 +        <delete file="${test.report.file}"/>
  38.566 +        <mkdir dir="${build.test.results.dir}"/>
  38.567 +        <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.568 +            <customize>
  38.569 +                <syspropertyset>
  38.570 +                    <propertyref prefix="test-sys-prop."/>
  38.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  38.572 +                </syspropertyset>
  38.573 +                <arg value="${test.class}"/>
  38.574 +                <arg value="showoutput=true"/>
  38.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  38.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  38.577 +            </customize>
  38.578 +        </j2seproject3:debug>
  38.579 +    </target>
  38.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  38.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  38.582 +    </target>
  38.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  38.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  38.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  38.586 +    </target>
  38.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  38.588 +    <!--
  38.589 +                =========================
  38.590 +                APPLET EXECUTION SECTION
  38.591 +                =========================
  38.592 +            -->
  38.593 +    <target depends="init,compile-single" name="run-applet">
  38.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  38.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  38.596 +            <customize>
  38.597 +                <arg value="${applet.url}"/>
  38.598 +            </customize>
  38.599 +        </j2seproject1:java>
  38.600 +    </target>
  38.601 +    <!--
  38.602 +                =========================
  38.603 +                APPLET DEBUGGING  SECTION
  38.604 +                =========================
  38.605 +            -->
  38.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  38.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  38.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  38.609 +            <customize>
  38.610 +                <arg value="${applet.url}"/>
  38.611 +            </customize>
  38.612 +        </j2seproject3:debug>
  38.613 +    </target>
  38.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  38.615 +    <!--
  38.616 +                ===============
  38.617 +                CLEANUP SECTION
  38.618 +                ===============
  38.619 +            -->
  38.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  38.621 +    <target depends="init" name="-do-clean">
  38.622 +        <delete dir="${build.dir}"/>
  38.623 +        <delete dir="${dist.dir}"/>
  38.624 +    </target>
  38.625 +    <target name="-post-clean">
  38.626 +        <!-- Empty placeholder for easier customization. -->
  38.627 +        <!-- You can override this target in the ../build.xml file. -->
  38.628 +    </target>
  38.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  38.630 +</project>
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/samples/apifest1/day1/parsingsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    39.3 @@ -0,0 +1,8 @@
    39.4 +build.xml.data.CRC32=97db7a12
    39.5 +build.xml.script.CRC32=b2dbf729
    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=97db7a12
   39.10 +nbproject/build-impl.xml.script.CRC32=41b27734
   39.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/samples/apifest1/day1/parsingsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    40.3 @@ -0,0 +1,58 @@
    40.4 +build.classes.dir=${build.dir}/classes
    40.5 +build.classes.excludes=**/*.java,**/*.form
    40.6 +# This directory is removed when the project is cleaned:
    40.7 +build.dir=build
    40.8 +build.generated.dir=${build.dir}/generated
    40.9 +# Only compile against the classpath explicitly listed here:
   40.10 +build.sysclasspath=ignore
   40.11 +build.test.classes.dir=${build.dir}/test/classes
   40.12 +build.test.results.dir=${build.dir}/test/results
   40.13 +debug.classpath=\
   40.14 +    ${run.classpath}
   40.15 +debug.test.classpath=\
   40.16 +    ${run.test.classpath}
   40.17 +# This directory is removed when the project is cleaned:
   40.18 +dist.dir=dist
   40.19 +dist.jar=${dist.dir}/boolcircuit.jar
   40.20 +dist.javadoc.dir=${dist.dir}/javadoc
   40.21 +excludes=
   40.22 +includes=**
   40.23 +jar.compress=false
   40.24 +javac.classpath=
   40.25 +# Space-separated list of extra javac options
   40.26 +javac.compilerargs=
   40.27 +javac.deprecation=false
   40.28 +javac.source=1.5
   40.29 +javac.target=1.5
   40.30 +javac.test.classpath=\
   40.31 +    ${javac.classpath}:\
   40.32 +    ${build.classes.dir}:\
   40.33 +    ${libs.junit.classpath}
   40.34 +javadoc.additionalparam=
   40.35 +javadoc.author=false
   40.36 +javadoc.encoding=
   40.37 +javadoc.noindex=false
   40.38 +javadoc.nonavbar=false
   40.39 +javadoc.notree=false
   40.40 +javadoc.private=false
   40.41 +javadoc.splitindex=true
   40.42 +javadoc.use=true
   40.43 +javadoc.version=false
   40.44 +javadoc.windowtitle=
   40.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   40.46 +# The library definition has always preference over this property.
   40.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   40.48 +meta.inf.dir=${src.dir}/META-INF
   40.49 +platform.active=default_platform
   40.50 +run.classpath=\
   40.51 +    ${javac.classpath}:\
   40.52 +    ${build.classes.dir}
   40.53 +# Space-separated list of JVM arguments used when running the project
   40.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   40.55 +# or test-sys-prop.name=value to set system properties for unit tests):
   40.56 +run.jvmargs=
   40.57 +run.test.classpath=\
   40.58 +    ${javac.test.classpath}:\
   40.59 +    ${build.test.classes.dir}
   40.60 +src.dir=src
   40.61 +test.src.dir=test
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/samples/apifest1/day1/parsingsolution/nbproject/project.xml	Sat Jun 14 09:52:45 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>parsingsolution</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/samples/apifest1/day1/parsingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    42.3 @@ -0,0 +1,60 @@
    42.4 +/*
    42.5 + * The contents of this file are subject to the terms of the Common Development
    42.6 + * and Distribution License (the License). You may not use this file except in
    42.7 + * compliance with the License.
    42.8 + *
    42.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   42.10 + * or http://www.netbeans.org/cddl.txt.
   42.11 + *
   42.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   42.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   42.14 + * If applicable, add the following below the CDDL Header, with the fields
   42.15 + * enclosed by brackets [] replaced by your own identifying information:
   42.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   42.17 + *
   42.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   42.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   42.20 + * Microsystems, Inc. All Rights Reserved.
   42.21 + */
   42.22 +
   42.23 +package org.netbeans.apifest.boolcircuit;
   42.24 +
   42.25 +// BEGIN: apifest.day1.parsingsolution.Circuit
   42.26 +/**
   42.27 + * Usage:
   42.28 + * First method parse must be called with valid logical expression on input.
   42.29 + * If it returns zero then it is possible to call method evaluate with array
   42.30 + * of input values as parameter. Method evaluate can be invoked many time with
   42.31 + * different input values.
   42.32 + * Method parse can be called anytime to change logical expression.
   42.33 + */
   42.34 +public class Circuit {
   42.35 +    
   42.36 +    /** Parses logical expression
   42.37 +     * @param string representation of logical expression
   42.38 +     * Valid tokens:
   42.39 +     * Input values are represented by x and number starting from 1 eg.: x1
   42.40 +     * AND, NOT, OR and brackets '(',')' can be used.
   42.41 +     * Example of valid expression: x1 AND x2
   42.42 +     * @return 0 when input expression is validated and parsed. Return nonzero value otherwise.
   42.43 +     */
   42.44 +    public int parse(String expression) {
   42.45 +        return 0;
   42.46 +    }
   42.47 +    
   42.48 +    /** Evaluate logical expression
   42.49 +     * @param array of boolean input values. Size of array must correspond to number
   42.50 +     * of variables used in expression
   42.51 +     * If size of array is bigger then only first N values are used to evaluate expression.
   42.52 +     * Remaining values are ignored.
   42.53 +     * If size of array is smaller then IllegalArgumentException is thrown.
   42.54 +     * If no expression is set by method parse then IllegalStateException is thrown.
   42.55 +     */
   42.56 +    public boolean evaluate(boolean [] x) {
   42.57 +        return true;
   42.58 +        
   42.59 +    }
   42.60 +    
   42.61 +}
   42.62 +// END: apifest.day1.parsingsolution.Circuit
   42.63 +
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/samples/apifest1/day1/parsingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    43.3 @@ -0,0 +1,109 @@
    43.4 +/*
    43.5 + * The contents of this file are subject to the terms of the Common Development
    43.6 + * and Distribution License (the License). You may not use this file except in
    43.7 + * compliance with the License.
    43.8 + *
    43.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   43.10 + * or http://www.netbeans.org/cddl.txt.
   43.11 + *
   43.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   43.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   43.14 + * If applicable, add the following below the CDDL Header, with the fields
   43.15 + * enclosed by brackets [] replaced by your own identifying information:
   43.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   43.17 + *
   43.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   43.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   43.20 + * Microsystems, Inc. All Rights Reserved.
   43.21 + */
   43.22 +
   43.23 +package org.netbeans.apifest.boolcircuit;
   43.24 +
   43.25 +import java.security.CodeSource;
   43.26 +import java.security.Permission;
   43.27 +import java.security.PermissionCollection;
   43.28 +import java.security.Policy;
   43.29 +import java.util.Collection;
   43.30 +import java.util.Collections;
   43.31 +import java.util.Enumeration;
   43.32 +import junit.framework.TestCase;
   43.33 +import junit.framework.*;
   43.34 +
   43.35 +/** The initial quest for this APIFest is to create an API for boolean 
   43.36 + * circuits. Such API shall be able to compose a boolean circuit from
   43.37 + * basic elements and evaluate the result given initial values for 
   43.38 + * input variables.
   43.39 + * <p>
   43.40 + * The basic elements include:
   43.41 + * <ul>
   43.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   43.43 + *          on output 1 and 1 to 0
   43.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   43.45 + *          inputs are 1, otherwise it is 0
   43.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   43.47 + *          in the case when both inputs are 0
   43.48 + * </ul>
   43.49 + *
   43.50 + * <p>
   43.51 + * The boolean circuit can be used to represent boolean formulas and compute
   43.52 + * the results for certain values of its inputs. The individual tasks described
   43.53 + * as tests bellow.
   43.54 + *
   43.55 + * <p>
   43.56 + * Links of interest:
   43.57 + * <ul>
   43.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   43.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   43.60 + * </ul>
   43.61 + */
   43.62 +public class CircuitTest extends TestCase {
   43.63 +    static {
   43.64 +        // your code shall run without any permissions
   43.65 +    }
   43.66 +    
   43.67 +    public CircuitTest(String testName) {
   43.68 +        super(testName);
   43.69 +    }
   43.70 +
   43.71 +    protected void setUp() throws Exception {
   43.72 +    }
   43.73 +
   43.74 +    protected void tearDown() throws Exception {
   43.75 +    }
   43.76 +    
   43.77 +    
   43.78 +    /** 
   43.79 +     * Create a circuit to evaluate x1 and x2 and then
   43.80 +     * verify that its result is false for input (false, true) and
   43.81 +     * it is true for input (true, true).
   43.82 +     */
   43.83 +    public void testX1andX2() {
   43.84 +        Circuit c = new Circuit();
   43.85 +        c.parse("x1 AND x2");
   43.86 +        assertFalse(c.evaluate(new boolean [] {Boolean.FALSE, Boolean.TRUE}));
   43.87 +        assertTrue(c.evaluate(new boolean [] {Boolean.TRUE, Boolean.TRUE}));
   43.88 +    }
   43.89 +    
   43.90 +    /** 
   43.91 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   43.92 +     * verify that its result is false for input (false, true, false) and
   43.93 +     * it is true for input (false, false, true).
   43.94 +     */
   43.95 +    public void testX1andX2orX3() {
   43.96 +        Circuit c = new Circuit();
   43.97 +        c.parse("(x1 AND x2) or x3");
   43.98 +        assertFalse(c.evaluate(new boolean [] {Boolean.FALSE, Boolean.TRUE, Boolean.FALSE}));
   43.99 +        assertTrue(c.evaluate(new boolean [] {Boolean.FALSE, Boolean.FALSE, Boolean.TRUE}));
  43.100 +    }
  43.101 +    /** 
  43.102 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  43.103 +     * verify that its result is true for all values of x1.
  43.104 +     */
  43.105 +    public void testAlwaysTrue() {
  43.106 +        Circuit c = new Circuit();
  43.107 +        c.parse("x1 or NOT x1");
  43.108 +        assertTrue(c.evaluate(new boolean [] {Boolean.FALSE}));
  43.109 +        assertTrue(c.evaluate(new boolean [] {Boolean.TRUE}));
  43.110 +    }
  43.111 +    
  43.112 +}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/samples/apifest1/day1/pinbasedsolution/build.xml	Sat Jun 14 09:52:45 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="pinbasedsolution" default="default" basedir=".">
    44.9 +    <description>Builds, tests, and runs the project pinbasedsolution.</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="pinbasedsolution-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/samples/apifest1/day1/pinbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    45.3 @@ -0,0 +1,627 @@
    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:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="pinbasedsolution-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 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="dt_socket">
  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.includes}*.class"/>
  45.242 +                </nbjpdareload>
  45.243 +            </sequential>
  45.244 +        </macrodef>
  45.245 +    </target>
  45.246 +    <target name="-init-debug-args">
  45.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  45.248 +        <condition property="have-jdk-older-than-1.4">
  45.249 +            <or>
  45.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  45.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  45.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  45.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  45.254 +            </or>
  45.255 +        </condition>
  45.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  45.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
  45.258 +        </condition>
  45.259 +    </target>
  45.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  45.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  45.262 +            <attribute default="${main.class}" name="classname"/>
  45.263 +            <attribute default="${debug.classpath}" name="classpath"/>
  45.264 +            <element name="customize" optional="true"/>
  45.265 +            <sequential>
  45.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  45.267 +                    <jvmarg line="${debug-args-line}"/>
  45.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  45.269 +                    <jvmarg line="${run.jvmargs}"/>
  45.270 +                    <classpath>
  45.271 +                        <path path="@{classpath}"/>
  45.272 +                    </classpath>
  45.273 +                    <syspropertyset>
  45.274 +                        <propertyref prefix="run-sys-prop."/>
  45.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  45.276 +                    </syspropertyset>
  45.277 +                    <customize/>
  45.278 +                </java>
  45.279 +            </sequential>
  45.280 +        </macrodef>
  45.281 +    </target>
  45.282 +    <target name="-init-macrodef-java">
  45.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.284 +            <attribute default="${main.class}" name="classname"/>
  45.285 +            <element name="customize" optional="true"/>
  45.286 +            <sequential>
  45.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  45.288 +                    <jvmarg line="${run.jvmargs}"/>
  45.289 +                    <classpath>
  45.290 +                        <path path="${run.classpath}"/>
  45.291 +                    </classpath>
  45.292 +                    <syspropertyset>
  45.293 +                        <propertyref prefix="run-sys-prop."/>
  45.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  45.295 +                    </syspropertyset>
  45.296 +                    <customize/>
  45.297 +                </java>
  45.298 +            </sequential>
  45.299 +        </macrodef>
  45.300 +    </target>
  45.301 +    <target name="-init-presetdef-jar">
  45.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  45.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  45.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  45.305 +            </jar>
  45.306 +        </presetdef>
  45.307 +    </target>
  45.308 +    <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.309 +    <!--
  45.310 +                ===================
  45.311 +                COMPILATION SECTION
  45.312 +                ===================
  45.313 +            -->
  45.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  45.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  45.316 +        <mkdir dir="${build.classes.dir}"/>
  45.317 +    </target>
  45.318 +    <target name="-pre-compile">
  45.319 +        <!-- Empty placeholder for easier customization. -->
  45.320 +        <!-- You can override this target in the ../build.xml file. -->
  45.321 +    </target>
  45.322 +    <target if="do.depend.true" name="-compile-depend">
  45.323 +        <j2seproject3:depend/>
  45.324 +    </target>
  45.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  45.326 +        <j2seproject3:javac/>
  45.327 +        <copy todir="${build.classes.dir}">
  45.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.329 +        </copy>
  45.330 +    </target>
  45.331 +    <target name="-post-compile">
  45.332 +        <!-- Empty placeholder for easier customization. -->
  45.333 +        <!-- You can override this target in the ../build.xml file. -->
  45.334 +    </target>
  45.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  45.336 +    <target name="-pre-compile-single">
  45.337 +        <!-- Empty placeholder for easier customization. -->
  45.338 +        <!-- You can override this target in the ../build.xml file. -->
  45.339 +    </target>
  45.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  45.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  45.342 +        <j2seproject3:force-recompile/>
  45.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  45.344 +    </target>
  45.345 +    <target name="-post-compile-single">
  45.346 +        <!-- Empty placeholder for easier customization. -->
  45.347 +        <!-- You can override this target in the ../build.xml file. -->
  45.348 +    </target>
  45.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  45.350 +    <!--
  45.351 +                ====================
  45.352 +                JAR BUILDING SECTION
  45.353 +                ====================
  45.354 +            -->
  45.355 +    <target depends="init" name="-pre-pre-jar">
  45.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  45.357 +        <mkdir dir="${dist.jar.dir}"/>
  45.358 +    </target>
  45.359 +    <target name="-pre-jar">
  45.360 +        <!-- Empty placeholder for easier customization. -->
  45.361 +        <!-- You can override this target in the ../build.xml file. -->
  45.362 +    </target>
  45.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  45.364 +        <j2seproject1:jar/>
  45.365 +    </target>
  45.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  45.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
  45.368 +    </target>
  45.369 +    <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.370 +        <j2seproject1:jar manifest="${manifest.file}">
  45.371 +            <j2seproject1:manifest>
  45.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  45.373 +            </j2seproject1:manifest>
  45.374 +        </j2seproject1:jar>
  45.375 +        <echo>To run this application from the command line without Ant, try:</echo>
  45.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  45.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  45.378 +        <pathconvert property="run.classpath.with.dist.jar">
  45.379 +            <path path="${run.classpath}"/>
  45.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  45.381 +        </pathconvert>
  45.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  45.383 +    </target>
  45.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  45.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  45.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
  45.387 +            <path path="${run.classpath}"/>
  45.388 +            <map from="${build.classes.dir.resolved}" to=""/>
  45.389 +        </pathconvert>
  45.390 +        <pathconvert pathsep=" " property="jar.classpath">
  45.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
  45.392 +            <chainedmapper>
  45.393 +                <flattenmapper/>
  45.394 +                <globmapper from="*" to="lib/*"/>
  45.395 +            </chainedmapper>
  45.396 +        </pathconvert>
  45.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  45.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  45.399 +            <fileset dir="${build.classes.dir}"/>
  45.400 +            <manifest>
  45.401 +                <attribute name="Main-Class" value="${main.class}"/>
  45.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  45.403 +            </manifest>
  45.404 +        </copylibs>
  45.405 +        <echo>To run this application from the command line without Ant, try:</echo>
  45.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  45.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  45.408 +    </target>
  45.409 +    <target name="-post-jar">
  45.410 +        <!-- Empty placeholder for easier customization. -->
  45.411 +        <!-- You can override this target in the ../build.xml file. -->
  45.412 +    </target>
  45.413 +    <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.414 +    <!--
  45.415 +                =================
  45.416 +                EXECUTION SECTION
  45.417 +                =================
  45.418 +            -->
  45.419 +    <target depends="init,compile" description="Run a main class." name="run">
  45.420 +        <j2seproject1:java>
  45.421 +            <customize>
  45.422 +                <arg line="${application.args}"/>
  45.423 +            </customize>
  45.424 +        </j2seproject1:java>
  45.425 +    </target>
  45.426 +    <target name="-do-not-recompile">
  45.427 +        <property name="javac.includes.binary" value=""/>
  45.428 +    </target>
  45.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  45.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  45.431 +        <j2seproject1:java classname="${run.class}"/>
  45.432 +    </target>
  45.433 +    <!--
  45.434 +                =================
  45.435 +                DEBUGGING SECTION
  45.436 +                =================
  45.437 +            -->
  45.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  45.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  45.440 +    </target>
  45.441 +    <target depends="init,compile" name="-debug-start-debuggee">
  45.442 +        <j2seproject3:debug>
  45.443 +            <customize>
  45.444 +                <arg line="${application.args}"/>
  45.445 +            </customize>
  45.446 +        </j2seproject3:debug>
  45.447 +    </target>
  45.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  45.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  45.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  45.451 +    </target>
  45.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  45.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  45.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  45.455 +        <j2seproject3:debug classname="${debug.class}"/>
  45.456 +    </target>
  45.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  45.458 +    <target depends="init" name="-pre-debug-fix">
  45.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
  45.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
  45.461 +    </target>
  45.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  45.463 +        <j2seproject1:nbjpdareload/>
  45.464 +    </target>
  45.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  45.466 +    <!--
  45.467 +                ===============
  45.468 +                JAVADOC SECTION
  45.469 +                ===============
  45.470 +            -->
  45.471 +    <target depends="init" name="-javadoc-build">
  45.472 +        <mkdir dir="${dist.javadoc.dir}"/>
  45.473 +        <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.474 +            <classpath>
  45.475 +                <path path="${javac.classpath}"/>
  45.476 +            </classpath>
  45.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  45.478 +                <filename name="**/*.java"/>
  45.479 +            </fileset>
  45.480 +        </javadoc>
  45.481 +    </target>
  45.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  45.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  45.484 +    </target>
  45.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  45.486 +    <!--
  45.487 +                =========================
  45.488 +                JUNIT COMPILATION SECTION
  45.489 +                =========================
  45.490 +            -->
  45.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  45.492 +        <mkdir dir="${build.test.classes.dir}"/>
  45.493 +    </target>
  45.494 +    <target name="-pre-compile-test">
  45.495 +        <!-- Empty placeholder for easier customization. -->
  45.496 +        <!-- You can override this target in the ../build.xml file. -->
  45.497 +    </target>
  45.498 +    <target if="do.depend.true" name="-compile-test-depend">
  45.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  45.500 +    </target>
  45.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  45.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  45.503 +        <copy todir="${build.test.classes.dir}">
  45.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.505 +        </copy>
  45.506 +    </target>
  45.507 +    <target name="-post-compile-test">
  45.508 +        <!-- Empty placeholder for easier customization. -->
  45.509 +        <!-- You can override this target in the ../build.xml file. -->
  45.510 +    </target>
  45.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  45.512 +    <target name="-pre-compile-test-single">
  45.513 +        <!-- Empty placeholder for easier customization. -->
  45.514 +        <!-- You can override this target in the ../build.xml file. -->
  45.515 +    </target>
  45.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  45.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  45.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  45.519 +        <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.520 +        <copy todir="${build.test.classes.dir}">
  45.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  45.522 +        </copy>
  45.523 +    </target>
  45.524 +    <target name="-post-compile-test-single">
  45.525 +        <!-- Empty placeholder for easier customization. -->
  45.526 +        <!-- You can override this target in the ../build.xml file. -->
  45.527 +    </target>
  45.528 +    <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.529 +    <!--
  45.530 +                =======================
  45.531 +                JUNIT EXECUTION SECTION
  45.532 +                =======================
  45.533 +            -->
  45.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
  45.535 +        <mkdir dir="${build.test.results.dir}"/>
  45.536 +    </target>
  45.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  45.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  45.539 +    </target>
  45.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  45.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  45.542 +    </target>
  45.543 +    <target depends="init" if="have.tests" name="test-report"/>
  45.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  45.545 +    <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.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  45.547 +        <mkdir dir="${build.test.results.dir}"/>
  45.548 +    </target>
  45.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  45.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  45.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  45.552 +    </target>
  45.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  45.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  45.555 +    </target>
  45.556 +    <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.557 +    <!--
  45.558 +                =======================
  45.559 +                JUNIT DEBUGGING SECTION
  45.560 +                =======================
  45.561 +            -->
  45.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  45.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  45.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  45.565 +        <delete file="${test.report.file}"/>
  45.566 +        <mkdir dir="${build.test.results.dir}"/>
  45.567 +        <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.568 +            <customize>
  45.569 +                <syspropertyset>
  45.570 +                    <propertyref prefix="test-sys-prop."/>
  45.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  45.572 +                </syspropertyset>
  45.573 +                <arg value="${test.class}"/>
  45.574 +                <arg value="showoutput=true"/>
  45.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  45.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  45.577 +            </customize>
  45.578 +        </j2seproject3:debug>
  45.579 +    </target>
  45.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  45.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  45.582 +    </target>
  45.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  45.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  45.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  45.586 +    </target>
  45.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  45.588 +    <!--
  45.589 +                =========================
  45.590 +                APPLET EXECUTION SECTION
  45.591 +                =========================
  45.592 +            -->
  45.593 +    <target depends="init,compile-single" name="run-applet">
  45.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  45.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  45.596 +            <customize>
  45.597 +                <arg value="${applet.url}"/>
  45.598 +            </customize>
  45.599 +        </j2seproject1:java>
  45.600 +    </target>
  45.601 +    <!--
  45.602 +                =========================
  45.603 +                APPLET DEBUGGING  SECTION
  45.604 +                =========================
  45.605 +            -->
  45.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  45.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  45.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  45.609 +            <customize>
  45.610 +                <arg value="${applet.url}"/>
  45.611 +            </customize>
  45.612 +        </j2seproject3:debug>
  45.613 +    </target>
  45.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  45.615 +    <!--
  45.616 +                ===============
  45.617 +                CLEANUP SECTION
  45.618 +                ===============
  45.619 +            -->
  45.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  45.621 +    <target depends="init" name="-do-clean">
  45.622 +        <delete dir="${build.dir}"/>
  45.623 +        <delete dir="${dist.dir}"/>
  45.624 +    </target>
  45.625 +    <target name="-post-clean">
  45.626 +        <!-- Empty placeholder for easier customization. -->
  45.627 +        <!-- You can override this target in the ../build.xml file. -->
  45.628 +    </target>
  45.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  45.630 +</project>
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    46.3 @@ -0,0 +1,8 @@
    46.4 +build.xml.data.CRC32=c2d9be31
    46.5 +build.xml.script.CRC32=09dc18c1
    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=c2d9be31
   46.10 +nbproject/build-impl.xml.script.CRC32=c591e2ef
   46.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    47.3 @@ -0,0 +1,58 @@
    47.4 +build.classes.dir=${build.dir}/classes
    47.5 +build.classes.excludes=**/*.java,**/*.form
    47.6 +# This directory is removed when the project is cleaned:
    47.7 +build.dir=build
    47.8 +build.generated.dir=${build.dir}/generated
    47.9 +# Only compile against the classpath explicitly listed here:
   47.10 +build.sysclasspath=ignore
   47.11 +build.test.classes.dir=${build.dir}/test/classes
   47.12 +build.test.results.dir=${build.dir}/test/results
   47.13 +debug.classpath=\
   47.14 +    ${run.classpath}
   47.15 +debug.test.classpath=\
   47.16 +    ${run.test.classpath}
   47.17 +# This directory is removed when the project is cleaned:
   47.18 +dist.dir=dist
   47.19 +dist.jar=${dist.dir}/boolcircuit.jar
   47.20 +dist.javadoc.dir=${dist.dir}/javadoc
   47.21 +excludes=
   47.22 +includes=**
   47.23 +jar.compress=false
   47.24 +javac.classpath=
   47.25 +# Space-separated list of extra javac options
   47.26 +javac.compilerargs=
   47.27 +javac.deprecation=false
   47.28 +javac.source=1.5
   47.29 +javac.target=1.5
   47.30 +javac.test.classpath=\
   47.31 +    ${javac.classpath}:\
   47.32 +    ${build.classes.dir}:\
   47.33 +    ${libs.junit.classpath}
   47.34 +javadoc.additionalparam=
   47.35 +javadoc.author=false
   47.36 +javadoc.encoding=
   47.37 +javadoc.noindex=false
   47.38 +javadoc.nonavbar=false
   47.39 +javadoc.notree=false
   47.40 +javadoc.private=false
   47.41 +javadoc.splitindex=true
   47.42 +javadoc.use=true
   47.43 +javadoc.version=false
   47.44 +javadoc.windowtitle=
   47.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   47.46 +# The library definition has always preference over this property.
   47.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   47.48 +meta.inf.dir=${src.dir}/META-INF
   47.49 +platform.active=default_platform
   47.50 +run.classpath=\
   47.51 +    ${javac.classpath}:\
   47.52 +    ${build.classes.dir}
   47.53 +# Space-separated list of JVM arguments used when running the project
   47.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   47.55 +# or test-sys-prop.name=value to set system properties for unit tests):
   47.56 +run.jvmargs=
   47.57 +run.test.classpath=\
   47.58 +    ${javac.test.classpath}:\
   47.59 +    ${build.test.classes.dir}
   47.60 +src.dir=src
   47.61 +test.src.dir=test
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 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>pinbasedsolution</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/samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    49.3 @@ -0,0 +1,71 @@
    49.4 +/*
    49.5 + * The contents of this file are subject to the terms of the Common Development
    49.6 + * and Distribution License (the License). You may not use this file except in
    49.7 + * compliance with the License.
    49.8 + *
    49.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   49.10 + * or http://www.netbeans.org/cddl.txt.
   49.11 + *
   49.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   49.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   49.14 + * If applicable, add the following below the CDDL Header, with the fields
   49.15 + * enclosed by brackets [] replaced by your own identifying information:
   49.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   49.17 + *
   49.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   49.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   49.20 + * Microsystems, Inc. All Rights Reserved.
   49.21 + */
   49.22 +
   49.23 +package org.netbeans.apifest.boolcircuit;
   49.24 +
   49.25 +/**
   49.26 + * A representation of a logic circuit.
   49.27 + * It can only be constructed from an element net.
   49.28 + * Usage:
   49.29 + * <pre>
   49.30 + *  Circuit c = Circuit.construct(
   49.31 + *      Element.createOr(
   49.32 + *          Element.createAnd(
   49.33 + *              Element.createInput(0),
   49.34 + *              Element.createInput(1)
   49.35 + *          ),
   49.36 + *          Element.createInput(2)
   49.37 + *      )
   49.38 + *  );
   49.39 + *            
   49.40 + *  boolean val = c.evaluate(false, true, false));
   49.41 + * </pre>
   49.42 + */
   49.43 +public class Circuit {
   49.44 +    Element root;
   49.45 +    int pins;
   49.46 +    
   49.47 +    private Circuit(Element elem) {
   49.48 +        root = elem;
   49.49 +        pins = 1 + root.maxInput();
   49.50 +    }
   49.51 +    
   49.52 +    /**
   49.53 +     * Evaluate output of the circuit for given inputs.
   49.54 +     * For general 
   49.55 +     */
   49.56 +    public boolean evaluate(Boolean ... inputs) throws UnstableException {
   49.57 +        if (inputs.length != pins) throw new IllegalArgumentException("Wrong number of inputs, " + pins + " expected.");
   49.58 +        boolean[] inp = new boolean[pins];
   49.59 +        for (int i=0; i<pins; i++) inp[i] = inputs[i];
   49.60 +        return root.evaluate(inp);
   49.61 +    }
   49.62 +    
   49.63 +    /**
   49.64 +     * Creates a circuit from a preconstructed element net.
   49.65 +     *
   49.66 +     * @param a top-level element representing the logic net.
   49.67 +     * @return a circuit prepared for evaluating result for given inputs.
   49.68 +     * 
   49.69 +     */
   49.70 +    public static Circuit construct(Element elem) {
   49.71 +        return new Circuit(elem);
   49.72 +    }
   49.73 +    
   49.74 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java	Sat Jun 14 09:52:45 2008 +0200
    50.3 @@ -0,0 +1,97 @@
    50.4 +/*
    50.5 + * Element.java
    50.6 + *
    50.7 + * Created on 12. červenec 2006, 14:14
    50.8 + *
    50.9 + * To change this template, choose Tools | Template Manager
   50.10 + * and open the template in the editor.
   50.11 + */
   50.12 +
   50.13 +package org.netbeans.apifest.boolcircuit;
   50.14 +
   50.15 +/**
   50.16 + * Representation of an element in the circuit.
   50.17 + * The internal behaviour of the element is opaque to the API user, it can only
   50.18 + * be used as a building block for logical equations, using primitive operation
   50.19 + * factories and a factory for input pin representation.
   50.20 + * Elements are chained to create the logical net. The inputs to the net are
   50.21 + * represented by the elements created by {@link #createInput(boolean[])}
   50.22 + * factory method.
   50.23 + */
   50.24 +public abstract class Element {
   50.25 +        
   50.26 +    /** Creates a new instance of Element */
   50.27 +    private Element() {
   50.28 +    }
   50.29 +    
   50.30 +    /**
   50.31 +      */
   50.32 +    abstract boolean evaluate(boolean[] inputs);
   50.33 +    
   50.34 +    abstract int maxInput();
   50.35 +    
   50.36 +    /**
   50.37 +     * Creates an Element representing 2-input AND function.
   50.38 +     *
   50.39 +     */
   50.40 +    public static Element createAnd(final Element source1, final Element source2) {
   50.41 +        return new Element() {
   50.42 +            boolean evaluate(boolean[] inputs) {
   50.43 +                return source1.evaluate(inputs) & source2.evaluate(inputs);
   50.44 +            }
   50.45 +            
   50.46 +            int maxInput() {
   50.47 +                return Math.max(source1.maxInput(), source2.maxInput());
   50.48 +            }
   50.49 +        };
   50.50 +    }
   50.51 +
   50.52 +    /**
   50.53 +     * Creates an Element representing 2-input OR function.
   50.54 +     *
   50.55 +     */
   50.56 +    public static Element createOr(final Element source1, final Element source2) {
   50.57 +        return new Element() {
   50.58 +            boolean evaluate(boolean[] inputs) {
   50.59 +                return source1.evaluate(inputs) | source2.evaluate(inputs);
   50.60 +            }
   50.61 +            
   50.62 +            int maxInput() {
   50.63 +                return Math.max(source1.maxInput(), source2.maxInput());
   50.64 +            }
   50.65 +        };
   50.66 +    }
   50.67 +    
   50.68 +    /**
   50.69 +     * Creates an Element representing negation.
   50.70 +     *
   50.71 +     */
   50.72 +    public static Element createNot(final Element source1) {
   50.73 +        return new Element() {
   50.74 +            boolean evaluate(boolean[] inputs) {
   50.75 +                return !source1.evaluate(inputs);
   50.76 +            }
   50.77 +            
   50.78 +            int maxInput() {
   50.79 +                return source1.maxInput();
   50.80 +            }
   50.81 +        };
   50.82 +    }
   50.83 +    
   50.84 +    /**
   50.85 +     * Creates an Element representing input to the logical net.
   50.86 +     *
   50.87 +     */
   50.88 +    public static Element createInput(final int pin) {
   50.89 +        return new Element() {
   50.90 +            boolean evaluate(boolean[] inputs) {
   50.91 +                return inputs[pin];
   50.92 +            }
   50.93 +            
   50.94 +            int maxInput() {
   50.95 +                return pin;
   50.96 +            }
   50.97 +        };
   50.98 +    }
   50.99 +    
  50.100 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/samples/apifest1/day1/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/UnstableException.java	Sat Jun 14 09:52:45 2008 +0200
    51.3 @@ -0,0 +1,24 @@
    51.4 +/*
    51.5 + * UnstableException.java
    51.6 + *
    51.7 + * Created on 12. červenec 2006, 14:15
    51.8 + *
    51.9 + * To change this template, choose Tools | Template Manager
   51.10 + * and open the template in the editor.
   51.11 + */
   51.12 +
   51.13 +package org.netbeans.apifest.boolcircuit;
   51.14 +
   51.15 +/**
   51.16 + * Exception representing that the circuit is unstable for given
   51.17 + * input configuration. It can happen in case there is backward loop
   51.18 + * in the logic.
   51.19 + *
   51.20 + */
   51.21 +public class UnstableException extends Exception {
   51.22 +    
   51.23 +    /** Creates a new instance of UnstableException */
   51.24 +    public UnstableException() {
   51.25 +    }
   51.26 +    
   51.27 +}
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/samples/apifest1/day1/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    52.3 @@ -0,0 +1,129 @@
    52.4 +/*
    52.5 + * The contents of this file are subject to the terms of the Common Development
    52.6 + * and Distribution License (the License). You may not use this file except in
    52.7 + * compliance with the License.
    52.8 + *
    52.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   52.10 + * or http://www.netbeans.org/cddl.txt.
   52.11 + *
   52.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   52.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   52.14 + * If applicable, add the following below the CDDL Header, with the fields
   52.15 + * enclosed by brackets [] replaced by your own identifying information:
   52.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   52.17 + *
   52.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   52.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   52.20 + * Microsystems, Inc. All Rights Reserved.
   52.21 + */
   52.22 +
   52.23 +package org.netbeans.apifest.boolcircuit;
   52.24 +
   52.25 +import java.security.CodeSource;
   52.26 +import java.security.Permission;
   52.27 +import java.security.PermissionCollection;
   52.28 +import java.security.Policy;
   52.29 +import java.util.Collection;
   52.30 +import java.util.Collections;
   52.31 +import java.util.Enumeration;
   52.32 +import junit.framework.TestCase;
   52.33 +import junit.framework.*;
   52.34 +
   52.35 +/** The initial quest for this APIFest is to create an API for boolean 
   52.36 + * circuits. Such API shall be able to compose a boolean circuit from
   52.37 + * basic elements and evaluate the result given initial values for 
   52.38 + * input variables.
   52.39 + * <p>
   52.40 + * The basic elements include:
   52.41 + * <ul>
   52.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   52.43 + *          on output 1 and 1 to 0
   52.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   52.45 + *          inputs are 1, otherwise it is 0
   52.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   52.47 + *          in the case when both inputs are 0
   52.48 + * </ul>
   52.49 + *
   52.50 + * <p>
   52.51 + * The boolean circuit can be used to represent boolean formulas and compute
   52.52 + * the results for certain values of its inputs. The individual tasks described
   52.53 + * as tests bellow.
   52.54 + *
   52.55 + * <p>
   52.56 + * Links of interest:
   52.57 + * <ul>
   52.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   52.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   52.60 + * </ul>
   52.61 + */
   52.62 +public class CircuitTest extends TestCase {
   52.63 +    static {
   52.64 +        // your code shall run without any permissions
   52.65 +    }
   52.66 +    
   52.67 +    public CircuitTest(String testName) {
   52.68 +        super(testName);
   52.69 +    }
   52.70 +
   52.71 +    protected void setUp() throws Exception {
   52.72 +    }
   52.73 +
   52.74 +    protected void tearDown() throws Exception {
   52.75 +    }
   52.76 +    
   52.77 +
   52.78 +    // BEGIN: apifest.day1.pinbasedsolution.CircuitTest
   52.79 +    /** 
   52.80 +     * Create a circuit to evaluate x1 and x2 and then
   52.81 +     * verify that its result is false for input (false, true) and
   52.82 +     * it is true for input (true, true).
   52.83 +     */
   52.84 +    public void testX1andX2() throws Exception {
   52.85 +        Circuit c = Circuit.construct(
   52.86 +            Element.createAnd(
   52.87 +                Element.createInput(0),
   52.88 +                Element.createInput(1)
   52.89 +            )
   52.90 +        );
   52.91 +        
   52.92 +        assertFalse ("false AND true is false", c.evaluate(false, true));
   52.93 +        assertTrue ("true AND true is true", c.evaluate(true, true));
   52.94 +    }
   52.95 +    
   52.96 +    /** 
   52.97 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   52.98 +     * verify that its result is false for input (false, true, false) and
   52.99 +     * it is true for input (false, false, true).
  52.100 +     */
  52.101 +    public void testX1andX2orX3() throws Exception {
  52.102 +        Circuit c = Circuit.construct(
  52.103 +            Element.createOr(
  52.104 +                Element.createAnd(
  52.105 +                    Element.createInput(0),
  52.106 +                    Element.createInput(1)
  52.107 +                ),
  52.108 +                Element.createInput(2)
  52.109 +            )
  52.110 +        );
  52.111 +        
  52.112 +        assertFalse ("(false AND true) OR false is false", c.evaluate(false, true, false));
  52.113 +        assertTrue ("(false AND false) OR true is true", c.evaluate(false, false, true));
  52.114 +    }
  52.115 +    
  52.116 +    /** 
  52.117 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  52.118 +     * verify that its result is true for all values of x1.
  52.119 +     */
  52.120 +    public void testAlwaysTrue() throws Exception {
  52.121 +        Circuit c = Circuit.construct(
  52.122 +            Element.createOr(
  52.123 +                Element.createInput(0),
  52.124 +                Element.createNot(Element.createInput(0))
  52.125 +            )
  52.126 +        );
  52.127 +        
  52.128 +        assertTrue ("tautology is true", c.evaluate(false));
  52.129 +        assertTrue ("tautology is true", c.evaluate(true));
  52.130 +    }
  52.131 +    // END: apifest.day1.pinbasedsolution.CircuitTest
  52.132 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/samples/apifest1/day1/stackbasedsolution/build.xml	Sat Jun 14 09:52:45 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="stackbasedsolution" default="default" basedir=".">
    53.9 +    <description>Builds, tests, and runs the project stackbasedsolution.</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="stackbasedsolution-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/samples/apifest1/day1/stackbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    54.3 @@ -0,0 +1,627 @@
    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:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="stackbasedsolution-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 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="dt_socket">
  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.includes}*.class"/>
  54.242 +                </nbjpdareload>
  54.243 +            </sequential>
  54.244 +        </macrodef>
  54.245 +    </target>
  54.246 +    <target name="-init-debug-args">
  54.247 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  54.248 +        <condition property="have-jdk-older-than-1.4">
  54.249 +            <or>
  54.250 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
  54.251 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
  54.252 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
  54.253 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
  54.254 +            </or>
  54.255 +        </condition>
  54.256 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  54.257 +            <istrue value="${have-jdk-older-than-1.4}"/>
  54.258 +        </condition>
  54.259 +    </target>
  54.260 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
  54.261 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  54.262 +            <attribute default="${main.class}" name="classname"/>
  54.263 +            <attribute default="${debug.classpath}" name="classpath"/>
  54.264 +            <element name="customize" optional="true"/>
  54.265 +            <sequential>
  54.266 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  54.267 +                    <jvmarg line="${debug-args-line}"/>
  54.268 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  54.269 +                    <jvmarg line="${run.jvmargs}"/>
  54.270 +                    <classpath>
  54.271 +                        <path path="@{classpath}"/>
  54.272 +                    </classpath>
  54.273 +                    <syspropertyset>
  54.274 +                        <propertyref prefix="run-sys-prop."/>
  54.275 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  54.276 +                    </syspropertyset>
  54.277 +                    <customize/>
  54.278 +                </java>
  54.279 +            </sequential>
  54.280 +        </macrodef>
  54.281 +    </target>
  54.282 +    <target name="-init-macrodef-java">
  54.283 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.284 +            <attribute default="${main.class}" name="classname"/>
  54.285 +            <element name="customize" optional="true"/>
  54.286 +            <sequential>
  54.287 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
  54.288 +                    <jvmarg line="${run.jvmargs}"/>
  54.289 +                    <classpath>
  54.290 +                        <path path="${run.classpath}"/>
  54.291 +                    </classpath>
  54.292 +                    <syspropertyset>
  54.293 +                        <propertyref prefix="run-sys-prop."/>
  54.294 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  54.295 +                    </syspropertyset>
  54.296 +                    <customize/>
  54.297 +                </java>
  54.298 +            </sequential>
  54.299 +        </macrodef>
  54.300 +    </target>
  54.301 +    <target name="-init-presetdef-jar">
  54.302 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  54.303 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
  54.304 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  54.305 +            </jar>
  54.306 +        </presetdef>
  54.307 +    </target>
  54.308 +    <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.309 +    <!--
  54.310 +                ===================
  54.311 +                COMPILATION SECTION
  54.312 +                ===================
  54.313 +            -->
  54.314 +    <target depends="init" name="deps-jar" unless="no.deps"/>
  54.315 +    <target depends="init,deps-jar" name="-pre-pre-compile">
  54.316 +        <mkdir dir="${build.classes.dir}"/>
  54.317 +    </target>
  54.318 +    <target name="-pre-compile">
  54.319 +        <!-- Empty placeholder for easier customization. -->
  54.320 +        <!-- You can override this target in the ../build.xml file. -->
  54.321 +    </target>
  54.322 +    <target if="do.depend.true" name="-compile-depend">
  54.323 +        <j2seproject3:depend/>
  54.324 +    </target>
  54.325 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
  54.326 +        <j2seproject3:javac/>
  54.327 +        <copy todir="${build.classes.dir}">
  54.328 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.329 +        </copy>
  54.330 +    </target>
  54.331 +    <target name="-post-compile">
  54.332 +        <!-- Empty placeholder for easier customization. -->
  54.333 +        <!-- You can override this target in the ../build.xml file. -->
  54.334 +    </target>
  54.335 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  54.336 +    <target name="-pre-compile-single">
  54.337 +        <!-- Empty placeholder for easier customization. -->
  54.338 +        <!-- You can override this target in the ../build.xml file. -->
  54.339 +    </target>
  54.340 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  54.341 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  54.342 +        <j2seproject3:force-recompile/>
  54.343 +        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
  54.344 +    </target>
  54.345 +    <target name="-post-compile-single">
  54.346 +        <!-- Empty placeholder for easier customization. -->
  54.347 +        <!-- You can override this target in the ../build.xml file. -->
  54.348 +    </target>
  54.349 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  54.350 +    <!--
  54.351 +                ====================
  54.352 +                JAR BUILDING SECTION
  54.353 +                ====================
  54.354 +            -->
  54.355 +    <target depends="init" name="-pre-pre-jar">
  54.356 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  54.357 +        <mkdir dir="${dist.jar.dir}"/>
  54.358 +    </target>
  54.359 +    <target name="-pre-jar">
  54.360 +        <!-- Empty placeholder for easier customization. -->
  54.361 +        <!-- You can override this target in the ../build.xml file. -->
  54.362 +    </target>
  54.363 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
  54.364 +        <j2seproject1:jar/>
  54.365 +    </target>
  54.366 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
  54.367 +        <j2seproject1:jar manifest="${manifest.file}"/>
  54.368 +    </target>
  54.369 +    <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.370 +        <j2seproject1:jar manifest="${manifest.file}">
  54.371 +            <j2seproject1:manifest>
  54.372 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  54.373 +            </j2seproject1:manifest>
  54.374 +        </j2seproject1:jar>
  54.375 +        <echo>To run this application from the command line without Ant, try:</echo>
  54.376 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  54.377 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  54.378 +        <pathconvert property="run.classpath.with.dist.jar">
  54.379 +            <path path="${run.classpath}"/>
  54.380 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  54.381 +        </pathconvert>
  54.382 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  54.383 +    </target>
  54.384 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
  54.385 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  54.386 +        <pathconvert property="run.classpath.without.build.classes.dir">
  54.387 +            <path path="${run.classpath}"/>
  54.388 +            <map from="${build.classes.dir.resolved}" to=""/>
  54.389 +        </pathconvert>
  54.390 +        <pathconvert pathsep=" " property="jar.classpath">
  54.391 +            <path path="${run.classpath.without.build.classes.dir}"/>
  54.392 +            <chainedmapper>
  54.393 +                <flattenmapper/>
  54.394 +                <globmapper from="*" to="lib/*"/>
  54.395 +            </chainedmapper>
  54.396 +        </pathconvert>
  54.397 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  54.398 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  54.399 +            <fileset dir="${build.classes.dir}"/>
  54.400 +            <manifest>
  54.401 +                <attribute name="Main-Class" value="${main.class}"/>
  54.402 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  54.403 +            </manifest>
  54.404 +        </copylibs>
  54.405 +        <echo>To run this application from the command line without Ant, try:</echo>
  54.406 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
  54.407 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  54.408 +    </target>
  54.409 +    <target name="-post-jar">
  54.410 +        <!-- Empty placeholder for easier customization. -->
  54.411 +        <!-- You can override this target in the ../build.xml file. -->
  54.412 +    </target>
  54.413 +    <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.414 +    <!--
  54.415 +                =================
  54.416 +                EXECUTION SECTION
  54.417 +                =================
  54.418 +            -->
  54.419 +    <target depends="init,compile" description="Run a main class." name="run">
  54.420 +        <j2seproject1:java>
  54.421 +            <customize>
  54.422 +                <arg line="${application.args}"/>
  54.423 +            </customize>
  54.424 +        </j2seproject1:java>
  54.425 +    </target>
  54.426 +    <target name="-do-not-recompile">
  54.427 +        <property name="javac.includes.binary" value=""/>
  54.428 +    </target>
  54.429 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
  54.430 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  54.431 +        <j2seproject1:java classname="${run.class}"/>
  54.432 +    </target>
  54.433 +    <!--
  54.434 +                =================
  54.435 +                DEBUGGING SECTION
  54.436 +                =================
  54.437 +            -->
  54.438 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
  54.439 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  54.440 +    </target>
  54.441 +    <target depends="init,compile" name="-debug-start-debuggee">
  54.442 +        <j2seproject3:debug>
  54.443 +            <customize>
  54.444 +                <arg line="${application.args}"/>
  54.445 +            </customize>
  54.446 +        </j2seproject3:debug>
  54.447 +    </target>
  54.448 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
  54.449 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
  54.450 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  54.451 +    </target>
  54.452 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
  54.453 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
  54.454 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  54.455 +        <j2seproject3:debug classname="${debug.class}"/>
  54.456 +    </target>
  54.457 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
  54.458 +    <target depends="init" name="-pre-debug-fix">
  54.459 +        <fail unless="fix.includes">Must set fix.includes</fail>
  54.460 +        <property name="javac.includes" value="${fix.includes}.java"/>
  54.461 +    </target>
  54.462 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
  54.463 +        <j2seproject1:nbjpdareload/>
  54.464 +    </target>
  54.465 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
  54.466 +    <!--
  54.467 +                ===============
  54.468 +                JAVADOC SECTION
  54.469 +                ===============
  54.470 +            -->
  54.471 +    <target depends="init" name="-javadoc-build">
  54.472 +        <mkdir dir="${dist.javadoc.dir}"/>
  54.473 +        <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.474 +            <classpath>
  54.475 +                <path path="${javac.classpath}"/>
  54.476 +            </classpath>
  54.477 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
  54.478 +                <filename name="**/*.java"/>
  54.479 +            </fileset>
  54.480 +        </javadoc>
  54.481 +    </target>
  54.482 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
  54.483 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  54.484 +    </target>
  54.485 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
  54.486 +    <!--
  54.487 +                =========================
  54.488 +                JUNIT COMPILATION SECTION
  54.489 +                =========================
  54.490 +            -->
  54.491 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
  54.492 +        <mkdir dir="${build.test.classes.dir}"/>
  54.493 +    </target>
  54.494 +    <target name="-pre-compile-test">
  54.495 +        <!-- Empty placeholder for easier customization. -->
  54.496 +        <!-- You can override this target in the ../build.xml file. -->
  54.497 +    </target>
  54.498 +    <target if="do.depend.true" name="-compile-test-depend">
  54.499 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  54.500 +    </target>
  54.501 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
  54.502 +        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
  54.503 +        <copy todir="${build.test.classes.dir}">
  54.504 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.505 +        </copy>
  54.506 +    </target>
  54.507 +    <target name="-post-compile-test">
  54.508 +        <!-- Empty placeholder for easier customization. -->
  54.509 +        <!-- You can override this target in the ../build.xml file. -->
  54.510 +    </target>
  54.511 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
  54.512 +    <target name="-pre-compile-test-single">
  54.513 +        <!-- Empty placeholder for easier customization. -->
  54.514 +        <!-- You can override this target in the ../build.xml file. -->
  54.515 +    </target>
  54.516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
  54.517 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  54.518 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
  54.519 +        <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.520 +        <copy todir="${build.test.classes.dir}">
  54.521 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  54.522 +        </copy>
  54.523 +    </target>
  54.524 +    <target name="-post-compile-test-single">
  54.525 +        <!-- Empty placeholder for easier customization. -->
  54.526 +        <!-- You can override this target in the ../build.xml file. -->
  54.527 +    </target>
  54.528 +    <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.529 +    <!--
  54.530 +                =======================
  54.531 +                JUNIT EXECUTION SECTION
  54.532 +                =======================
  54.533 +            -->
  54.534 +    <target depends="init" if="have.tests" name="-pre-test-run">
  54.535 +        <mkdir dir="${build.test.results.dir}"/>
  54.536 +    </target>
  54.537 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
  54.538 +        <j2seproject3:junit testincludes="**/*Test.java"/>
  54.539 +    </target>
  54.540 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
  54.541 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  54.542 +    </target>
  54.543 +    <target depends="init" if="have.tests" name="test-report"/>
  54.544 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
  54.545 +    <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.546 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
  54.547 +        <mkdir dir="${build.test.results.dir}"/>
  54.548 +    </target>
  54.549 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
  54.550 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  54.551 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
  54.552 +    </target>
  54.553 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
  54.554 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  54.555 +    </target>
  54.556 +    <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.557 +    <!--
  54.558 +                =======================
  54.559 +                JUNIT DEBUGGING SECTION
  54.560 +                =======================
  54.561 +            -->
  54.562 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
  54.563 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  54.564 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
  54.565 +        <delete file="${test.report.file}"/>
  54.566 +        <mkdir dir="${build.test.results.dir}"/>
  54.567 +        <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.568 +            <customize>
  54.569 +                <syspropertyset>
  54.570 +                    <propertyref prefix="test-sys-prop."/>
  54.571 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
  54.572 +                </syspropertyset>
  54.573 +                <arg value="${test.class}"/>
  54.574 +                <arg value="showoutput=true"/>
  54.575 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
  54.576 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
  54.577 +            </customize>
  54.578 +        </j2seproject3:debug>
  54.579 +    </target>
  54.580 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
  54.581 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
  54.582 +    </target>
  54.583 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
  54.584 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
  54.585 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  54.586 +    </target>
  54.587 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
  54.588 +    <!--
  54.589 +                =========================
  54.590 +                APPLET EXECUTION SECTION
  54.591 +                =========================
  54.592 +            -->
  54.593 +    <target depends="init,compile-single" name="run-applet">
  54.594 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  54.595 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  54.596 +            <customize>
  54.597 +                <arg value="${applet.url}"/>
  54.598 +            </customize>
  54.599 +        </j2seproject1:java>
  54.600 +    </target>
  54.601 +    <!--
  54.602 +                =========================
  54.603 +                APPLET DEBUGGING  SECTION
  54.604 +                =========================
  54.605 +            -->
  54.606 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
  54.607 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  54.608 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  54.609 +            <customize>
  54.610 +                <arg value="${applet.url}"/>
  54.611 +            </customize>
  54.612 +        </j2seproject3:debug>
  54.613 +    </target>
  54.614 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
  54.615 +    <!--
  54.616 +                ===============
  54.617 +                CLEANUP SECTION
  54.618 +                ===============
  54.619 +            -->
  54.620 +    <target depends="init" name="deps-clean" unless="no.deps"/>
  54.621 +    <target depends="init" name="-do-clean">
  54.622 +        <delete dir="${build.dir}"/>
  54.623 +        <delete dir="${dist.dir}"/>
  54.624 +    </target>
  54.625 +    <target name="-post-clean">
  54.626 +        <!-- Empty placeholder for easier customization. -->
  54.627 +        <!-- You can override this target in the ../build.xml file. -->
  54.628 +    </target>
  54.629 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
  54.630 +</project>
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    55.3 @@ -0,0 +1,8 @@
    55.4 +build.xml.data.CRC32=10562595
    55.5 +build.xml.script.CRC32=8e100d5a
    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=10562595
   55.10 +nbproject/build-impl.xml.script.CRC32=4a74b13c
   55.11 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    56.3 @@ -0,0 +1,58 @@
    56.4 +build.classes.dir=${build.dir}/classes
    56.5 +build.classes.excludes=**/*.java,**/*.form
    56.6 +# This directory is removed when the project is cleaned:
    56.7 +build.dir=build
    56.8 +build.generated.dir=${build.dir}/generated
    56.9 +# Only compile against the classpath explicitly listed here:
   56.10 +build.sysclasspath=ignore
   56.11 +build.test.classes.dir=${build.dir}/test/classes
   56.12 +build.test.results.dir=${build.dir}/test/results
   56.13 +debug.classpath=\
   56.14 +    ${run.classpath}
   56.15 +debug.test.classpath=\
   56.16 +    ${run.test.classpath}
   56.17 +# This directory is removed when the project is cleaned:
   56.18 +dist.dir=dist
   56.19 +dist.jar=${dist.dir}/boolcircuit.jar
   56.20 +dist.javadoc.dir=${dist.dir}/javadoc
   56.21 +excludes=
   56.22 +includes=**
   56.23 +jar.compress=false
   56.24 +javac.classpath=
   56.25 +# Space-separated list of extra javac options
   56.26 +javac.compilerargs=
   56.27 +javac.deprecation=false
   56.28 +javac.source=1.5
   56.29 +javac.target=1.5
   56.30 +javac.test.classpath=\
   56.31 +    ${javac.classpath}:\
   56.32 +    ${build.classes.dir}:\
   56.33 +    ${libs.junit.classpath}
   56.34 +javadoc.additionalparam=
   56.35 +javadoc.author=false
   56.36 +javadoc.encoding=
   56.37 +javadoc.noindex=false
   56.38 +javadoc.nonavbar=false
   56.39 +javadoc.notree=false
   56.40 +javadoc.private=false
   56.41 +javadoc.splitindex=true
   56.42 +javadoc.use=true
   56.43 +javadoc.version=false
   56.44 +javadoc.windowtitle=
   56.45 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   56.46 +# The library definition has always preference over this property.
   56.47 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   56.48 +meta.inf.dir=${src.dir}/META-INF
   56.49 +platform.active=default_platform
   56.50 +run.classpath=\
   56.51 +    ${javac.classpath}:\
   56.52 +    ${build.classes.dir}
   56.53 +# Space-separated list of JVM arguments used when running the project
   56.54 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   56.55 +# or test-sys-prop.name=value to set system properties for unit tests):
   56.56 +run.jvmargs=
   56.57 +run.test.classpath=\
   56.58 +    ${javac.test.classpath}:\
   56.59 +    ${build.test.classes.dir}
   56.60 +src.dir=src
   56.61 +test.src.dir=test
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 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>stackbasedsolution</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/samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    58.3 @@ -0,0 +1,28 @@
    58.4 +/*
    58.5 + * The contents of this file are subject to the terms of the Common Development
    58.6 + * and Distribution License (the License). You may not use this file except in
    58.7 + * compliance with the License.
    58.8 + *
    58.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   58.10 + * or http://www.netbeans.org/cddl.txt.
   58.11 + *
   58.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   58.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   58.14 + * If applicable, add the following below the CDDL Header, with the fields
   58.15 + * enclosed by brackets [] replaced by your own identifying information:
   58.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   58.17 + *
   58.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   58.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   58.20 + * Microsystems, Inc. All Rights Reserved.
   58.21 + */
   58.22 +
   58.23 +package org.netbeans.apifest.boolcircuit;
   58.24 +
   58.25 +import java.util.Stack;
   58.26 +
   58.27 +/**
   58.28 + */ 
   58.29 +public interface Circuit {
   58.30 +    public char evaluate (Stack<Character> input) throws IllegalArgumentException;
   58.31 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/CircuitFactory.java	Sat Jun 14 09:52:45 2008 +0200
    59.3 @@ -0,0 +1,50 @@
    59.4 +/*
    59.5 + * CircuitFactory.java
    59.6 + *
    59.7 + * Created on July 12, 2006, 3:01 PM
    59.8 + *
    59.9 + * To change this template, choose Tools | Template Manager
   59.10 + * and open the template in the editor.
   59.11 + */
   59.12 +
   59.13 +package org.netbeans.apifest.boolcircuit;
   59.14 +
   59.15 +import java.util.Stack;
   59.16 +
   59.17 +/**
   59.18 + *
   59.19 + */
   59.20 +public class CircuitFactory {
   59.21 +    
   59.22 +    /** Creates a new instance of CircuitFactory */
   59.23 +    private  CircuitFactory() {
   59.24 +    }
   59.25 +    
   59.26 +    public final static Circuit join (final Circuit c1, final Circuit c2, final Operation op) {
   59.27 +        return new Circuit () {
   59.28 +            public char evaluate(Stack input) throws IllegalArgumentException {
   59.29 +                return op.evaluate(c1.evaluate(input), c2.evaluate(input));
   59.30 +            }
   59.31 +        };
   59.32 +    }
   59.33 +    
   59.34 +    public final static Circuit getBasicCircuit (final Operation op) {
   59.35 +        return new Circuit () {
   59.36 +            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
   59.37 +                // special handling of unary oparation
   59.38 +                if (op instanceof Operation.Neg) {
   59.39 +                    return op.evaluate(input.pop(), input.peek());
   59.40 +                } else {
   59.41 +                    return op.evaluate(input.pop(), input.pop());
   59.42 +                }
   59.43 +            }
   59.44 +        };
   59.45 +    }
   59.46 +    public final static Circuit getTrivialCircuit () {
   59.47 +        return new Circuit () {
   59.48 +            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
   59.49 +                return input.peek();
   59.50 +            }
   59.51 +        };
   59.52 +    }
   59.53 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/samples/apifest1/day1/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Operation.java	Sat Jun 14 09:52:45 2008 +0200
    60.3 @@ -0,0 +1,53 @@
    60.4 +/*
    60.5 + * Operation.java
    60.6 + *
    60.7 + * Created on July 12, 2006, 3:06 PM
    60.8 + *
    60.9 + * To change this template, choose Tools | Template Manager
   60.10 + * and open the template in the editor.
   60.11 + */
   60.12 +
   60.13 +package org.netbeans.apifest.boolcircuit;
   60.14 +
   60.15 +/**
   60.16 + *
   60.17 + */
   60.18 +public interface Operation {
   60.19 +    public char evaluate (char i1, char i2) throws IllegalArgumentException;
   60.20 +    public final static Operation OR = new Or ();
   60.21 +    public final static Operation AND = new And ();
   60.22 +    public final static Operation NEG = new Neg ();
   60.23 +    
   60.24 +    
   60.25 +    static class And implements Operation {
   60.26 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
   60.27 +            if (i1 != '0' && i1 != '1') {
   60.28 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
   60.29 +            }
   60.30 +            if (i2 != '0' && i2 != '1') {
   60.31 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
   60.32 +            }
   60.33 +            return i1 == '1' && i2 == '1' ? '1' : '0';
   60.34 +        }
   60.35 +    }
   60.36 +    static class Or implements Operation {
   60.37 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
   60.38 +            if (i1 != '0' && i1 != '1') {
   60.39 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
   60.40 +            }
   60.41 +            if (i2 != '0' && i2 != '1') {
   60.42 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
   60.43 +            }
   60.44 +            return i1 == '1' || i2 == '1' ? '1' : '0';
   60.45 +        }
   60.46 +    }
   60.47 +    static class Neg implements Operation {
   60.48 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
   60.49 +            if (i1 != '0' && i1 != '1') {
   60.50 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
   60.51 +            }
   60.52 +            return i1 == '1' ? '0' : '1';
   60.53 +        }
   60.54 +    }
   60.55 +}
   60.56 +
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/samples/apifest1/day1/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    61.3 @@ -0,0 +1,107 @@
    61.4 +/*
    61.5 + * The contents of this file are subject to the terms of the Common Development
    61.6 + * and Distribution License (the License). You may not use this file except in
    61.7 + * compliance with the License.
    61.8 + *
    61.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   61.10 + * or http://www.netbeans.org/cddl.txt.
   61.11 + *
   61.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   61.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   61.14 + * If applicable, add the following below the CDDL Header, with the fields
   61.15 + * enclosed by brackets [] replaced by your own identifying information:
   61.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   61.17 + *
   61.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   61.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   61.20 + * Microsystems, Inc. All Rights Reserved.
   61.21 + */
   61.22 +
   61.23 +package org.netbeans.apifest.boolcircuit;
   61.24 +
   61.25 +import java.util.Arrays;
   61.26 +import java.util.Stack;
   61.27 +import junit.framework.TestCase;
   61.28 +
   61.29 +/** The initial quest for this APIFest is to create an API for boolean 
   61.30 + * circuits. Such API shall be able to compose a boolean circuit from
   61.31 + * basic elements and evaluate the result given initial values for 
   61.32 + * input variables.
   61.33 + * <p>
   61.34 + * The basic elements include:
   61.35 + * <ul>
   61.36 + *   <li>negation - has one input and one output and changes 0 on input to 
   61.37 + *          on output 1 and 1 to 0
   61.38 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   61.39 + *          inputs are 1, otherwise it is 0
   61.40 + *   <li>or - has two inputs and one output. The output is 1 always, except
   61.41 + *          in the case when both inputs are 0
   61.42 + * </ul>
   61.43 + *
   61.44 + * <p>
   61.45 + * The boolean circuit can be used to represent boolean formulas and compute
   61.46 + * the results for certain values of its inputs. The individual tasks described
   61.47 + * as tests bellow.
   61.48 + *
   61.49 + * <p>
   61.50 + * Links of interest:
   61.51 + * <ul>
   61.52 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   61.53 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   61.54 + * </ul>
   61.55 + */
   61.56 +public class CircuitTest extends TestCase {
   61.57 +    static {
   61.58 +        // your code shall run without any permissions
   61.59 +    }
   61.60 +    
   61.61 +    public CircuitTest(String testName) {
   61.62 +        super(testName);
   61.63 +    }
   61.64 +
   61.65 +    protected void setUp() throws Exception {
   61.66 +    }
   61.67 +
   61.68 +    protected void tearDown() throws Exception {
   61.69 +    }
   61.70 +    
   61.71 +    // BEGIN: apifest.day1.stackbasedsolution.CircuitTest
   61.72 +    /** 
   61.73 +     * Create a circuit to evaluate x1 and x2 and then
   61.74 +     * verify that its result is false for input (false, true) and
   61.75 +     * it is true for input (true, true).
   61.76 +     */
   61.77 +    public void testX1andX2() {
   61.78 +        Stack<Character> s = new Stack<Character> ();
   61.79 +        s.addAll(Arrays.asList('1', '1'));
   61.80 +        assertEquals("'1' for '11' input.", '1', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
   61.81 +        s.addAll(Arrays.asList('1', '0'));
   61.82 +        assertEquals("'0' for '10' input.", '0', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
   61.83 +    }
   61.84 +    
   61.85 +    /** 
   61.86 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   61.87 +     * verify that its result is false for input (false, true, false) and
   61.88 +     * it is true for input (false, false, true).
   61.89 +     */
   61.90 +    public void testX1andX2orX3() {
   61.91 +        Stack<Character> s = new Stack<Character> ();
   61.92 +        s.addAll(Arrays.asList('0', '1', '0'));
   61.93 +        assertEquals("'0' for '010' input.", '0', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
   61.94 +        s.addAll(Arrays.asList('0', '0', '1'));
   61.95 +        assertEquals("'1' for '001' input.", '1', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
   61.96 +    }
   61.97 +    /** 
   61.98 +     * Create a circuit to evaluate (x1 or not(x1)) and then
   61.99 +     * verify that its result is true for all values of x1.
  61.100 +     */
  61.101 +    public void testAlwaysTrue() {
  61.102 +        Circuit alwaysTrue = CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.NEG), Operation.OR);
  61.103 +        Stack<Character> s = new Stack<Character> ();
  61.104 +        s.addAll(Arrays.asList('0', '0'));
  61.105 +        assertEquals ("'1' for '00'", '1', alwaysTrue.evaluate(s));
  61.106 +        s.addAll(Arrays.asList('1', '1'));
  61.107 +        assertEquals ("'1' for '11'", '1', alwaysTrue.evaluate(s));
  61.108 +    }
  61.109 +    // END: apifest.day1.stackbasedsolution.CircuitTest
  61.110 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/samples/apifest1/day1/subclassingsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
    62.3 @@ -0,0 +1,69 @@
    62.4 +<?xml version="1.0" encoding="UTF-8"?>
    62.5 +<!-- You may freely edit this file. See commented blocks below for -->
    62.6 +<!-- some examples of how to customize the build. -->
    62.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    62.8 +<project name="subclassingsolution" default="default" basedir=".">
    62.9 +    <description>Builds, tests, and runs the project boolcircuit.</description>
   62.10 +    <import file="nbproject/build-impl.xml"/>
   62.11 +    <!--
   62.12 +
   62.13 +    There exist several targets which are by default empty and which can be 
   62.14 +    used for execution of your tasks. These targets are usually executed 
   62.15 +    before and after some main targets. They are: 
   62.16 +
   62.17 +      -pre-init:                 called before initialization of project properties
   62.18 +      -post-init:                called after initialization of project properties
   62.19 +      -pre-compile:              called before javac compilation
   62.20 +      -post-compile:             called after javac compilation
   62.21 +      -pre-compile-single:       called before javac compilation of single file
   62.22 +      -post-compile-single:      called after javac compilation of single file
   62.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   62.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   62.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   62.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   62.27 +      -pre-jar:                  called before JAR building
   62.28 +      -post-jar:                 called after JAR building
   62.29 +      -post-clean:               called after cleaning build products
   62.30 +
   62.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   62.32 +
   62.33 +    Example of inserting an obfuscator after compilation could look like this:
   62.34 +
   62.35 +        <target name="-post-compile">
   62.36 +            <obfuscate>
   62.37 +                <fileset dir="${build.classes.dir}"/>
   62.38 +            </obfuscate>
   62.39 +        </target>
   62.40 +
   62.41 +    For list of available properties check the imported 
   62.42 +    nbproject/build-impl.xml file. 
   62.43 +
   62.44 +
   62.45 +    Another way to customize the build is by overriding existing main targets.
   62.46 +    The targets of interest are: 
   62.47 +
   62.48 +      -init-macrodef-javac:     defines macro for javac compilation
   62.49 +      -init-macrodef-junit:     defines macro for junit execution
   62.50 +      -init-macrodef-debug:     defines macro for class debugging
   62.51 +      -init-macrodef-java:      defines macro for class execution
   62.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   62.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   62.54 +      run:                      execution of project 
   62.55 +      -javadoc-build:           Javadoc generation
   62.56 +      test-report:              JUnit report generation
   62.57 +
   62.58 +    An example of overriding the target for project execution could look like this:
   62.59 +
   62.60 +        <target name="run" depends="boolcircuit-impl.jar">
   62.61 +            <exec dir="bin" executable="launcher.exe">
   62.62 +                <arg file="${dist.jar}"/>
   62.63 +            </exec>
   62.64 +        </target>
   62.65 +
   62.66 +    Notice that the overridden target depends on the jar target and not only on 
   62.67 +    the compile target as the regular run target does. Again, for a list of available 
   62.68 +    properties which you can use, check the target you are overriding in the
   62.69 +    nbproject/build-impl.xml file. 
   62.70 +
   62.71 +    -->
   62.72 +</project>
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/samples/apifest1/day1/subclassingsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    63.3 @@ -0,0 +1,547 @@
    63.4 +<?xml version="1.0" encoding="UTF-8"?>
    63.5 +<!--
    63.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    63.7 +***         EDIT ../build.xml INSTEAD         ***
    63.8 +
    63.9 +For the purpose of easier reading the script
   63.10 +is divided into following sections:
   63.11 +
   63.12 +  - initialization
   63.13 +  - compilation
   63.14 +  - jar
   63.15 +  - execution
   63.16 +  - debugging
   63.17 +  - javadoc
   63.18 +  - junit compilation
   63.19 +  - junit execution
   63.20 +  - junit debugging
   63.21 +  - applet
   63.22 +  - cleanup
   63.23 +
   63.24 +-->
   63.25 +<project name="subclassingsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   63.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   63.27 +    <!-- 
   63.28 +    ======================
   63.29 +    INITIALIZATION SECTION 
   63.30 +    ======================
   63.31 +    -->
   63.32 +    <target name="-pre-init">
   63.33 +        <!-- Empty placeholder for easier customization. -->
   63.34 +        <!-- You can override this target in the ../build.xml file. -->
   63.35 +    </target>
   63.36 +    <target name="-init-private" depends="-pre-init">
   63.37 +        <property file="nbproject/private/private.properties"/>
   63.38 +    </target>
   63.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   63.40 +        <property file="${user.properties.file}"/>
   63.41 +        <!-- The two properties below are usually overridden -->
   63.42 +        <!-- by the active platform. Just a fallback. -->
   63.43 +        <property name="default.javac.source" value="1.4"/>
   63.44 +        <property name="default.javac.target" value="1.4"/>
   63.45 +    </target>
   63.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   63.47 +        <property file="nbproject/project.properties"/>
   63.48 +    </target>
   63.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   63.50 +        <available file="${manifest.file}" property="manifest.available"/>
   63.51 +        <condition property="manifest.available+main.class">
   63.52 +            <and>
   63.53 +                <isset property="manifest.available"/>
   63.54 +                <isset property="main.class"/>
   63.55 +                <not>
   63.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   63.57 +                </not>
   63.58 +            </and>
   63.59 +        </condition>
   63.60 +        <condition property="manifest.available+main.class+mkdist.available">
   63.61 +            <and>
   63.62 +                <istrue value="${manifest.available+main.class}"/>
   63.63 +                <isset property="libs.CopyLibs.classpath"/>
   63.64 +            </and>
   63.65 +        </condition>
   63.66 +        <condition property="have.tests">
   63.67 +            <or>
   63.68 +                <available file="${test.src.dir}"/>
   63.69 +            </or>
   63.70 +        </condition>
   63.71 +        <condition property="have.sources">
   63.72 +            <or>
   63.73 +                <available file="${src.dir}"/>
   63.74 +            </or>
   63.75 +        </condition>
   63.76 +        <condition property="netbeans.home+have.tests">
   63.77 +            <and>
   63.78 +                <isset property="netbeans.home"/>
   63.79 +                <isset property="have.tests"/>
   63.80 +            </and>
   63.81 +        </condition>
   63.82 +        <condition property="no.javadoc.preview">
   63.83 +            <isfalse value="${javadoc.preview}"/>
   63.84 +        </condition>
   63.85 +        <property name="run.jvmargs" value=""/>
   63.86 +        <property name="javac.compilerargs" value=""/>
   63.87 +        <property name="work.dir" value="${basedir}"/>
   63.88 +        <condition property="no.deps">
   63.89 +            <and>
   63.90 +                <istrue value="${no.dependencies}"/>
   63.91 +            </and>
   63.92 +        </condition>
   63.93 +        <property name="javac.debug" value="true"/>
   63.94 +        <property name="javadoc.preview" value="true"/>
   63.95 +        <property name="application.args" value=""/>
   63.96 +    </target>
   63.97 +    <target name="-post-init">
   63.98 +        <!-- Empty placeholder for easier customization. -->
   63.99 +        <!-- You can override this target in the ../build.xml file. -->
  63.100 +    </target>
  63.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  63.102 +        <fail unless="src.dir">Must set src.dir</fail>
  63.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  63.104 +        <fail unless="build.dir">Must set build.dir</fail>
  63.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  63.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  63.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  63.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  63.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  63.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  63.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  63.112 +    </target>
  63.113 +    <target name="-init-macrodef-property">
  63.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  63.115 +            <attribute name="name"/>
  63.116 +            <attribute name="value"/>
  63.117 +            <sequential>
  63.118 +                <property name="@{name}" value="${@{value}}"/>
  63.119 +            </sequential>
  63.120 +        </macrodef>
  63.121 +    </target>
  63.122 +    <target name="-init-macrodef-javac">
  63.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  63.124 +            <attribute name="srcdir" default="${src.dir}"/>
  63.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  63.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  63.127 +            <attribute name="debug" default="${javac.debug}"/>
  63.128 +            <element name="customize" optional="true"/>
  63.129 +            <sequential>
  63.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  63.131 +                    <classpath>
  63.132 +                        <path path="@{classpath}"/>
  63.133 +                    </classpath>
  63.134 +                </depend>
  63.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  63.136 +                    <classpath>
  63.137 +                        <path path="@{classpath}"/>
  63.138 +                    </classpath>
  63.139 +                    <compilerarg line="${javac.compilerargs}"/>
  63.140 +                    <customize/>
  63.141 +                </javac>
  63.142 +            </sequential>
  63.143 +        </macrodef>
  63.144 +    </target>
  63.145 +    <target name="-init-macrodef-junit">
  63.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  63.147 +            <attribute name="includes" default="**/*Test.java"/>
  63.148 +            <sequential>
  63.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  63.150 +                    <batchtest todir="${build.test.results.dir}">
  63.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  63.152 +                    </batchtest>
  63.153 +                    <classpath>
  63.154 +                        <path path="${run.test.classpath}"/>
  63.155 +                    </classpath>
  63.156 +                    <syspropertyset>
  63.157 +                        <propertyref prefix="test-sys-prop."/>
  63.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  63.159 +                    </syspropertyset>
  63.160 +                    <formatter type="brief" usefile="false"/>
  63.161 +                    <formatter type="xml"/>
  63.162 +                    <jvmarg line="${run.jvmargs}"/>
  63.163 +                </junit>
  63.164 +            </sequential>
  63.165 +        </macrodef>
  63.166 +    </target>
  63.167 +    <target name="-init-macrodef-nbjpda">
  63.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  63.169 +            <attribute name="name" default="${main.class}"/>
  63.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  63.171 +            <attribute name="stopclassname" default=""/>
  63.172 +            <sequential>
  63.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  63.174 +                    <classpath>
  63.175 +                        <path path="@{classpath}"/>
  63.176 +                    </classpath>
  63.177 +                </nbjpdastart>
  63.178 +            </sequential>
  63.179 +        </macrodef>
  63.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  63.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  63.182 +            <sequential>
  63.183 +                <nbjpdareload>
  63.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  63.185 +                </nbjpdareload>
  63.186 +            </sequential>
  63.187 +        </macrodef>
  63.188 +    </target>
  63.189 +    <target name="-init-macrodef-debug">
  63.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  63.191 +            <attribute name="classname" default="${main.class}"/>
  63.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  63.193 +            <element name="customize" optional="true"/>
  63.194 +            <sequential>
  63.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  63.196 +                    <jvmarg value="-Xdebug"/>
  63.197 +                    <jvmarg value="-Xnoagent"/>
  63.198 +                    <jvmarg value="-Djava.compiler=none"/>
  63.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  63.200 +                    <jvmarg line="${run.jvmargs}"/>
  63.201 +                    <classpath>
  63.202 +                        <path path="@{classpath}"/>
  63.203 +                    </classpath>
  63.204 +                    <syspropertyset>
  63.205 +                        <propertyref prefix="run-sys-prop."/>
  63.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  63.207 +                    </syspropertyset>
  63.208 +                    <customize/>
  63.209 +                </java>
  63.210 +            </sequential>
  63.211 +        </macrodef>
  63.212 +    </target>
  63.213 +    <target name="-init-macrodef-java">
  63.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  63.215 +            <attribute name="classname" default="${main.class}"/>
  63.216 +            <element name="customize" optional="true"/>
  63.217 +            <sequential>
  63.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  63.219 +                    <jvmarg line="${run.jvmargs}"/>
  63.220 +                    <classpath>
  63.221 +                        <path path="${run.classpath}"/>
  63.222 +                    </classpath>
  63.223 +                    <syspropertyset>
  63.224 +                        <propertyref prefix="run-sys-prop."/>
  63.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  63.226 +                    </syspropertyset>
  63.227 +                    <customize/>
  63.228 +                </java>
  63.229 +            </sequential>
  63.230 +        </macrodef>
  63.231 +    </target>
  63.232 +    <target name="-init-presetdef-jar">
  63.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  63.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  63.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  63.236 +            </jar>
  63.237 +        </presetdef>
  63.238 +    </target>
  63.239 +    <target name="init" 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"/>
  63.240 +    <!--
  63.241 +    ===================
  63.242 +    COMPILATION SECTION
  63.243 +    ===================
  63.244 +    -->
  63.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  63.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  63.247 +        <mkdir dir="${build.classes.dir}"/>
  63.248 +    </target>
  63.249 +    <target name="-pre-compile">
  63.250 +        <!-- Empty placeholder for easier customization. -->
  63.251 +        <!-- You can override this target in the ../build.xml file. -->
  63.252 +    </target>
  63.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  63.254 +        <j2seproject3:javac/>
  63.255 +        <copy todir="${build.classes.dir}">
  63.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  63.257 +        </copy>
  63.258 +    </target>
  63.259 +    <target name="-post-compile">
  63.260 +        <!-- Empty placeholder for easier customization. -->
  63.261 +        <!-- You can override this target in the ../build.xml file. -->
  63.262 +    </target>
  63.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  63.264 +    <target name="-pre-compile-single">
  63.265 +        <!-- Empty placeholder for easier customization. -->
  63.266 +        <!-- You can override this target in the ../build.xml file. -->
  63.267 +    </target>
  63.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  63.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  63.270 +        <j2seproject3:javac>
  63.271 +            <customize>
  63.272 +                <patternset includes="${javac.includes}"/>
  63.273 +            </customize>
  63.274 +        </j2seproject3:javac>
  63.275 +    </target>
  63.276 +    <target name="-post-compile-single">
  63.277 +        <!-- Empty placeholder for easier customization. -->
  63.278 +        <!-- You can override this target in the ../build.xml file. -->
  63.279 +    </target>
  63.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  63.281 +    <!--
  63.282 +    ====================
  63.283 +    JAR BUILDING SECTION
  63.284 +    ====================
  63.285 +    -->
  63.286 +    <target name="-pre-pre-jar" depends="init">
  63.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  63.288 +        <mkdir dir="${dist.jar.dir}"/>
  63.289 +    </target>
  63.290 +    <target name="-pre-jar">
  63.291 +        <!-- Empty placeholder for easier customization. -->
  63.292 +        <!-- You can override this target in the ../build.xml file. -->
  63.293 +    </target>
  63.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  63.295 +        <j2seproject1:jar/>
  63.296 +    </target>
  63.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  63.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  63.299 +    </target>
  63.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  63.301 +        <j2seproject1:jar manifest="${manifest.file}">
  63.302 +            <j2seproject1:manifest>
  63.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  63.304 +            </j2seproject1:manifest>
  63.305 +        </j2seproject1:jar>
  63.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  63.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  63.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  63.309 +        <pathconvert property="run.classpath.with.dist.jar">
  63.310 +            <path path="${run.classpath}"/>
  63.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  63.312 +        </pathconvert>
  63.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  63.314 +    </target>
  63.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  63.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  63.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  63.318 +            <path path="${run.classpath}"/>
  63.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  63.320 +        </pathconvert>
  63.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  63.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  63.323 +            <chainedmapper>
  63.324 +                <flattenmapper/>
  63.325 +                <globmapper from="*" to="lib/*"/>
  63.326 +            </chainedmapper>
  63.327 +        </pathconvert>
  63.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  63.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  63.330 +            <fileset dir="${build.classes.dir}"/>
  63.331 +            <manifest>
  63.332 +                <attribute name="Main-Class" value="${main.class}"/>
  63.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  63.334 +            </manifest>
  63.335 +        </copylibs>
  63.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  63.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  63.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  63.339 +    </target>
  63.340 +    <target name="-post-jar">
  63.341 +        <!-- Empty placeholder for easier customization. -->
  63.342 +        <!-- You can override this target in the ../build.xml file. -->
  63.343 +    </target>
  63.344 +    <target name="jar" 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."/>
  63.345 +    <!--
  63.346 +    =================
  63.347 +    EXECUTION SECTION
  63.348 +    =================
  63.349 +    -->
  63.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  63.351 +        <j2seproject1:java>
  63.352 +            <customize>
  63.353 +                <arg line="${application.args}"/>
  63.354 +            </customize>
  63.355 +        </j2seproject1:java>
  63.356 +    </target>
  63.357 +    <target name="run-single" depends="init,compile-single">
  63.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  63.359 +        <j2seproject1:java classname="${run.class}"/>
  63.360 +    </target>
  63.361 +    <!--
  63.362 +    =================
  63.363 +    DEBUGGING SECTION
  63.364 +    =================
  63.365 +    -->
  63.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  63.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  63.368 +    </target>
  63.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  63.370 +        <j2seproject3:debug>
  63.371 +            <customize>
  63.372 +                <arg line="${application.args}"/>
  63.373 +            </customize>
  63.374 +        </j2seproject3:debug>
  63.375 +    </target>
  63.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  63.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  63.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  63.379 +    </target>
  63.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  63.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  63.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  63.383 +        <j2seproject3:debug classname="${debug.class}"/>
  63.384 +    </target>
  63.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  63.386 +    <target name="-pre-debug-fix" depends="init">
  63.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  63.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  63.389 +    </target>
  63.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  63.391 +        <j2seproject1:nbjpdareload/>
  63.392 +    </target>
  63.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  63.394 +    <!--
  63.395 +    ===============
  63.396 +    JAVADOC SECTION
  63.397 +    ===============
  63.398 +    -->
  63.399 +    <target name="-javadoc-build" depends="init">
  63.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  63.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  63.402 +            <classpath>
  63.403 +                <path path="${javac.classpath}"/>
  63.404 +            </classpath>
  63.405 +            <sourcepath>
  63.406 +                <pathelement location="${src.dir}"/>
  63.407 +            </sourcepath>
  63.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  63.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  63.410 +        </javadoc>
  63.411 +    </target>
  63.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  63.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  63.414 +    </target>
  63.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  63.416 +    <!--
  63.417 +    =========================
  63.418 +    JUNIT COMPILATION SECTION
  63.419 +    =========================
  63.420 +    -->
  63.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  63.422 +        <mkdir dir="${build.test.classes.dir}"/>
  63.423 +    </target>
  63.424 +    <target name="-pre-compile-test">
  63.425 +        <!-- Empty placeholder for easier customization. -->
  63.426 +        <!-- You can override this target in the ../build.xml file. -->
  63.427 +    </target>
  63.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  63.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  63.430 +        <copy todir="${build.test.classes.dir}">
  63.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  63.432 +        </copy>
  63.433 +    </target>
  63.434 +    <target name="-post-compile-test">
  63.435 +        <!-- Empty placeholder for easier customization. -->
  63.436 +        <!-- You can override this target in the ../build.xml file. -->
  63.437 +    </target>
  63.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  63.439 +    <target name="-pre-compile-test-single">
  63.440 +        <!-- Empty placeholder for easier customization. -->
  63.441 +        <!-- You can override this target in the ../build.xml file. -->
  63.442 +    </target>
  63.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  63.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  63.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  63.446 +            <customize>
  63.447 +                <patternset includes="${javac.includes}"/>
  63.448 +            </customize>
  63.449 +        </j2seproject3:javac>
  63.450 +        <copy todir="${build.test.classes.dir}">
  63.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  63.452 +        </copy>
  63.453 +    </target>
  63.454 +    <target name="-post-compile-test-single">
  63.455 +        <!-- Empty placeholder for easier customization. -->
  63.456 +        <!-- You can override this target in the ../build.xml file. -->
  63.457 +    </target>
  63.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  63.459 +    <!--
  63.460 +    =======================
  63.461 +    JUNIT EXECUTION SECTION
  63.462 +    =======================
  63.463 +    -->
  63.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  63.465 +        <mkdir dir="${build.test.results.dir}"/>
  63.466 +    </target>
  63.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  63.468 +        <j2seproject3:junit/>
  63.469 +    </target>
  63.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  63.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  63.472 +    </target>
  63.473 +    <target name="test-report" if="have.tests" depends="init"/>
  63.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  63.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  63.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  63.477 +        <mkdir dir="${build.test.results.dir}"/>
  63.478 +    </target>
  63.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  63.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  63.481 +        <j2seproject3:junit includes="${test.includes}"/>
  63.482 +    </target>
  63.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  63.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  63.485 +    </target>
  63.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  63.487 +    <!--
  63.488 +    =======================
  63.489 +    JUNIT DEBUGGING SECTION
  63.490 +    =======================
  63.491 +    -->
  63.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  63.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  63.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  63.495 +            <customize>
  63.496 +                <arg line="${test.class}"/>
  63.497 +            </customize>
  63.498 +        </j2seproject3:debug>
  63.499 +    </target>
  63.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  63.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  63.502 +    </target>
  63.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  63.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  63.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  63.506 +    </target>
  63.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  63.508 +    <!--
  63.509 +    =========================
  63.510 +    APPLET EXECUTION SECTION
  63.511 +    =========================
  63.512 +    -->
  63.513 +    <target name="run-applet" depends="init,compile-single">
  63.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  63.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  63.516 +            <customize>
  63.517 +                <arg value="${applet.url}"/>
  63.518 +            </customize>
  63.519 +        </j2seproject1:java>
  63.520 +    </target>
  63.521 +    <!--
  63.522 +    =========================
  63.523 +    APPLET DEBUGGING  SECTION
  63.524 +    =========================
  63.525 +    -->
  63.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  63.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  63.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  63.529 +            <customize>
  63.530 +                <arg value="${applet.url}"/>
  63.531 +            </customize>
  63.532 +        </j2seproject3:debug>
  63.533 +    </target>
  63.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  63.535 +    <!--
  63.536 +    ===============
  63.537 +    CLEANUP SECTION
  63.538 +    ===============
  63.539 +    -->
  63.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  63.541 +    <target name="-do-clean" depends="init">
  63.542 +        <delete dir="${build.dir}"/>
  63.543 +        <delete dir="${dist.dir}"/>
  63.544 +    </target>
  63.545 +    <target name="-post-clean">
  63.546 +        <!-- Empty placeholder for easier customization. -->
  63.547 +        <!-- You can override this target in the ../build.xml file. -->
  63.548 +    </target>
  63.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  63.550 +</project>
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/samples/apifest1/day1/subclassingsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    64.3 @@ -0,0 +1,8 @@
    64.4 +build.xml.data.CRC32=2ab820eb
    64.5 +build.xml.script.CRC32=58a52595
    64.6 +build.xml.stylesheet.CRC32=a12b3d02
    64.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    64.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    64.9 +nbproject/build-impl.xml.data.CRC32=0f6dc18a
   64.10 +nbproject/build-impl.xml.script.CRC32=079f4b62
   64.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/samples/apifest1/day1/subclassingsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    65.3 @@ -0,0 +1,54 @@
    65.4 +build.classes.dir=${build.dir}/classes
    65.5 +build.classes.excludes=**/*.java,**/*.form
    65.6 +# This directory is removed when the project is cleaned:
    65.7 +build.dir=build
    65.8 +build.generated.dir=${build.dir}/generated
    65.9 +# Only compile against the classpath explicitly listed here:
   65.10 +build.sysclasspath=ignore
   65.11 +build.test.classes.dir=${build.dir}/test/classes
   65.12 +build.test.results.dir=${build.dir}/test/results
   65.13 +debug.classpath=\
   65.14 +    ${run.classpath}
   65.15 +debug.test.classpath=\
   65.16 +    ${run.test.classpath}
   65.17 +# This directory is removed when the project is cleaned:
   65.18 +dist.dir=dist
   65.19 +dist.jar=${dist.dir}/boolcircuit.jar
   65.20 +dist.javadoc.dir=${dist.dir}/javadoc
   65.21 +jar.compress=false
   65.22 +javac.classpath=
   65.23 +# Space-separated list of extra javac options
   65.24 +javac.compilerargs=
   65.25 +javac.deprecation=false
   65.26 +javac.source=1.5
   65.27 +javac.target=1.5
   65.28 +javac.test.classpath=\
   65.29 +    ${javac.classpath}:\
   65.30 +    ${build.classes.dir}:\
   65.31 +    ${libs.junit.classpath}
   65.32 +javadoc.additionalparam=
   65.33 +javadoc.author=false
   65.34 +javadoc.encoding=
   65.35 +javadoc.noindex=false
   65.36 +javadoc.nonavbar=false
   65.37 +javadoc.notree=false
   65.38 +javadoc.private=false
   65.39 +javadoc.splitindex=true
   65.40 +javadoc.use=true
   65.41 +javadoc.version=false
   65.42 +javadoc.windowtitle=
   65.43 +meta.inf.dir=${src.dir}/META-INF
   65.44 +platform.active=default_platform
   65.45 +run.classpath=\
   65.46 +    ${javac.classpath}:\
   65.47 +    ${build.classes.dir}
   65.48 +# Space-separated list of JVM arguments used when running the project
   65.49 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   65.50 +# or test-sys-prop.name=value to set system properties for unit tests):
   65.51 +run.jvmargs=
   65.52 +run.test.classpath=\
   65.53 +    ${javac.test.classpath}:\
   65.54 +    ${build.test.classes.dir}
   65.55 +src.dir=src
   65.56 +test.src.dir=test
   65.57 +libs.junit.classpath=../../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/samples/apifest1/day1/subclassingsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    66.3 @@ -0,0 +1,16 @@
    66.4 +<?xml version="1.0" encoding="UTF-8"?>
    66.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    66.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    66.7 +    <configuration>
    66.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    66.9 +            <name>subclassingsolution</name>
   66.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   66.11 +            <source-roots>
   66.12 +                <root id="src.dir"/>
   66.13 +            </source-roots>
   66.14 +            <test-roots>
   66.15 +                <root id="test.src.dir"/>
   66.16 +            </test-roots>
   66.17 +        </data>
   66.18 +    </configuration>
   66.19 +</project>
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/samples/apifest1/day1/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    67.3 @@ -0,0 +1,70 @@
    67.4 +/*
    67.5 + * The contents of this file are subject to the terms of the Common Development
    67.6 + * and Distribution License (the License). You may not use this file except in
    67.7 + * compliance with the License.
    67.8 + *
    67.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   67.10 + * or http://www.netbeans.org/cddl.txt.
   67.11 + *
   67.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   67.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   67.14 + * If applicable, add the following below the CDDL Header, with the fields
   67.15 + * enclosed by brackets [] replaced by your own identifying information:
   67.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   67.17 + *
   67.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   67.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   67.20 + * Microsystems, Inc. All Rights Reserved.
   67.21 + */
   67.22 +
   67.23 +package org.netbeans.apifest.boolcircuit;
   67.24 +
   67.25 +
   67.26 +/** Usefull class for building your own circuits. 
   67.27 + * 
   67.28 + */
   67.29 +public abstract class Circuit extends Object {
   67.30 +    
   67.31 +    /** For your conveninece */   
   67.32 +    public static Circuit AND = new Circuit() {
   67.33 +
   67.34 +        @Override
   67.35 +        public boolean evaluate(boolean[] in) {
   67.36 +            if ( in.length != 2) {
   67.37 +                throw new IllegalArgumentException( "Should have two parameters");
   67.38 +            }
   67.39 +            return in[0] && in[1];
   67.40 +        }
   67.41 +        
   67.42 +    };
   67.43 +    
   67.44 +    public static Circuit OR = new Circuit() {
   67.45 +
   67.46 +        @Override
   67.47 +        public boolean evaluate(boolean[] in) {
   67.48 +            if ( in.length != 2) {
   67.49 +                throw new IllegalArgumentException( "Should have two parameters");
   67.50 +            }
   67.51 +            return in[0] || in[1];
   67.52 +        }
   67.53 +        
   67.54 +    };
   67.55 +    
   67.56 +    public static Circuit NOT = new Circuit() {
   67.57 +
   67.58 +        @Override
   67.59 +        public boolean evaluate(boolean[] in) {
   67.60 +            if ( in.length != 1) {
   67.61 +                throw new IllegalArgumentException( "Should have one parameter");
   67.62 +            }
   67.63 +            return !in[0];
   67.64 +        }
   67.65 +        
   67.66 +    };
   67.67 +    
   67.68 +        
   67.69 +    /** Feel free to implement and don't hesitate to throw IllegalArgumentEception 
   67.70 +     */
   67.71 +    public abstract boolean evaluate(boolean... in);
   67.72 +               
   67.73 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/samples/apifest1/day1/subclassingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    68.3 @@ -0,0 +1,136 @@
    68.4 +/*
    68.5 + * The contents of this file are subject to the terms of the Common Development
    68.6 + * and Distribution License (the License). You may not use this file except in
    68.7 + * compliance with the License.
    68.8 + *
    68.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   68.10 + * or http://www.netbeans.org/cddl.txt.
   68.11 + *
   68.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   68.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   68.14 + * If applicable, add the following below the CDDL Header, with the fields
   68.15 + * enclosed by brackets [] replaced by your own identifying information:
   68.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   68.17 + *
   68.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   68.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   68.20 + * Microsystems, Inc. All Rights Reserved.
   68.21 + */
   68.22 +
   68.23 +package org.netbeans.apifest.boolcircuit;
   68.24 +
   68.25 +import java.security.CodeSource;
   68.26 +import java.security.Permission;
   68.27 +import java.security.PermissionCollection;
   68.28 +import java.security.Policy;
   68.29 +import java.util.Collection;
   68.30 +import java.util.Collections;
   68.31 +import java.util.Enumeration;
   68.32 +import junit.framework.TestCase;
   68.33 +import junit.framework.*;
   68.34 +
   68.35 +import static org.netbeans.apifest.boolcircuit.Circuit.*;
   68.36 +
   68.37 +/** The initial quest for this APIFest is to create an API for boolean 
   68.38 + * circuits. Such API shall be able to compose a boolean circuit from
   68.39 + * basic elements and evaluate the result given initial values for 
   68.40 + * input variables.
   68.41 + * <p>
   68.42 + * The basic elements include:
   68.43 + * <ul>
   68.44 + *   <li>negation - has one input and one output and changes 0 on input to 
   68.45 + *          on output 1 and 1 to 0
   68.46 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   68.47 + *          inputs are 1, otherwise it is 0
   68.48 + *   <li>or - has two inputs and one output. The output is 1 always, except
   68.49 + *          in the case when both inputs are 0
   68.50 + * </ul>
   68.51 + *
   68.52 + * <p>
   68.53 + * The boolean circuit can be used to represent boolean formulas and compute
   68.54 + * the results for certain values of its inputs. The individual tasks described
   68.55 + * as tests bellow.
   68.56 + *
   68.57 + * <p>
   68.58 + * Links of interest:
   68.59 + * <ul>
   68.60 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   68.61 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   68.62 + * </ul>
   68.63 + */
   68.64 +public class CircuitTest extends TestCase {
   68.65 +    
   68.66 +    
   68.67 +    
   68.68 +    static {
   68.69 +        // your code shall run without any permissions
   68.70 +    }
   68.71 +    
   68.72 +    public CircuitTest(String testName) {
   68.73 +        super(testName);
   68.74 +    }
   68.75 +
   68.76 +    protected void setUp() throws Exception {
   68.77 +    }
   68.78 +
   68.79 +    protected void tearDown() throws Exception {
   68.80 +    }
   68.81 +    
   68.82 +    
   68.83 +    /** 
   68.84 +     * Create a circuit to evaluate x1 and x2 and then
   68.85 +     * verify that its result is false for input (false, true) and
   68.86 +     * it is true for input (true, true).
   68.87 +     */
   68.88 +    public void testX1andX2() {
   68.89 +                
   68.90 +        assertFalse( AND.evaluate( false, true ));
   68.91 +        assertTrue( AND.evaluate( true, true ));
   68.92 +    }
   68.93 +    
   68.94 +    /** 
   68.95 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   68.96 +     * verify that its result is false for input (false, true, false) and
   68.97 +     * it is true for input (false, false, true).
   68.98 +     */
   68.99 +    public void testX1andX2orX3() {
  68.100 +        
  68.101 +        Circuit c = new Circuit() {
  68.102 +
  68.103 +            @Override
  68.104 +            public boolean evaluate(boolean[] in) {
  68.105 +                if ( in.length != 3) {
  68.106 +                    throw new IllegalArgumentException( "Should have one parameter");
  68.107 +                }
  68.108 +                return OR.evaluate( AND.evaluate( in[0], in[1] ), in[2] );
  68.109 +            }
  68.110 +            
  68.111 +        };
  68.112 +        
  68.113 +        assertFalse( c.evaluate( false, true, false ) );
  68.114 +        assertTrue( c.evaluate(  false, false, true ) );
  68.115 +        
  68.116 +    }
  68.117 +    /** 
  68.118 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  68.119 +     * verify that its result is true for all values of x1.
  68.120 +     */
  68.121 +    public void testAlwaysTrue() {    
  68.122 +        
  68.123 +        Circuit c = new Circuit() {
  68.124 +
  68.125 +            @Override
  68.126 +            public boolean evaluate(boolean[] in) {
  68.127 +                if ( in.length != 1) {
  68.128 +                    throw new IllegalArgumentException( "Should have three parameters");
  68.129 +                }
  68.130 +                return OR.evaluate( in[0], NOT.evaluate( in[0] ) );
  68.131 +            }
  68.132 +            
  68.133 +        };
  68.134 +                
  68.135 +        assertTrue( c.evaluate( true ) );
  68.136 +        assertTrue( c.evaluate( false ) );
  68.137 +    }
  68.138 +    
  68.139 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/samples/apifest1/day1/welltestedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
    69.3 @@ -0,0 +1,69 @@
    69.4 +<?xml version="1.0" encoding="UTF-8"?>
    69.5 +<!-- You may freely edit this file. See commented blocks below for -->
    69.6 +<!-- some examples of how to customize the build. -->
    69.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    69.8 +<project name="welltestedsolution" default="default" basedir=".">
    69.9 +    <description>Builds, tests, and runs the project welltestedsolution.</description>
   69.10 +    <import file="nbproject/build-impl.xml"/>
   69.11 +    <!--
   69.12 +
   69.13 +    There exist several targets which are by default empty and which can be 
   69.14 +    used for execution of your tasks. These targets are usually executed 
   69.15 +    before and after some main targets. They are: 
   69.16 +
   69.17 +      -pre-init:                 called before initialization of project properties
   69.18 +      -post-init:                called after initialization of project properties
   69.19 +      -pre-compile:              called before javac compilation
   69.20 +      -post-compile:             called after javac compilation
   69.21 +      -pre-compile-single:       called before javac compilation of single file
   69.22 +      -post-compile-single:      called after javac compilation of single file
   69.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   69.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   69.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   69.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   69.27 +      -pre-jar:                  called before JAR building
   69.28 +      -post-jar:                 called after JAR building
   69.29 +      -post-clean:               called after cleaning build products
   69.30 +
   69.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   69.32 +
   69.33 +    Example of inserting an obfuscator after compilation could look like this:
   69.34 +
   69.35 +        <target name="-post-compile">
   69.36 +            <obfuscate>
   69.37 +                <fileset dir="${build.classes.dir}"/>
   69.38 +            </obfuscate>
   69.39 +        </target>
   69.40 +
   69.41 +    For list of available properties check the imported 
   69.42 +    nbproject/build-impl.xml file. 
   69.43 +
   69.44 +
   69.45 +    Another way to customize the build is by overriding existing main targets.
   69.46 +    The targets of interest are: 
   69.47 +
   69.48 +      -init-macrodef-javac:     defines macro for javac compilation
   69.49 +      -init-macrodef-junit:     defines macro for junit execution
   69.50 +      -init-macrodef-debug:     defines macro for class debugging
   69.51 +      -init-macrodef-java:      defines macro for class execution
   69.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   69.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   69.54 +      run:                      execution of project 
   69.55 +      -javadoc-build:           Javadoc generation
   69.56 +      test-report:              JUnit report generation
   69.57 +
   69.58 +    An example of overriding the target for project execution could look like this:
   69.59 +
   69.60 +        <target name="run" depends="welltestedsolution-impl.jar">
   69.61 +            <exec dir="bin" executable="launcher.exe">
   69.62 +                <arg file="${dist.jar}"/>
   69.63 +            </exec>
   69.64 +        </target>
   69.65 +
   69.66 +    Notice that the overridden target depends on the jar target and not only on 
   69.67 +    the compile target as the regular run target does. Again, for a list of available 
   69.68 +    properties which you can use, check the target you are overriding in the
   69.69 +    nbproject/build-impl.xml file. 
   69.70 +
   69.71 +    -->
   69.72 +</project>
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/samples/apifest1/day1/welltestedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    70.3 @@ -0,0 +1,547 @@
    70.4 +<?xml version="1.0" encoding="UTF-8"?>
    70.5 +<!--
    70.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    70.7 +***         EDIT ../build.xml INSTEAD         ***
    70.8 +
    70.9 +For the purpose of easier reading the script
   70.10 +is divided into following sections:
   70.11 +
   70.12 +  - initialization
   70.13 +  - compilation
   70.14 +  - jar
   70.15 +  - execution
   70.16 +  - debugging
   70.17 +  - javadoc
   70.18 +  - junit compilation
   70.19 +  - junit execution
   70.20 +  - junit debugging
   70.21 +  - applet
   70.22 +  - cleanup
   70.23 +
   70.24 +-->
   70.25 +<project name="welltestedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   70.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   70.27 +    <!-- 
   70.28 +    ======================
   70.29 +    INITIALIZATION SECTION 
   70.30 +    ======================
   70.31 +    -->
   70.32 +    <target name="-pre-init">
   70.33 +        <!-- Empty placeholder for easier customization. -->
   70.34 +        <!-- You can override this target in the ../build.xml file. -->
   70.35 +    </target>
   70.36 +    <target name="-init-private" depends="-pre-init">
   70.37 +        <property file="nbproject/private/private.properties"/>
   70.38 +    </target>
   70.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   70.40 +        <property file="${user.properties.file}"/>
   70.41 +        <!-- The two properties below are usually overridden -->
   70.42 +        <!-- by the active platform. Just a fallback. -->
   70.43 +        <property name="default.javac.source" value="1.4"/>
   70.44 +        <property name="default.javac.target" value="1.4"/>
   70.45 +    </target>
   70.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   70.47 +        <property file="nbproject/project.properties"/>
   70.48 +    </target>
   70.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   70.50 +        <available file="${manifest.file}" property="manifest.available"/>
   70.51 +        <condition property="manifest.available+main.class">
   70.52 +            <and>
   70.53 +                <isset property="manifest.available"/>
   70.54 +                <isset property="main.class"/>
   70.55 +                <not>
   70.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   70.57 +                </not>
   70.58 +            </and>
   70.59 +        </condition>
   70.60 +        <condition property="manifest.available+main.class+mkdist.available">
   70.61 +            <and>
   70.62 +                <istrue value="${manifest.available+main.class}"/>
   70.63 +                <isset property="libs.CopyLibs.classpath"/>
   70.64 +            </and>
   70.65 +        </condition>
   70.66 +        <condition property="have.tests">
   70.67 +            <or>
   70.68 +                <available file="${test.src.dir}"/>
   70.69 +            </or>
   70.70 +        </condition>
   70.71 +        <condition property="have.sources">
   70.72 +            <or>
   70.73 +                <available file="${src.dir}"/>
   70.74 +            </or>
   70.75 +        </condition>
   70.76 +        <condition property="netbeans.home+have.tests">
   70.77 +            <and>
   70.78 +                <isset property="netbeans.home"/>
   70.79 +                <isset property="have.tests"/>
   70.80 +            </and>
   70.81 +        </condition>
   70.82 +        <condition property="no.javadoc.preview">
   70.83 +            <isfalse value="${javadoc.preview}"/>
   70.84 +        </condition>
   70.85 +        <property name="run.jvmargs" value=""/>
   70.86 +        <property name="javac.compilerargs" value=""/>
   70.87 +        <property name="work.dir" value="${basedir}"/>
   70.88 +        <condition property="no.deps">
   70.89 +            <and>
   70.90 +                <istrue value="${no.dependencies}"/>
   70.91 +            </and>
   70.92 +        </condition>
   70.93 +        <property name="javac.debug" value="true"/>
   70.94 +        <property name="javadoc.preview" value="true"/>
   70.95 +        <property name="application.args" value=""/>
   70.96 +    </target>
   70.97 +    <target name="-post-init">
   70.98 +        <!-- Empty placeholder for easier customization. -->
   70.99 +        <!-- You can override this target in the ../build.xml file. -->
  70.100 +    </target>
  70.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  70.102 +        <fail unless="src.dir">Must set src.dir</fail>
  70.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  70.104 +        <fail unless="build.dir">Must set build.dir</fail>
  70.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  70.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  70.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  70.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  70.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  70.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  70.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  70.112 +    </target>
  70.113 +    <target name="-init-macrodef-property">
  70.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  70.115 +            <attribute name="name"/>
  70.116 +            <attribute name="value"/>
  70.117 +            <sequential>
  70.118 +                <property name="@{name}" value="${@{value}}"/>
  70.119 +            </sequential>
  70.120 +        </macrodef>
  70.121 +    </target>
  70.122 +    <target name="-init-macrodef-javac">
  70.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  70.124 +            <attribute name="srcdir" default="${src.dir}"/>
  70.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  70.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  70.127 +            <attribute name="debug" default="${javac.debug}"/>
  70.128 +            <element name="customize" optional="true"/>
  70.129 +            <sequential>
  70.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  70.131 +                    <classpath>
  70.132 +                        <path path="@{classpath}"/>
  70.133 +                    </classpath>
  70.134 +                </depend>
  70.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  70.136 +                    <classpath>
  70.137 +                        <path path="@{classpath}"/>
  70.138 +                    </classpath>
  70.139 +                    <compilerarg line="${javac.compilerargs}"/>
  70.140 +                    <customize/>
  70.141 +                </javac>
  70.142 +            </sequential>
  70.143 +        </macrodef>
  70.144 +    </target>
  70.145 +    <target name="-init-macrodef-junit">
  70.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  70.147 +            <attribute name="includes" default="**/*Test.java"/>
  70.148 +            <sequential>
  70.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  70.150 +                    <batchtest todir="${build.test.results.dir}">
  70.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  70.152 +                    </batchtest>
  70.153 +                    <classpath>
  70.154 +                        <path path="${run.test.classpath}"/>
  70.155 +                    </classpath>
  70.156 +                    <syspropertyset>
  70.157 +                        <propertyref prefix="test-sys-prop."/>
  70.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  70.159 +                    </syspropertyset>
  70.160 +                    <formatter type="brief" usefile="false"/>
  70.161 +                    <formatter type="xml"/>
  70.162 +                    <jvmarg line="${run.jvmargs}"/>
  70.163 +                </junit>
  70.164 +            </sequential>
  70.165 +        </macrodef>
  70.166 +    </target>
  70.167 +    <target name="-init-macrodef-nbjpda">
  70.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  70.169 +            <attribute name="name" default="${main.class}"/>
  70.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  70.171 +            <attribute name="stopclassname" default=""/>
  70.172 +            <sequential>
  70.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  70.174 +                    <classpath>
  70.175 +                        <path path="@{classpath}"/>
  70.176 +                    </classpath>
  70.177 +                </nbjpdastart>
  70.178 +            </sequential>
  70.179 +        </macrodef>
  70.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  70.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  70.182 +            <sequential>
  70.183 +                <nbjpdareload>
  70.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  70.185 +                </nbjpdareload>
  70.186 +            </sequential>
  70.187 +        </macrodef>
  70.188 +    </target>
  70.189 +    <target name="-init-macrodef-debug">
  70.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  70.191 +            <attribute name="classname" default="${main.class}"/>
  70.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  70.193 +            <element name="customize" optional="true"/>
  70.194 +            <sequential>
  70.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  70.196 +                    <jvmarg value="-Xdebug"/>
  70.197 +                    <jvmarg value="-Xnoagent"/>
  70.198 +                    <jvmarg value="-Djava.compiler=none"/>
  70.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  70.200 +                    <jvmarg line="${run.jvmargs}"/>
  70.201 +                    <classpath>
  70.202 +                        <path path="@{classpath}"/>
  70.203 +                    </classpath>
  70.204 +                    <syspropertyset>
  70.205 +                        <propertyref prefix="run-sys-prop."/>
  70.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  70.207 +                    </syspropertyset>
  70.208 +                    <customize/>
  70.209 +                </java>
  70.210 +            </sequential>
  70.211 +        </macrodef>
  70.212 +    </target>
  70.213 +    <target name="-init-macrodef-java">
  70.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  70.215 +            <attribute name="classname" default="${main.class}"/>
  70.216 +            <element name="customize" optional="true"/>
  70.217 +            <sequential>
  70.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  70.219 +                    <jvmarg line="${run.jvmargs}"/>
  70.220 +                    <classpath>
  70.221 +                        <path path="${run.classpath}"/>
  70.222 +                    </classpath>
  70.223 +                    <syspropertyset>
  70.224 +                        <propertyref prefix="run-sys-prop."/>
  70.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  70.226 +                    </syspropertyset>
  70.227 +                    <customize/>
  70.228 +                </java>
  70.229 +            </sequential>
  70.230 +        </macrodef>
  70.231 +    </target>
  70.232 +    <target name="-init-presetdef-jar">
  70.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  70.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  70.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  70.236 +            </jar>
  70.237 +        </presetdef>
  70.238 +    </target>
  70.239 +    <target name="init" 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"/>
  70.240 +    <!--
  70.241 +    ===================
  70.242 +    COMPILATION SECTION
  70.243 +    ===================
  70.244 +    -->
  70.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  70.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  70.247 +        <mkdir dir="${build.classes.dir}"/>
  70.248 +    </target>
  70.249 +    <target name="-pre-compile">
  70.250 +        <!-- Empty placeholder for easier customization. -->
  70.251 +        <!-- You can override this target in the ../build.xml file. -->
  70.252 +    </target>
  70.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  70.254 +        <j2seproject3:javac/>
  70.255 +        <copy todir="${build.classes.dir}">
  70.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  70.257 +        </copy>
  70.258 +    </target>
  70.259 +    <target name="-post-compile">
  70.260 +        <!-- Empty placeholder for easier customization. -->
  70.261 +        <!-- You can override this target in the ../build.xml file. -->
  70.262 +    </target>
  70.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  70.264 +    <target name="-pre-compile-single">
  70.265 +        <!-- Empty placeholder for easier customization. -->
  70.266 +        <!-- You can override this target in the ../build.xml file. -->
  70.267 +    </target>
  70.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  70.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  70.270 +        <j2seproject3:javac>
  70.271 +            <customize>
  70.272 +                <patternset includes="${javac.includes}"/>
  70.273 +            </customize>
  70.274 +        </j2seproject3:javac>
  70.275 +    </target>
  70.276 +    <target name="-post-compile-single">
  70.277 +        <!-- Empty placeholder for easier customization. -->
  70.278 +        <!-- You can override this target in the ../build.xml file. -->
  70.279 +    </target>
  70.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  70.281 +    <!--
  70.282 +    ====================
  70.283 +    JAR BUILDING SECTION
  70.284 +    ====================
  70.285 +    -->
  70.286 +    <target name="-pre-pre-jar" depends="init">
  70.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  70.288 +        <mkdir dir="${dist.jar.dir}"/>
  70.289 +    </target>
  70.290 +    <target name="-pre-jar">
  70.291 +        <!-- Empty placeholder for easier customization. -->
  70.292 +        <!-- You can override this target in the ../build.xml file. -->
  70.293 +    </target>
  70.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  70.295 +        <j2seproject1:jar/>
  70.296 +    </target>
  70.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  70.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  70.299 +    </target>
  70.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  70.301 +        <j2seproject1:jar manifest="${manifest.file}">
  70.302 +            <j2seproject1:manifest>
  70.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  70.304 +            </j2seproject1:manifest>
  70.305 +        </j2seproject1:jar>
  70.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  70.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  70.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  70.309 +        <pathconvert property="run.classpath.with.dist.jar">
  70.310 +            <path path="${run.classpath}"/>
  70.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  70.312 +        </pathconvert>
  70.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  70.314 +    </target>
  70.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  70.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  70.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  70.318 +            <path path="${run.classpath}"/>
  70.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  70.320 +        </pathconvert>
  70.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  70.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  70.323 +            <chainedmapper>
  70.324 +                <flattenmapper/>
  70.325 +                <globmapper from="*" to="lib/*"/>
  70.326 +            </chainedmapper>
  70.327 +        </pathconvert>
  70.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  70.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  70.330 +            <fileset dir="${build.classes.dir}"/>
  70.331 +            <manifest>
  70.332 +                <attribute name="Main-Class" value="${main.class}"/>
  70.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  70.334 +            </manifest>
  70.335 +        </copylibs>
  70.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  70.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  70.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  70.339 +    </target>
  70.340 +    <target name="-post-jar">
  70.341 +        <!-- Empty placeholder for easier customization. -->
  70.342 +        <!-- You can override this target in the ../build.xml file. -->
  70.343 +    </target>
  70.344 +    <target name="jar" 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."/>
  70.345 +    <!--
  70.346 +    =================
  70.347 +    EXECUTION SECTION
  70.348 +    =================
  70.349 +    -->
  70.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  70.351 +        <j2seproject1:java>
  70.352 +            <customize>
  70.353 +                <arg line="${application.args}"/>
  70.354 +            </customize>
  70.355 +        </j2seproject1:java>
  70.356 +    </target>
  70.357 +    <target name="run-single" depends="init,compile-single">
  70.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  70.359 +        <j2seproject1:java classname="${run.class}"/>
  70.360 +    </target>
  70.361 +    <!--
  70.362 +    =================
  70.363 +    DEBUGGING SECTION
  70.364 +    =================
  70.365 +    -->
  70.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  70.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  70.368 +    </target>
  70.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  70.370 +        <j2seproject3:debug>
  70.371 +            <customize>
  70.372 +                <arg line="${application.args}"/>
  70.373 +            </customize>
  70.374 +        </j2seproject3:debug>
  70.375 +    </target>
  70.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  70.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  70.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  70.379 +    </target>
  70.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  70.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  70.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  70.383 +        <j2seproject3:debug classname="${debug.class}"/>
  70.384 +    </target>
  70.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  70.386 +    <target name="-pre-debug-fix" depends="init">
  70.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  70.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  70.389 +    </target>
  70.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  70.391 +        <j2seproject1:nbjpdareload/>
  70.392 +    </target>
  70.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  70.394 +    <!--
  70.395 +    ===============
  70.396 +    JAVADOC SECTION
  70.397 +    ===============
  70.398 +    -->
  70.399 +    <target name="-javadoc-build" depends="init">
  70.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  70.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  70.402 +            <classpath>
  70.403 +                <path path="${javac.classpath}"/>
  70.404 +            </classpath>
  70.405 +            <sourcepath>
  70.406 +                <pathelement location="${src.dir}"/>
  70.407 +            </sourcepath>
  70.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  70.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  70.410 +        </javadoc>
  70.411 +    </target>
  70.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  70.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  70.414 +    </target>
  70.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  70.416 +    <!--
  70.417 +    =========================
  70.418 +    JUNIT COMPILATION SECTION
  70.419 +    =========================
  70.420 +    -->
  70.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  70.422 +        <mkdir dir="${build.test.classes.dir}"/>
  70.423 +    </target>
  70.424 +    <target name="-pre-compile-test">
  70.425 +        <!-- Empty placeholder for easier customization. -->
  70.426 +        <!-- You can override this target in the ../build.xml file. -->
  70.427 +    </target>
  70.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  70.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  70.430 +        <copy todir="${build.test.classes.dir}">
  70.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  70.432 +        </copy>
  70.433 +    </target>
  70.434 +    <target name="-post-compile-test">
  70.435 +        <!-- Empty placeholder for easier customization. -->
  70.436 +        <!-- You can override this target in the ../build.xml file. -->
  70.437 +    </target>
  70.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  70.439 +    <target name="-pre-compile-test-single">
  70.440 +        <!-- Empty placeholder for easier customization. -->
  70.441 +        <!-- You can override this target in the ../build.xml file. -->
  70.442 +    </target>
  70.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  70.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  70.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  70.446 +            <customize>
  70.447 +                <patternset includes="${javac.includes}"/>
  70.448 +            </customize>
  70.449 +        </j2seproject3:javac>
  70.450 +        <copy todir="${build.test.classes.dir}">
  70.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  70.452 +        </copy>
  70.453 +    </target>
  70.454 +    <target name="-post-compile-test-single">
  70.455 +        <!-- Empty placeholder for easier customization. -->
  70.456 +        <!-- You can override this target in the ../build.xml file. -->
  70.457 +    </target>
  70.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  70.459 +    <!--
  70.460 +    =======================
  70.461 +    JUNIT EXECUTION SECTION
  70.462 +    =======================
  70.463 +    -->
  70.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  70.465 +        <mkdir dir="${build.test.results.dir}"/>
  70.466 +    </target>
  70.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  70.468 +        <j2seproject3:junit/>
  70.469 +    </target>
  70.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  70.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  70.472 +    </target>
  70.473 +    <target name="test-report" if="have.tests" depends="init"/>
  70.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  70.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  70.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  70.477 +        <mkdir dir="${build.test.results.dir}"/>
  70.478 +    </target>
  70.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  70.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  70.481 +        <j2seproject3:junit includes="${test.includes}"/>
  70.482 +    </target>
  70.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  70.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  70.485 +    </target>
  70.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  70.487 +    <!--
  70.488 +    =======================
  70.489 +    JUNIT DEBUGGING SECTION
  70.490 +    =======================
  70.491 +    -->
  70.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  70.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  70.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  70.495 +            <customize>
  70.496 +                <arg line="${test.class}"/>
  70.497 +            </customize>
  70.498 +        </j2seproject3:debug>
  70.499 +    </target>
  70.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  70.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  70.502 +    </target>
  70.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  70.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  70.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  70.506 +    </target>
  70.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  70.508 +    <!--
  70.509 +    =========================
  70.510 +    APPLET EXECUTION SECTION
  70.511 +    =========================
  70.512 +    -->
  70.513 +    <target name="run-applet" depends="init,compile-single">
  70.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  70.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  70.516 +            <customize>
  70.517 +                <arg value="${applet.url}"/>
  70.518 +            </customize>
  70.519 +        </j2seproject1:java>
  70.520 +    </target>
  70.521 +    <!--
  70.522 +    =========================
  70.523 +    APPLET DEBUGGING  SECTION
  70.524 +    =========================
  70.525 +    -->
  70.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  70.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  70.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  70.529 +            <customize>
  70.530 +                <arg value="${applet.url}"/>
  70.531 +            </customize>
  70.532 +        </j2seproject3:debug>
  70.533 +    </target>
  70.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  70.535 +    <!--
  70.536 +    ===============
  70.537 +    CLEANUP SECTION
  70.538 +    ===============
  70.539 +    -->
  70.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  70.541 +    <target name="-do-clean" depends="init">
  70.542 +        <delete dir="${build.dir}"/>
  70.543 +        <delete dir="${dist.dir}"/>
  70.544 +    </target>
  70.545 +    <target name="-post-clean">
  70.546 +        <!-- Empty placeholder for easier customization. -->
  70.547 +        <!-- You can override this target in the ../build.xml file. -->
  70.548 +    </target>
  70.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  70.550 +</project>
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/samples/apifest1/day1/welltestedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    71.3 @@ -0,0 +1,8 @@
    71.4 +build.xml.data.CRC32=3022b908
    71.5 +build.xml.script.CRC32=fdb77cae
    71.6 +build.xml.stylesheet.CRC32=a12b3d02
    71.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    71.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    71.9 +nbproject/build-impl.xml.data.CRC32=3022b908
   71.10 +nbproject/build-impl.xml.script.CRC32=b9627854
   71.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/samples/apifest1/day1/welltestedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    72.3 @@ -0,0 +1,56 @@
    72.4 +build.classes.dir=${build.dir}/classes
    72.5 +build.classes.excludes=**/*.java,**/*.form
    72.6 +# This directory is removed when the project is cleaned:
    72.7 +build.dir=build
    72.8 +build.generated.dir=${build.dir}/generated
    72.9 +# Only compile against the classpath explicitly listed here:
   72.10 +build.sysclasspath=ignore
   72.11 +build.test.classes.dir=${build.dir}/test/classes
   72.12 +build.test.results.dir=${build.dir}/test/results
   72.13 +debug.classpath=\
   72.14 +    ${run.classpath}
   72.15 +debug.test.classpath=\
   72.16 +    ${run.test.classpath}
   72.17 +# This directory is removed when the project is cleaned:
   72.18 +dist.dir=dist
   72.19 +dist.jar=${dist.dir}/boolcircuit.jar
   72.20 +dist.javadoc.dir=${dist.dir}/javadoc
   72.21 +jar.compress=false
   72.22 +javac.classpath=
   72.23 +# Space-separated list of extra javac options
   72.24 +javac.compilerargs=
   72.25 +javac.deprecation=false
   72.26 +javac.source=1.5
   72.27 +javac.target=1.5
   72.28 +javac.test.classpath=\
   72.29 +    ${javac.classpath}:\
   72.30 +    ${build.classes.dir}:\
   72.31 +    ${libs.junit.classpath}
   72.32 +javadoc.additionalparam=
   72.33 +javadoc.author=false
   72.34 +javadoc.encoding=
   72.35 +javadoc.noindex=false
   72.36 +javadoc.nonavbar=false
   72.37 +javadoc.notree=false
   72.38 +javadoc.private=false
   72.39 +javadoc.splitindex=true
   72.40 +javadoc.use=true
   72.41 +javadoc.version=false
   72.42 +javadoc.windowtitle=
   72.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   72.44 +# The library definition has always preference over this property.
   72.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   72.46 +meta.inf.dir=${src.dir}/META-INF
   72.47 +platform.active=default_platform
   72.48 +run.classpath=\
   72.49 +    ${javac.classpath}:\
   72.50 +    ${build.classes.dir}
   72.51 +# Space-separated list of JVM arguments used when running the project
   72.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   72.53 +# or test-sys-prop.name=value to set system properties for unit tests):
   72.54 +run.jvmargs=
   72.55 +run.test.classpath=\
   72.56 +    ${javac.test.classpath}:\
   72.57 +    ${build.test.classes.dir}
   72.58 +src.dir=src
   72.59 +test.src.dir=test
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/samples/apifest1/day1/welltestedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    73.3 @@ -0,0 +1,16 @@
    73.4 +<?xml version="1.0" encoding="UTF-8"?>
    73.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    73.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    73.7 +    <configuration>
    73.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    73.9 +            <name>welltestedsolution</name>
   73.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   73.11 +            <source-roots>
   73.12 +                <root id="src.dir"/>
   73.13 +            </source-roots>
   73.14 +            <test-roots>
   73.15 +                <root id="test.src.dir"/>
   73.16 +            </test-roots>
   73.17 +        </data>
   73.18 +    </configuration>
   73.19 +</project>
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/samples/apifest1/day1/welltestedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    74.3 @@ -0,0 +1,162 @@
    74.4 +/*
    74.5 + * The contents of this file are subject to the terms of the Common Development
    74.6 + * and Distribution License (the License). You may not use this file except in
    74.7 + * compliance with the License.
    74.8 + *
    74.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   74.10 + * or http://www.netbeans.org/cddl.txt.
   74.11 + *
   74.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   74.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   74.14 + * If applicable, add the following below the CDDL Header, with the fields
   74.15 + * enclosed by brackets [] replaced by your own identifying information:
   74.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   74.17 + *
   74.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   74.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   74.20 + * Microsystems, Inc. All Rights Reserved.
   74.21 + */
   74.22 +
   74.23 +package org.netbeans.apifest.boolcircuit;
   74.24 +
   74.25 +/**
   74.26 + */
   74.27 +public abstract class Circuit {
   74.28 +    
   74.29 +    public static Circuit createNotCircuit(Circuit in) {
   74.30 +        return new NotCircuit(in);
   74.31 +    }
   74.32 +    
   74.33 +    public static Circuit createOrCircuit(Circuit in1, Circuit in2) {
   74.34 +        return new OrCircuit(in1, in2);
   74.35 +    }
   74.36 +    
   74.37 +    public static Circuit createAndCircuit(Circuit in1, Circuit in2) {
   74.38 +        return new AndCircuit(in1, in2);
   74.39 +    }
   74.40 +    
   74.41 +    private Circuit() {
   74.42 +        
   74.43 +    }
   74.44 +    
   74.45 +    public abstract boolean evaluate(Boolean ... inputs);
   74.46 +    
   74.47 +    abstract int inputs();
   74.48 +    
   74.49 +    private static class NotCircuit extends Circuit {
   74.50 +
   74.51 +        private Circuit in;
   74.52 +        
   74.53 +        NotCircuit (Circuit in) {
   74.54 +            this.in = in;
   74.55 +        }
   74.56 +        
   74.57 +        int inputs() {
   74.58 +            return in == null? 1: in.inputs();
   74.59 +        }
   74.60 +        
   74.61 +        public boolean evaluate (Boolean ... inputs) {
   74.62 +            if (inputs == null || inputs.length != inputs()) { 
   74.63 +                throw new IllegalArgumentException();
   74.64 +            }
   74.65 +            Boolean o = inputs[0];
   74.66 +            if (in != null) { 
   74.67 +                return !in.evaluate(inputs);
   74.68 +            }
   74.69 +            else if (o != null) {
   74.70 +                return !o.booleanValue();
   74.71 +            }
   74.72 +            throw new IllegalArgumentException();
   74.73 +        }
   74.74 +    }
   74.75 +    
   74.76 +    private static class AndCircuit extends Circuit {
   74.77 +        private Circuit in1, in2;
   74.78 +        
   74.79 +        AndCircuit (Circuit in1, Circuit in2) {
   74.80 +            this.in1 = in1;
   74.81 +            this.in2 = in2;
   74.82 +        }
   74.83 +        
   74.84 +        int inputs() {
   74.85 +            return (in1 == null? 1: in1.inputs()) + (in2 == null? 1: in2.inputs()) ;
   74.86 +        }
   74.87 +        
   74.88 +        public boolean evaluate (Boolean ... inputs) {
   74.89 +            if (inputs == null || inputs.length != inputs()) { 
   74.90 +                throw new IllegalArgumentException();
   74.91 +            }
   74.92 +            boolean x1, x2;
   74.93 +            Boolean o1 = inputs[0];
   74.94 +            if (in1 != null) { 
   74.95 +                Boolean[] ins1 = new Boolean[in1.inputs()];
   74.96 +                System.arraycopy(inputs, 0, ins1, 0, in1.inputs());
   74.97 +                x1 = in1.evaluate(ins1);
   74.98 +            }
   74.99 +            else if (o1 != null) {
  74.100 +                x1 = o1.booleanValue();
  74.101 +            }
  74.102 +            else {
  74.103 +                throw new IllegalArgumentException();
  74.104 +            }
  74.105 +            Boolean o2 = inputs[in1 != null? in1.inputs(): 1];
  74.106 +            if (in2 != null) { 
  74.107 +                Boolean[] ins2 = new Boolean[in2.inputs()];
  74.108 +                System.arraycopy(inputs, in1 != null? in1.inputs(): 1, ins2, 0, in2.inputs());
  74.109 +                x2 = in2.evaluate(ins2);
  74.110 +            }
  74.111 +            else if (o2 != null) {
  74.112 +                x2 = o2.booleanValue();
  74.113 +            }
  74.114 +            else {
  74.115 +                throw new IllegalArgumentException();
  74.116 +            }
  74.117 +            return x1 && x2;
  74.118 +        }
  74.119 +    }
  74.120 +    
  74.121 +    private static class OrCircuit extends Circuit {
  74.122 +        private Circuit in1, in2;
  74.123 +        
  74.124 +        OrCircuit (Circuit in1, Circuit in2) {
  74.125 +            this.in1 = in1;
  74.126 +            this.in2 = in2;
  74.127 +        }
  74.128 +        
  74.129 +        int inputs() {
  74.130 +            return (in1 == null? 1: in1.inputs()) + (in2 == null? 1: in2.inputs()) ;
  74.131 +        }
  74.132 +        
  74.133 +        public boolean evaluate (Boolean ... inputs) {
  74.134 +            if (inputs == null || inputs.length != inputs()) { 
  74.135 +                throw new IllegalArgumentException();
  74.136 +            }
  74.137 +            boolean x1, x2;
  74.138 +            Boolean o1 = inputs[0];
  74.139 +            if (in1 != null) { 
  74.140 +                Boolean[] ins1 = new Boolean[in1.inputs()];
  74.141 +                System.arraycopy(inputs, 0, ins1, 0, in1.inputs());
  74.142 +                x1 = in1.evaluate(ins1);
  74.143 +            }
  74.144 +            else if (o1 != null) {
  74.145 +                x1 = o1.booleanValue();
  74.146 +            }
  74.147 +            else {
  74.148 +                throw new IllegalArgumentException();
  74.149 +            }
  74.150 +            Boolean o2 = inputs[in1 != null? in1.inputs(): 1];
  74.151 +            if (in2 != null) { 
  74.152 +                Boolean[] ins2 = new Boolean[in2.inputs()];
  74.153 +                System.arraycopy(inputs, in1 != null? in1.inputs(): 1, ins2, 0, in2.inputs());
  74.154 +                x2 = in2.evaluate(ins2);
  74.155 +            }
  74.156 +            else if (o2 != null) {
  74.157 +                x2 = o2.booleanValue();
  74.158 +            }
  74.159 +            else {
  74.160 +                throw new IllegalArgumentException();
  74.161 +            }
  74.162 +            return x1 || x2;
  74.163 +        }
  74.164 +    }
  74.165 +}
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/samples/apifest1/day1/welltestedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    75.3 @@ -0,0 +1,165 @@
    75.4 +/*
    75.5 + * The contents of this file are subject to the terms of the Common Development
    75.6 + * and Distribution License (the License). You may not use this file except in
    75.7 + * compliance with the License.
    75.8 + *
    75.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   75.10 + * or http://www.netbeans.org/cddl.txt.
   75.11 + *
   75.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   75.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   75.14 + * If applicable, add the following below the CDDL Header, with the fields
   75.15 + * enclosed by brackets [] replaced by your own identifying information:
   75.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   75.17 + *
   75.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   75.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   75.20 + * Microsystems, Inc. All Rights Reserved.
   75.21 + */
   75.22 +
   75.23 +package org.netbeans.apifest.boolcircuit;
   75.24 +
   75.25 +import java.security.CodeSource;
   75.26 +import java.security.Permission;
   75.27 +import java.security.PermissionCollection;
   75.28 +import java.security.Policy;
   75.29 +import java.util.Collection;
   75.30 +import java.util.Collections;
   75.31 +import java.util.Enumeration;
   75.32 +import junit.framework.TestCase;
   75.33 +import junit.framework.*;
   75.34 +
   75.35 +/** The initial quest for this APIFest is to create an API for boolean 
   75.36 + * circuits. Such API shall be able to compose a boolean circuit from
   75.37 + * basic elements and evaluate the result given initial values for 
   75.38 + * input variables.
   75.39 + * <p>
   75.40 + * The basic elements include:
   75.41 + * <ul>
   75.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   75.43 + *          on output 1 and 1 to 0
   75.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   75.45 + *          inputs are 1, otherwise it is 0
   75.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   75.47 + *          in the case when both inputs are 0
   75.48 + * </ul>
   75.49 + *
   75.50 + * <p>
   75.51 + * The boolean circuit can be used to represent boolean formulas and compute
   75.52 + * the results for certain values of its inputs. The individual tasks described
   75.53 + * as tests bellow.
   75.54 + *
   75.55 + * <p>
   75.56 + * Links of interest:
   75.57 + * <ul>
   75.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   75.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   75.60 + * </ul>
   75.61 + */
   75.62 +public class CircuitTest extends TestCase {
   75.63 +    static {
   75.64 +        // your code shall run without any permissions
   75.65 +    }
   75.66 +    
   75.67 +    public CircuitTest(String testName) {
   75.68 +        super(testName);
   75.69 +    }
   75.70 +
   75.71 +    protected void setUp() throws Exception {
   75.72 +    }
   75.73 +
   75.74 +    protected void tearDown() throws Exception {
   75.75 +    }
   75.76 +    
   75.77 +    
   75.78 +    /** 
   75.79 +     * Create a circuit to evaluate x1 and x2 and then
   75.80 +     * verify that its result is false for input (false, true) and
   75.81 +     * it is true for input (true, true).
   75.82 +     */
   75.83 +    public void testX1andX2() {
   75.84 +        assertFalse("x1 and x2 for (false, true)", Circuit.createAndCircuit(null, null).evaluate(false, true));
   75.85 +        assertTrue("x1 and x2 for (true, true)", Circuit.createAndCircuit(null, null).evaluate(true, true));
   75.86 +    }
   75.87 +    
   75.88 +    /** 
   75.89 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   75.90 +     * verify that its result is false for input (false, true, false) and
   75.91 +     * it is true for input (false, false, true).
   75.92 +     */
   75.93 +    public void testX1andX2orX3() {
   75.94 +        Circuit c = Circuit.createOrCircuit(Circuit.createAndCircuit(null, null), null);
   75.95 +        assertFalse("(x1 and x2) or x3", c.evaluate(false, true, false));
   75.96 +        assertTrue("(x1 and x2) or x3", c.evaluate(false, false, true));
   75.97 +        
   75.98 +        assertTrue("(x1 and x2) or x3", c.evaluate(true, true, true));
   75.99 +        assertFalse("(x1 and x2) or x3", c.evaluate(true, false, false));
  75.100 +    }
  75.101 +    /** 
  75.102 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  75.103 +     * verify that its result is true for all values of x1.
  75.104 +     */
  75.105 +    public void testAlwaysTrue() {
  75.106 +        Circuit c = Circuit.createOrCircuit(null, Circuit.createNotCircuit(null));
  75.107 +        assertTrue("(x1 or not(x1)) for false", c.evaluate(false, false));
  75.108 +        assertTrue("(x1 or not(x1)) for false", c.evaluate(true, true));
  75.109 +    }
  75.110 +    
  75.111 +    public void testOr() {
  75.112 +        Circuit c = Circuit.createOrCircuit(null, null);
  75.113 +        try {
  75.114 +            c.evaluate();
  75.115 +        } catch (IllegalArgumentException iae) { // expected
  75.116 +        }
  75.117 +        try {
  75.118 +            c.evaluate(true);
  75.119 +        } catch (IllegalArgumentException iae) { // expected
  75.120 +        }
  75.121 +        try {
  75.122 +            c.evaluate(true, true, true);
  75.123 +        } catch (IllegalArgumentException iae) { // expected
  75.124 +        }
  75.125 +        assertFalse("(x1 or x2)", c.evaluate(false, false));
  75.126 +        assertTrue("(x1 or x2)", c.evaluate(true, false));
  75.127 +        assertTrue("(x1 or x2)", c.evaluate(false, true));
  75.128 +        assertTrue("(x1 or x2)", c.evaluate(true, true));
  75.129 +        
  75.130 +    }
  75.131 +    
  75.132 +    public void testAnd() {
  75.133 +        Circuit c = Circuit.createAndCircuit(null, null);
  75.134 +        try {
  75.135 +            c.evaluate();
  75.136 +        } catch (IllegalArgumentException iae) { // expected
  75.137 +        }
  75.138 +        try {
  75.139 +            c.evaluate(true);
  75.140 +        } catch (IllegalArgumentException iae) { // expected
  75.141 +        }
  75.142 +        try {
  75.143 +            c.evaluate(true, true, true);
  75.144 +        } catch (IllegalArgumentException iae) { // expected
  75.145 +        }
  75.146 +        assertFalse("(x1 or x2)", c.evaluate(false, false));
  75.147 +        assertFalse("(x1 or x2)", c.evaluate(true, false));
  75.148 +        assertFalse("(x1 or x2)", c.evaluate(false, true));
  75.149 +        assertTrue("(x1 or x2)", c.evaluate(true, true));
  75.150 +        
  75.151 +    }
  75.152 +    
  75.153 +    public void testNot() {
  75.154 +        Circuit c = Circuit.createNotCircuit(null);
  75.155 +        try {
  75.156 +            c.evaluate();
  75.157 +        } catch (IllegalArgumentException iae) { // expected
  75.158 +        }
  75.159 +        try {
  75.160 +            c.evaluate(true, true);
  75.161 +        } catch (IllegalArgumentException iae) { // expected
  75.162 +        }
  75.163 +        assertFalse("(x1 or x2)", c.evaluate(true));
  75.164 +        assertTrue("(x1 or x2)", c.evaluate(false));
  75.165 +        
  75.166 +    }
  75.167 +    
  75.168 +}
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/build.xml	Sat Jun 14 09:52:45 2008 +0200
    76.3 @@ -0,0 +1,69 @@
    76.4 +<?xml version="1.0" encoding="UTF-8"?>
    76.5 +<!-- You may freely edit this file. See commented blocks below for -->
    76.6 +<!-- some examples of how to customize the build. -->
    76.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    76.8 +<project name="alwayscreatenewcircuit" default="default" basedir=".">
    76.9 +    <description>Builds, tests, and runs the project alwayscreatenewcircuit.</description>
   76.10 +    <import file="nbproject/build-impl.xml"/>
   76.11 +    <!--
   76.12 +
   76.13 +    There exist several targets which are by default empty and which can be 
   76.14 +    used for execution of your tasks. These targets are usually executed 
   76.15 +    before and after some main targets. They are: 
   76.16 +
   76.17 +      -pre-init:                 called before initialization of project properties
   76.18 +      -post-init:                called after initialization of project properties
   76.19 +      -pre-compile:              called before javac compilation
   76.20 +      -post-compile:             called after javac compilation
   76.21 +      -pre-compile-single:       called before javac compilation of single file
   76.22 +      -post-compile-single:      called after javac compilation of single file
   76.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   76.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   76.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   76.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   76.27 +      -pre-jar:                  called before JAR building
   76.28 +      -post-jar:                 called after JAR building
   76.29 +      -post-clean:               called after cleaning build products
   76.30 +
   76.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   76.32 +
   76.33 +    Example of inserting an obfuscator after compilation could look like this:
   76.34 +
   76.35 +        <target name="-post-compile">
   76.36 +            <obfuscate>
   76.37 +                <fileset dir="${build.classes.dir}"/>
   76.38 +            </obfuscate>
   76.39 +        </target>
   76.40 +
   76.41 +    For list of available properties check the imported 
   76.42 +    nbproject/build-impl.xml file. 
   76.43 +
   76.44 +
   76.45 +    Another way to customize the build is by overriding existing main targets.
   76.46 +    The targets of interest are: 
   76.47 +
   76.48 +      -init-macrodef-javac:     defines macro for javac compilation
   76.49 +      -init-macrodef-junit:     defines macro for junit execution
   76.50 +      -init-macrodef-debug:     defines macro for class debugging
   76.51 +      -init-macrodef-java:      defines macro for class execution
   76.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   76.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   76.54 +      run:                      execution of project 
   76.55 +      -javadoc-build:           Javadoc generation
   76.56 +      test-report:              JUnit report generation
   76.57 +
   76.58 +    An example of overriding the target for project execution could look like this:
   76.59 +
   76.60 +        <target name="run" depends="alwayscreatenewcircuit-impl.jar">
   76.61 +            <exec dir="bin" executable="launcher.exe">
   76.62 +                <arg file="${dist.jar}"/>
   76.63 +            </exec>
   76.64 +        </target>
   76.65 +
   76.66 +    Notice that the overridden target depends on the jar target and not only on 
   76.67 +    the compile target as the regular run target does. Again, for a list of available 
   76.68 +    properties which you can use, check the target you are overriding in the
   76.69 +    nbproject/build-impl.xml file. 
   76.70 +
   76.71 +    -->
   76.72 +</project>
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    77.3 @@ -0,0 +1,547 @@
    77.4 +<?xml version="1.0" encoding="UTF-8"?>
    77.5 +<!--
    77.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    77.7 +***         EDIT ../build.xml INSTEAD         ***
    77.8 +
    77.9 +For the purpose of easier reading the script
   77.10 +is divided into following sections:
   77.11 +
   77.12 +  - initialization
   77.13 +  - compilation
   77.14 +  - jar
   77.15 +  - execution
   77.16 +  - debugging
   77.17 +  - javadoc
   77.18 +  - junit compilation
   77.19 +  - junit execution
   77.20 +  - junit debugging
   77.21 +  - applet
   77.22 +  - cleanup
   77.23 +
   77.24 +-->
   77.25 +<project name="alwayscreatenewcircuit-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   77.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   77.27 +    <!-- 
   77.28 +    ======================
   77.29 +    INITIALIZATION SECTION 
   77.30 +    ======================
   77.31 +    -->
   77.32 +    <target name="-pre-init">
   77.33 +        <!-- Empty placeholder for easier customization. -->
   77.34 +        <!-- You can override this target in the ../build.xml file. -->
   77.35 +    </target>
   77.36 +    <target name="-init-private" depends="-pre-init">
   77.37 +        <property file="nbproject/private/private.properties"/>
   77.38 +    </target>
   77.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   77.40 +        <property file="${user.properties.file}"/>
   77.41 +        <!-- The two properties below are usually overridden -->
   77.42 +        <!-- by the active platform. Just a fallback. -->
   77.43 +        <property name="default.javac.source" value="1.4"/>
   77.44 +        <property name="default.javac.target" value="1.4"/>
   77.45 +    </target>
   77.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   77.47 +        <property file="nbproject/project.properties"/>
   77.48 +    </target>
   77.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   77.50 +        <available file="${manifest.file}" property="manifest.available"/>
   77.51 +        <condition property="manifest.available+main.class">
   77.52 +            <and>
   77.53 +                <isset property="manifest.available"/>
   77.54 +                <isset property="main.class"/>
   77.55 +                <not>
   77.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   77.57 +                </not>
   77.58 +            </and>
   77.59 +        </condition>
   77.60 +        <condition property="manifest.available+main.class+mkdist.available">
   77.61 +            <and>
   77.62 +                <istrue value="${manifest.available+main.class}"/>
   77.63 +                <isset property="libs.CopyLibs.classpath"/>
   77.64 +            </and>
   77.65 +        </condition>
   77.66 +        <condition property="have.tests">
   77.67 +            <or>
   77.68 +                <available file="${test.src.dir}"/>
   77.69 +            </or>
   77.70 +        </condition>
   77.71 +        <condition property="have.sources">
   77.72 +            <or>
   77.73 +                <available file="${src.dir}"/>
   77.74 +            </or>
   77.75 +        </condition>
   77.76 +        <condition property="netbeans.home+have.tests">
   77.77 +            <and>
   77.78 +                <isset property="netbeans.home"/>
   77.79 +                <isset property="have.tests"/>
   77.80 +            </and>
   77.81 +        </condition>
   77.82 +        <condition property="no.javadoc.preview">
   77.83 +            <isfalse value="${javadoc.preview}"/>
   77.84 +        </condition>
   77.85 +        <property name="run.jvmargs" value=""/>
   77.86 +        <property name="javac.compilerargs" value=""/>
   77.87 +        <property name="work.dir" value="${basedir}"/>
   77.88 +        <condition property="no.deps">
   77.89 +            <and>
   77.90 +                <istrue value="${no.dependencies}"/>
   77.91 +            </and>
   77.92 +        </condition>
   77.93 +        <property name="javac.debug" value="true"/>
   77.94 +        <property name="javadoc.preview" value="true"/>
   77.95 +        <property name="application.args" value=""/>
   77.96 +    </target>
   77.97 +    <target name="-post-init">
   77.98 +        <!-- Empty placeholder for easier customization. -->
   77.99 +        <!-- You can override this target in the ../build.xml file. -->
  77.100 +    </target>
  77.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  77.102 +        <fail unless="src.dir">Must set src.dir</fail>
  77.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  77.104 +        <fail unless="build.dir">Must set build.dir</fail>
  77.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  77.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  77.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  77.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  77.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  77.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  77.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  77.112 +    </target>
  77.113 +    <target name="-init-macrodef-property">
  77.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  77.115 +            <attribute name="name"/>
  77.116 +            <attribute name="value"/>
  77.117 +            <sequential>
  77.118 +                <property name="@{name}" value="${@{value}}"/>
  77.119 +            </sequential>
  77.120 +        </macrodef>
  77.121 +    </target>
  77.122 +    <target name="-init-macrodef-javac">
  77.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  77.124 +            <attribute name="srcdir" default="${src.dir}"/>
  77.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  77.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  77.127 +            <attribute name="debug" default="${javac.debug}"/>
  77.128 +            <element name="customize" optional="true"/>
  77.129 +            <sequential>
  77.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  77.131 +                    <classpath>
  77.132 +                        <path path="@{classpath}"/>
  77.133 +                    </classpath>
  77.134 +                </depend>
  77.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  77.136 +                    <classpath>
  77.137 +                        <path path="@{classpath}"/>
  77.138 +                    </classpath>
  77.139 +                    <compilerarg line="${javac.compilerargs}"/>
  77.140 +                    <customize/>
  77.141 +                </javac>
  77.142 +            </sequential>
  77.143 +        </macrodef>
  77.144 +    </target>
  77.145 +    <target name="-init-macrodef-junit">
  77.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  77.147 +            <attribute name="includes" default="**/*Test.java"/>
  77.148 +            <sequential>
  77.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  77.150 +                    <batchtest todir="${build.test.results.dir}">
  77.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  77.152 +                    </batchtest>
  77.153 +                    <classpath>
  77.154 +                        <path path="${run.test.classpath}"/>
  77.155 +                    </classpath>
  77.156 +                    <syspropertyset>
  77.157 +                        <propertyref prefix="test-sys-prop."/>
  77.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  77.159 +                    </syspropertyset>
  77.160 +                    <formatter type="brief" usefile="false"/>
  77.161 +                    <formatter type="xml"/>
  77.162 +                    <jvmarg line="${run.jvmargs}"/>
  77.163 +                </junit>
  77.164 +            </sequential>
  77.165 +        </macrodef>
  77.166 +    </target>
  77.167 +    <target name="-init-macrodef-nbjpda">
  77.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  77.169 +            <attribute name="name" default="${main.class}"/>
  77.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  77.171 +            <attribute name="stopclassname" default=""/>
  77.172 +            <sequential>
  77.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  77.174 +                    <classpath>
  77.175 +                        <path path="@{classpath}"/>
  77.176 +                    </classpath>
  77.177 +                </nbjpdastart>
  77.178 +            </sequential>
  77.179 +        </macrodef>
  77.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  77.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  77.182 +            <sequential>
  77.183 +                <nbjpdareload>
  77.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  77.185 +                </nbjpdareload>
  77.186 +            </sequential>
  77.187 +        </macrodef>
  77.188 +    </target>
  77.189 +    <target name="-init-macrodef-debug">
  77.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  77.191 +            <attribute name="classname" default="${main.class}"/>
  77.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  77.193 +            <element name="customize" optional="true"/>
  77.194 +            <sequential>
  77.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  77.196 +                    <jvmarg value="-Xdebug"/>
  77.197 +                    <jvmarg value="-Xnoagent"/>
  77.198 +                    <jvmarg value="-Djava.compiler=none"/>
  77.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  77.200 +                    <jvmarg line="${run.jvmargs}"/>
  77.201 +                    <classpath>
  77.202 +                        <path path="@{classpath}"/>
  77.203 +                    </classpath>
  77.204 +                    <syspropertyset>
  77.205 +                        <propertyref prefix="run-sys-prop."/>
  77.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  77.207 +                    </syspropertyset>
  77.208 +                    <customize/>
  77.209 +                </java>
  77.210 +            </sequential>
  77.211 +        </macrodef>
  77.212 +    </target>
  77.213 +    <target name="-init-macrodef-java">
  77.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  77.215 +            <attribute name="classname" default="${main.class}"/>
  77.216 +            <element name="customize" optional="true"/>
  77.217 +            <sequential>
  77.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  77.219 +                    <jvmarg line="${run.jvmargs}"/>
  77.220 +                    <classpath>
  77.221 +                        <path path="${run.classpath}"/>
  77.222 +                    </classpath>
  77.223 +                    <syspropertyset>
  77.224 +                        <propertyref prefix="run-sys-prop."/>
  77.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  77.226 +                    </syspropertyset>
  77.227 +                    <customize/>
  77.228 +                </java>
  77.229 +            </sequential>
  77.230 +        </macrodef>
  77.231 +    </target>
  77.232 +    <target name="-init-presetdef-jar">
  77.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  77.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  77.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  77.236 +            </jar>
  77.237 +        </presetdef>
  77.238 +    </target>
  77.239 +    <target name="init" 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"/>
  77.240 +    <!--
  77.241 +    ===================
  77.242 +    COMPILATION SECTION
  77.243 +    ===================
  77.244 +    -->
  77.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  77.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  77.247 +        <mkdir dir="${build.classes.dir}"/>
  77.248 +    </target>
  77.249 +    <target name="-pre-compile">
  77.250 +        <!-- Empty placeholder for easier customization. -->
  77.251 +        <!-- You can override this target in the ../build.xml file. -->
  77.252 +    </target>
  77.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  77.254 +        <j2seproject3:javac/>
  77.255 +        <copy todir="${build.classes.dir}">
  77.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  77.257 +        </copy>
  77.258 +    </target>
  77.259 +    <target name="-post-compile">
  77.260 +        <!-- Empty placeholder for easier customization. -->
  77.261 +        <!-- You can override this target in the ../build.xml file. -->
  77.262 +    </target>
  77.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  77.264 +    <target name="-pre-compile-single">
  77.265 +        <!-- Empty placeholder for easier customization. -->
  77.266 +        <!-- You can override this target in the ../build.xml file. -->
  77.267 +    </target>
  77.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  77.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  77.270 +        <j2seproject3:javac>
  77.271 +            <customize>
  77.272 +                <patternset includes="${javac.includes}"/>
  77.273 +            </customize>
  77.274 +        </j2seproject3:javac>
  77.275 +    </target>
  77.276 +    <target name="-post-compile-single">
  77.277 +        <!-- Empty placeholder for easier customization. -->
  77.278 +        <!-- You can override this target in the ../build.xml file. -->
  77.279 +    </target>
  77.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  77.281 +    <!--
  77.282 +    ====================
  77.283 +    JAR BUILDING SECTION
  77.284 +    ====================
  77.285 +    -->
  77.286 +    <target name="-pre-pre-jar" depends="init">
  77.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  77.288 +        <mkdir dir="${dist.jar.dir}"/>
  77.289 +    </target>
  77.290 +    <target name="-pre-jar">
  77.291 +        <!-- Empty placeholder for easier customization. -->
  77.292 +        <!-- You can override this target in the ../build.xml file. -->
  77.293 +    </target>
  77.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  77.295 +        <j2seproject1:jar/>
  77.296 +    </target>
  77.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  77.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  77.299 +    </target>
  77.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  77.301 +        <j2seproject1:jar manifest="${manifest.file}">
  77.302 +            <j2seproject1:manifest>
  77.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  77.304 +            </j2seproject1:manifest>
  77.305 +        </j2seproject1:jar>
  77.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  77.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  77.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  77.309 +        <pathconvert property="run.classpath.with.dist.jar">
  77.310 +            <path path="${run.classpath}"/>
  77.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  77.312 +        </pathconvert>
  77.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  77.314 +    </target>
  77.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  77.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  77.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  77.318 +            <path path="${run.classpath}"/>
  77.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  77.320 +        </pathconvert>
  77.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  77.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  77.323 +            <chainedmapper>
  77.324 +                <flattenmapper/>
  77.325 +                <globmapper from="*" to="lib/*"/>
  77.326 +            </chainedmapper>
  77.327 +        </pathconvert>
  77.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  77.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  77.330 +            <fileset dir="${build.classes.dir}"/>
  77.331 +            <manifest>
  77.332 +                <attribute name="Main-Class" value="${main.class}"/>
  77.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  77.334 +            </manifest>
  77.335 +        </copylibs>
  77.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  77.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  77.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  77.339 +    </target>
  77.340 +    <target name="-post-jar">
  77.341 +        <!-- Empty placeholder for easier customization. -->
  77.342 +        <!-- You can override this target in the ../build.xml file. -->
  77.343 +    </target>
  77.344 +    <target name="jar" 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."/>
  77.345 +    <!--
  77.346 +    =================
  77.347 +    EXECUTION SECTION
  77.348 +    =================
  77.349 +    -->
  77.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  77.351 +        <j2seproject1:java>
  77.352 +            <customize>
  77.353 +                <arg line="${application.args}"/>
  77.354 +            </customize>
  77.355 +        </j2seproject1:java>
  77.356 +    </target>
  77.357 +    <target name="run-single" depends="init,compile-single">
  77.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  77.359 +        <j2seproject1:java classname="${run.class}"/>
  77.360 +    </target>
  77.361 +    <!--
  77.362 +    =================
  77.363 +    DEBUGGING SECTION
  77.364 +    =================
  77.365 +    -->
  77.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  77.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  77.368 +    </target>
  77.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  77.370 +        <j2seproject3:debug>
  77.371 +            <customize>
  77.372 +                <arg line="${application.args}"/>
  77.373 +            </customize>
  77.374 +        </j2seproject3:debug>
  77.375 +    </target>
  77.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  77.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  77.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  77.379 +    </target>
  77.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  77.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  77.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  77.383 +        <j2seproject3:debug classname="${debug.class}"/>
  77.384 +    </target>
  77.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  77.386 +    <target name="-pre-debug-fix" depends="init">
  77.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  77.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  77.389 +    </target>
  77.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  77.391 +        <j2seproject1:nbjpdareload/>
  77.392 +    </target>
  77.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  77.394 +    <!--
  77.395 +    ===============
  77.396 +    JAVADOC SECTION
  77.397 +    ===============
  77.398 +    -->
  77.399 +    <target name="-javadoc-build" depends="init">
  77.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  77.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  77.402 +            <classpath>
  77.403 +                <path path="${javac.classpath}"/>
  77.404 +            </classpath>
  77.405 +            <sourcepath>
  77.406 +                <pathelement location="${src.dir}"/>
  77.407 +            </sourcepath>
  77.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  77.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  77.410 +        </javadoc>
  77.411 +    </target>
  77.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  77.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  77.414 +    </target>
  77.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  77.416 +    <!--
  77.417 +    =========================
  77.418 +    JUNIT COMPILATION SECTION
  77.419 +    =========================
  77.420 +    -->
  77.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  77.422 +        <mkdir dir="${build.test.classes.dir}"/>
  77.423 +    </target>
  77.424 +    <target name="-pre-compile-test">
  77.425 +        <!-- Empty placeholder for easier customization. -->
  77.426 +        <!-- You can override this target in the ../build.xml file. -->
  77.427 +    </target>
  77.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  77.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  77.430 +        <copy todir="${build.test.classes.dir}">
  77.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  77.432 +        </copy>
  77.433 +    </target>
  77.434 +    <target name="-post-compile-test">
  77.435 +        <!-- Empty placeholder for easier customization. -->
  77.436 +        <!-- You can override this target in the ../build.xml file. -->
  77.437 +    </target>
  77.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  77.439 +    <target name="-pre-compile-test-single">
  77.440 +        <!-- Empty placeholder for easier customization. -->
  77.441 +        <!-- You can override this target in the ../build.xml file. -->
  77.442 +    </target>
  77.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  77.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  77.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  77.446 +            <customize>
  77.447 +                <patternset includes="${javac.includes}"/>
  77.448 +            </customize>
  77.449 +        </j2seproject3:javac>
  77.450 +        <copy todir="${build.test.classes.dir}">
  77.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  77.452 +        </copy>
  77.453 +    </target>
  77.454 +    <target name="-post-compile-test-single">
  77.455 +        <!-- Empty placeholder for easier customization. -->
  77.456 +        <!-- You can override this target in the ../build.xml file. -->
  77.457 +    </target>
  77.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  77.459 +    <!--
  77.460 +    =======================
  77.461 +    JUNIT EXECUTION SECTION
  77.462 +    =======================
  77.463 +    -->
  77.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  77.465 +        <mkdir dir="${build.test.results.dir}"/>
  77.466 +    </target>
  77.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  77.468 +        <j2seproject3:junit/>
  77.469 +    </target>
  77.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  77.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  77.472 +    </target>
  77.473 +    <target name="test-report" if="have.tests" depends="init"/>
  77.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  77.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  77.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  77.477 +        <mkdir dir="${build.test.results.dir}"/>
  77.478 +    </target>
  77.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  77.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  77.481 +        <j2seproject3:junit includes="${test.includes}"/>
  77.482 +    </target>
  77.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  77.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  77.485 +    </target>
  77.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  77.487 +    <!--
  77.488 +    =======================
  77.489 +    JUNIT DEBUGGING SECTION
  77.490 +    =======================
  77.491 +    -->
  77.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  77.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  77.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  77.495 +            <customize>
  77.496 +                <arg line="${test.class}"/>
  77.497 +            </customize>
  77.498 +        </j2seproject3:debug>
  77.499 +    </target>
  77.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  77.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  77.502 +    </target>
  77.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  77.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  77.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  77.506 +    </target>
  77.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  77.508 +    <!--
  77.509 +    =========================
  77.510 +    APPLET EXECUTION SECTION
  77.511 +    =========================
  77.512 +    -->
  77.513 +    <target name="run-applet" depends="init,compile-single">
  77.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  77.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  77.516 +            <customize>
  77.517 +                <arg value="${applet.url}"/>
  77.518 +            </customize>
  77.519 +        </j2seproject1:java>
  77.520 +    </target>
  77.521 +    <!--
  77.522 +    =========================
  77.523 +    APPLET DEBUGGING  SECTION
  77.524 +    =========================
  77.525 +    -->
  77.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  77.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  77.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  77.529 +            <customize>
  77.530 +                <arg value="${applet.url}"/>
  77.531 +            </customize>
  77.532 +        </j2seproject3:debug>
  77.533 +    </target>
  77.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  77.535 +    <!--
  77.536 +    ===============
  77.537 +    CLEANUP SECTION
  77.538 +    ===============
  77.539 +    -->
  77.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  77.541 +    <target name="-do-clean" depends="init">
  77.542 +        <delete dir="${build.dir}"/>
  77.543 +        <delete dir="${dist.dir}"/>
  77.544 +    </target>
  77.545 +    <target name="-post-clean">
  77.546 +        <!-- Empty placeholder for easier customization. -->
  77.547 +        <!-- You can override this target in the ../build.xml file. -->
  77.548 +    </target>
  77.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  77.550 +</project>
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    78.3 @@ -0,0 +1,8 @@
    78.4 +build.xml.data.CRC32=ffd6778c
    78.5 +build.xml.script.CRC32=f0487089
    78.6 +build.xml.stylesheet.CRC32=a12b3d02
    78.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    78.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    78.9 +nbproject/build-impl.xml.data.CRC32=ffd6778c
   78.10 +nbproject/build-impl.xml.script.CRC32=20ec1204
   78.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    79.3 @@ -0,0 +1,56 @@
    79.4 +build.classes.dir=${build.dir}/classes
    79.5 +build.classes.excludes=**/*.java,**/*.form
    79.6 +# This directory is removed when the project is cleaned:
    79.7 +build.dir=build
    79.8 +build.generated.dir=${build.dir}/generated
    79.9 +# Only compile against the classpath explicitly listed here:
   79.10 +build.sysclasspath=ignore
   79.11 +build.test.classes.dir=${build.dir}/test/classes
   79.12 +build.test.results.dir=${build.dir}/test/results
   79.13 +debug.classpath=\
   79.14 +    ${run.classpath}
   79.15 +debug.test.classpath=\
   79.16 +    ${run.test.classpath}
   79.17 +# This directory is removed when the project is cleaned:
   79.18 +dist.dir=dist
   79.19 +dist.jar=${dist.dir}/boolcircuit.jar
   79.20 +dist.javadoc.dir=${dist.dir}/javadoc
   79.21 +jar.compress=false
   79.22 +javac.classpath=
   79.23 +# Space-separated list of extra javac options
   79.24 +javac.compilerargs=
   79.25 +javac.deprecation=false
   79.26 +javac.source=1.5
   79.27 +javac.target=1.5
   79.28 +javac.test.classpath=\
   79.29 +    ${javac.classpath}:\
   79.30 +    ${build.classes.dir}:\
   79.31 +    ${libs.junit.classpath}
   79.32 +javadoc.additionalparam=
   79.33 +javadoc.author=false
   79.34 +javadoc.encoding=
   79.35 +javadoc.noindex=false
   79.36 +javadoc.nonavbar=false
   79.37 +javadoc.notree=false
   79.38 +javadoc.private=false
   79.39 +javadoc.splitindex=true
   79.40 +javadoc.use=true
   79.41 +javadoc.version=false
   79.42 +javadoc.windowtitle=
   79.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   79.44 +# The library definition has always preference over this property.
   79.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   79.46 +meta.inf.dir=${src.dir}/META-INF
   79.47 +platform.active=default_platform
   79.48 +run.classpath=\
   79.49 +    ${javac.classpath}:\
   79.50 +    ${build.classes.dir}
   79.51 +# Space-separated list of JVM arguments used when running the project
   79.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   79.53 +# or test-sys-prop.name=value to set system properties for unit tests):
   79.54 +run.jvmargs=
   79.55 +run.test.classpath=\
   79.56 +    ${javac.test.classpath}:\
   79.57 +    ${build.test.classes.dir}
   79.58 +src.dir=src
   79.59 +test.src.dir=test
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    80.3 @@ -0,0 +1,16 @@
    80.4 +<?xml version="1.0" encoding="UTF-8"?>
    80.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    80.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    80.7 +    <configuration>
    80.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    80.9 +            <name>alwayscreatenewcircuit</name>
   80.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   80.11 +            <source-roots>
   80.12 +                <root id="src.dir"/>
   80.13 +            </source-roots>
   80.14 +            <test-roots>
   80.15 +                <root id="test.src.dir"/>
   80.16 +            </test-roots>
   80.17 +        </data>
   80.18 +    </configuration>
   80.19 +</project>
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    81.3 @@ -0,0 +1,234 @@
    81.4 +/*
    81.5 + * The contents of this file are subject to the terms of the Common Development
    81.6 + * and Distribution License (the License). You may not use this file except in
    81.7 + * compliance with the License.
    81.8 + *
    81.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   81.10 + * or http://www.netbeans.org/cddl.txt.
   81.11 + *
   81.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   81.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   81.14 + * If applicable, add the following below the CDDL Header, with the fields
   81.15 + * enclosed by brackets [] replaced by your own identifying information:
   81.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   81.17 + *
   81.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   81.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   81.20 + * Microsystems, Inc. All Rights Reserved.
   81.21 + */
   81.22 +
   81.23 +package org.netbeans.apifest.boolcircuit;
   81.24 +
   81.25 +import java.util.ArrayList;
   81.26 +import java.util.Arrays;
   81.27 +import java.util.LinkedHashSet;
   81.28 +
   81.29 +/**
   81.30 + */
   81.31 +public abstract class Circuit {
   81.32 +    /** Creates a new instance of Circuits */
   81.33 +    protected Circuit() {
   81.34 +    }
   81.35 +
   81.36 +    public static Circuit negate(Input input) {
   81.37 +        return new Negation(new Primitive(input));
   81.38 +    }
   81.39 +    
   81.40 +    @Deprecated
   81.41 +    public static Circuit negate(boolean input) {
   81.42 +        return new Negation(input);
   81.43 +    }
   81.44 +    
   81.45 +    public static Circuit negate(Circuit input) {
   81.46 +        return new Negation(input);
   81.47 +    }
   81.48 +
   81.49 +    public static Circuit and(Input input1, Input input2) {
   81.50 +        return new And(new Primitive(input1), new Primitive(input2));
   81.51 +    }
   81.52 +    
   81.53 +    @Deprecated
   81.54 +    public static Circuit and(boolean input1, boolean input2) {
   81.55 +        return new And(input1, input2);
   81.56 +    }
   81.57 +
   81.58 +    public static Circuit and(Circuit  input1, Input input2) {
   81.59 +        return new And(input1, new Primitive(input2));
   81.60 +    }
   81.61 +    
   81.62 +    @Deprecated
   81.63 +    public static Circuit and(Circuit  input1, boolean input2) {
   81.64 +        return new And(input1, new Primitive(input2));
   81.65 +    }
   81.66 +
   81.67 +    public static Circuit and(Input input1, Circuit input2) {
   81.68 +        return new And(new Primitive(input1), input2);
   81.69 +    }
   81.70 +    
   81.71 +    @Deprecated
   81.72 +    public static Circuit and(boolean input1, Circuit input2) {
   81.73 +        return new And(new Primitive(input1), input2);
   81.74 +    }
   81.75 +    
   81.76 +    public static Circuit and(Circuit input1, Circuit input2) {
   81.77 +        return new And(input1, input2);
   81.78 +    }
   81.79 +
   81.80 +    public static Circuit or(Input input1, Input input2) {
   81.81 +        return new Or(new Primitive(input1), new Primitive(input2));
   81.82 +    }
   81.83 +    
   81.84 +    @Deprecated
   81.85 +    public static Circuit or(boolean input1, boolean input2) {
   81.86 +        return new Or(input1, input2);
   81.87 +    }
   81.88 +
   81.89 +    public static Circuit or(Circuit input1, Input input2) {
   81.90 +        return new Or(input1, new Primitive(input2));
   81.91 +    }
   81.92 +    
   81.93 +    @Deprecated
   81.94 +    public static Circuit or(Circuit input1, boolean input2) {
   81.95 +        return new Or(input1, new Primitive(input2));
   81.96 +    }
   81.97 +
   81.98 +    public static Circuit or(Input input1, Circuit input2) {
   81.99 +        return new Or(new Primitive(input1), input2);
  81.100 +    }
  81.101 +    
  81.102 +    @Deprecated
  81.103 +    public static Circuit or(boolean input1, Circuit input2) {
  81.104 +        return new Or(new Primitive(input1), input2);
  81.105 +    }
  81.106 +    
  81.107 +    public static Circuit or(Circuit input1, Circuit input2) {
  81.108 +        return new Or(input1, input2);
  81.109 +    }
  81.110 +    
  81.111 +    
  81.112 +    public  final boolean output() {
  81.113 +        double v = value();
  81.114 +        if (v > 1 || v < 0) {
  81.115 +            throw new IllegalArgumentException();
  81.116 +        }
  81.117 +        return (v > 0) ? true : false;
  81.118 +    }
  81.119 +    
  81.120 +    private static final double check(double v) {
  81.121 +        if (v > 1 || v < 0) {
  81.122 +            throw new IllegalArgumentException();
  81.123 +        }
  81.124 +        return v;
  81.125 +    }
  81.126 +    
  81.127 +    
  81.128 +    public abstract double value();
  81.129 +    
  81.130 +    private final static class Primitive extends Circuit {
  81.131 +        private Input input;
  81.132 +
  81.133 +        Primitive(boolean input) {
  81.134 +            this.input = new Input(input);
  81.135 +        }
  81.136 +        
  81.137 +        Primitive(Input input) {
  81.138 +            this.input = input;
  81.139 +        }
  81.140 +        
  81.141 +        
  81.142 +
  81.143 +        public double value() {
  81.144 +            return input.getValue();
  81.145 +        }
  81.146 +    }
  81.147 +    
  81.148 +    private final static class Negation extends Circuit {
  81.149 +        private Circuit input;
  81.150 +        
  81.151 +        @Deprecated
  81.152 +        Negation(boolean input) {
  81.153 +            this.input = new Primitive(input);
  81.154 +        }
  81.155 +        
  81.156 +        Negation(Circuit input) {
  81.157 +            this.input = input;
  81.158 +        }
  81.159 +        
  81.160 +
  81.161 +        public double value() {
  81.162 +            double x = input.value();            
  81.163 +            return check(1-x);
  81.164 +        }
  81.165 +    }
  81.166 +    
  81.167 +    private static class And extends Circuit {
  81.168 +        Circuit input1;
  81.169 +        Circuit input2;
  81.170 +                
  81.171 +        And(boolean input1, boolean input2) {
  81.172 +            this.input1 = new Primitive(input1);
  81.173 +            this.input2 = new Primitive(input2);
  81.174 +        }
  81.175 +        
  81.176 +        And(Circuit input1, Circuit input2) {
  81.177 +            this.input1 = input1;
  81.178 +            this.input2 = input2;
  81.179 +        }
  81.180 +        
  81.181 +        public double value() {
  81.182 +            double x = input1.value();
  81.183 +            double y = input2.value();            
  81.184 +            return check(x * y);
  81.185 +        }
  81.186 +    }
  81.187 +    
  81.188 +    private final static class Or extends And {        
  81.189 +        Or(boolean input1, boolean input2) {
  81.190 +            super(input1, input2);
  81.191 +        }
  81.192 +        
  81.193 +        Or(Circuit input1, Circuit input2) {
  81.194 +            super(input1, input2);
  81.195 +        }
  81.196 +        
  81.197 +        public double value() {
  81.198 +            double x = input1.value();
  81.199 +            double y = input2.value();
  81.200 +            
  81.201 +            return check(1 - (1 - x) * (1 - y));
  81.202 +        }        
  81.203 +    }
  81.204 +    
  81.205 +    public static class Input {
  81.206 +        private double value;
  81.207 +        
  81.208 +        public static Input valueOf(boolean initValue) {
  81.209 +            return new Input(initValue);
  81.210 +        }       
  81.211 +
  81.212 +        public static Input valueOf(double initValue) {
  81.213 +            return new Input(initValue);
  81.214 +        }       
  81.215 +                        
  81.216 +        /** Creates a new instance of Input */        
  81.217 +        private Input(boolean input) {
  81.218 +            setValue(input);
  81.219 +        }
  81.220 +        
  81.221 +        private Input(double input) {
  81.222 +            setValue(input);
  81.223 +        }
  81.224 +        
  81.225 +        public double getValue() {
  81.226 +            return value;
  81.227 +        }
  81.228 +        
  81.229 +        public void setValue(double input) {
  81.230 +            value = input;
  81.231 +        }
  81.232 +        
  81.233 +        public void setValue(boolean input) {
  81.234 +            value = (input) ? 1 : 0;
  81.235 +        }        
  81.236 +    }    
  81.237 +}
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    82.3 @@ -0,0 +1,125 @@
    82.4 +/*
    82.5 + * The contents of this file are subject to the terms of the Common Development
    82.6 + * and Distribution License (the License). You may not use this file except in
    82.7 + * compliance with the License.
    82.8 + *
    82.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   82.10 + * or http://www.netbeans.org/cddl.txt.
   82.11 + *
   82.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   82.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   82.14 + * If applicable, add the following below the CDDL Header, with the fields
   82.15 + * enclosed by brackets [] replaced by your own identifying information:
   82.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   82.17 + *
   82.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   82.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   82.20 + * Microsystems, Inc. All Rights Reserved.
   82.21 + */
   82.22 +
   82.23 +package org.netbeans.apifest.boolcircuit;
   82.24 +
   82.25 +import java.security.CodeSource;
   82.26 +import java.security.Permission;
   82.27 +import java.security.PermissionCollection;
   82.28 +import java.security.Policy;
   82.29 +import java.util.Collection;
   82.30 +import java.util.Collections;
   82.31 +import java.util.Enumeration;
   82.32 +import junit.framework.TestCase;
   82.33 +import junit.framework.*;
   82.34 +
   82.35 +/** The initial quest for this APIFest is to create an API for boolean 
   82.36 + * circuits. Such API shall be able to compose a boolean circuit from
   82.37 + * basic elements and evaluate the result given initial values for 
   82.38 + * input variables.
   82.39 + * <p>
   82.40 + * The basic elements include:
   82.41 + * <ul>
   82.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   82.43 + *          on output 1 and 1 to 0
   82.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   82.45 + *          inputs are 1, otherwise it is 0
   82.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   82.47 + *          in the case when both inputs are 0
   82.48 + * </ul>
   82.49 + *
   82.50 + * <p>
   82.51 + * The boolean circuit can be used to represent boolean formulas and compute
   82.52 + * the results for certain values of its inputs. The individual tasks described
   82.53 + * as tests bellow.
   82.54 + *
   82.55 + * <p>
   82.56 + * Links of interest:
   82.57 + * <ul>
   82.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   82.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   82.60 + * </ul>
   82.61 + */
   82.62 +public class CircuitTest extends TestCase {
   82.63 +    static {
   82.64 +        // your code shall run without any permissions
   82.65 +    }
   82.66 +    
   82.67 +    public CircuitTest(String testName) {
   82.68 +        super(testName);
   82.69 +    }
   82.70 +
   82.71 +    protected void setUp() throws Exception {
   82.72 +    }
   82.73 +
   82.74 +    protected void tearDown() throws Exception {
   82.75 +    }
   82.76 +    
   82.77 +    
   82.78 +    /** 
   82.79 +     * Create a circuit to evaluate x1 and x2 and then
   82.80 +     * verify that its result is false for input (false, true) and
   82.81 +     * it is true for input (true, true).
   82.82 +     */
   82.83 +    public void testX1andX2() {
   82.84 +        boolean x1 = true;
   82.85 +        boolean x2 = true;
   82.86 +
   82.87 +        Circuit outputCircuit = Circuit.and(x1, x2);
   82.88 +        assertTrue(outputCircuit.output());
   82.89 +
   82.90 +        x1 = false;
   82.91 +        x2 = true;
   82.92 +        outputCircuit = Circuit.and(x1, x2);
   82.93 +        assertFalse(outputCircuit.output());
   82.94 +    }
   82.95 +    
   82.96 +    /** 
   82.97 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
   82.98 +     * verify that its result is false for input (false, true, false) and
   82.99 +     * it is true for input (false, false, true).
  82.100 +     */
  82.101 +    public void testX1andX2orX3() {
  82.102 +        boolean x1 = false;
  82.103 +        boolean x2 = true;
  82.104 +        boolean x3 = false;
  82.105 +        Circuit outputCircuit = Circuit.or(Circuit.and(x1,x2),x3);
  82.106 +        assertFalse(outputCircuit.output());
  82.107 +
  82.108 +        x1 = false;
  82.109 +        x2 = false;
  82.110 +        x3 = true;
  82.111 +        outputCircuit = Circuit.or(Circuit.and(x1,x2),x3);
  82.112 +        assertTrue(outputCircuit.output());
  82.113 +    }
  82.114 +    /** 
  82.115 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  82.116 +     * verify that its result is true for all values of x1.
  82.117 +     */
  82.118 +    public void testAlwaysTrue() {
  82.119 +        boolean x1 = true;
  82.120 +        Circuit outputCircuit = Circuit.or(x1,Circuit.negate(x1));
  82.121 +        assertTrue(outputCircuit.output());
  82.122 +
  82.123 +        x1 = false;
  82.124 +        outputCircuit = Circuit.or(x1,Circuit.negate(x1));
  82.125 +        assertTrue(outputCircuit.output());
  82.126 +    }
  82.127 +    
  82.128 +}
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/samples/apifest1/day2/alwayscreatenewcircuit/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
    83.3 @@ -0,0 +1,171 @@
    83.4 +/*
    83.5 + * The contents of this file are subject to the terms of the Common Development
    83.6 + * and Distribution License (the License). You may not use this file except in
    83.7 + * compliance with the License.
    83.8 + *
    83.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   83.10 + * or http://www.netbeans.org/cddl.txt.
   83.11 + *
   83.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   83.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   83.14 + * If applicable, add the following below the CDDL Header, with the fields
   83.15 + * enclosed by brackets [] replaced by your own identifying information:
   83.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   83.17 + *
   83.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   83.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   83.20 + * Microsystems, Inc. All Rights Reserved.
   83.21 + */
   83.22 +
   83.23 +package org.netbeans.apifest.boolcircuit;
   83.24 +
   83.25 +import java.security.CodeSource;
   83.26 +import java.security.Permission;
   83.27 +import java.security.PermissionCollection;
   83.28 +import java.security.Policy;
   83.29 +import java.util.Collection;
   83.30 +import java.util.Collections;
   83.31 +import java.util.Enumeration;
   83.32 +import junit.framework.TestCase;
   83.33 +import junit.framework.*;
   83.34 +
   83.35 +/** This file contains the APIFest quest for day 2. Simply, turn the 
   83.36 + * boolean circuit into circuit that can compute with double values from 0 to 1.
   83.37 + * <p>
   83.38 + * This means that where ever a boolean was used to represent input or 
   83.39 + * output values, one can now use any double number from >= 0 and <= 1.
   83.40 + * Still, to support backward compatibility, the operations with booleans
   83.41 + * has to be kept available and have to work. In fact False shall be 
   83.42 + * treated as 0 and True as 1.
   83.43 + * <p>
   83.44 + * The basic elements has to be modified to work on doubles in the following
   83.45 + * way:
   83.46 + * <ul>
   83.47 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
   83.48 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
   83.49 + *             and(false,true)=0*1=0=false
   83.50 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
   83.51 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
   83.52 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
   83.53 + * </ul>
   83.54 + * <p>
   83.55 + * However as the circuits with doubles are more rich than plain boolean circuits,
   83.56 + * there is additional requirement to allow any user of your API to write its 
   83.57 + * own "element" type. This is all going to be exercise in the tests bellow
   83.58 + * which you are supposed to implement.
   83.59 + */
   83.60 +public class RealTest extends TestCase {
   83.61 +    static {
   83.62 +        // your code shall run without any permissions
   83.63 +    }
   83.64 +    
   83.65 +    public RealTest(String testName) {
   83.66 +        super(testName);
   83.67 +    }
   83.68 +
   83.69 +    protected void setUp() throws Exception {
   83.70 +    }
   83.71 +
   83.72 +    protected void tearDown() throws Exception {
   83.73 +    }
   83.74 +    
   83.75 +    
   83.76 +    /** First of all create a circuit which will evaluate
   83.77 +     * expression (X1 and X2) or not(x1). Hold the circuit
   83.78 +     * in some variable.
   83.79 +     *
   83.80 +     * Feed this circuit with x1=true, x2=false, assert result is false
   83.81 +     *
   83.82 +     * Feed the same circuit with x1=false, x2=true, assert result is true
   83.83 +     *
   83.84 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
   83.85 +     *
   83.86 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
   83.87 +     *
   83.88 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
   83.89 +     */
   83.90 +    public void testX1andX2orNotX1() {
   83.91 +        Circuit.Input x1 = Circuit.Input.valueOf(true);
   83.92 +        Circuit.Input x2 = Circuit.Input.valueOf(false);
   83.93 +        Circuit c = Circuit.or(Circuit.and(x1,x2), Circuit.negate(x1));
   83.94 +        assertFalse(c.output());
   83.95 +        
   83.96 +        x1.setValue(false);
   83.97 +        x2.setValue(true);
   83.98 +        assertTrue(c.output());
   83.99 +        
  83.100 +        x1.setValue(0.0);
  83.101 +        x2.setValue(1.0);
  83.102 +        assertTrue(c.output());
  83.103 +
  83.104 +        x1.setValue(0.5);
  83.105 +        x2.setValue(0.5);
  83.106 +        assertEquals(0.625, c.value());
  83.107 +        
  83.108 +        try {
  83.109 +            x1.setValue(1.0);
  83.110 +            x2.setValue(2.0);
  83.111 +            c.value();
  83.112 +            fail();
  83.113 +        } catch(IllegalArgumentException iae) {
  83.114 +            
  83.115 +        }
  83.116 +    }
  83.117 +    
  83.118 +    /** Ensure that one variable cannot be filled with two different values.
  83.119 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
  83.120 +     * API that would not lead to x1 * x1 result, an exception is thrown.
  83.121 +     * For example if there was a way to feed the circuit with two different 
  83.122 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
  83.123 +     * improper use of the circuit.
  83.124 +     */
  83.125 +    public void testImproperUseOfTheCircuit() {
  83.126 +        assertTrue(true);
  83.127 +    }
  83.128 +    
  83.129 +    /** Write your own element type called "gte" that will have two inputs and one output.
  83.130 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
  83.131 +     * 
  83.132 +     * Create 
  83.133 +     * circuit for following expression: (x1 and not(x1)) gte x1
  83.134 +     *
  83.135 +     * Feed the circuit with 0.5 and verify the result is 0
  83.136 +     *
  83.137 +     * Feed the same circuit with 1 and verify the result is 0
  83.138 +     *
  83.139 +     * Feed the same circuit with 0 and verify the result is 1
  83.140 +     */
  83.141 +    public void testGreaterThanEqualElement() {
  83.142 +        class Comp extends Circuit {
  83.143 +            Circuit i1;  
  83.144 +            Circuit i2;
  83.145 +            Comp(Circuit i1,  Circuit i2) {
  83.146 +                this.i1 = i1;
  83.147 +                this.i2 = i2;
  83.148 +            }
  83.149 +            
  83.150 +            public double value() {
  83.151 +                double x1 = i1.value();
  83.152 +                double x2 = i2.value();
  83.153 +                return (x1 >= x2) ? 1 : 0;
  83.154 +            }                        
  83.155 +        }
  83.156 +        
  83.157 +        
  83.158 +        
  83.159 +        Circuit.Input x1 = Circuit.Input.valueOf(0.5);
  83.160 +        
  83.161 +        Circuit c1 = Circuit.and(x1, Circuit.negate(x1));
  83.162 +        Circuit c2 = Circuit.negate(Circuit.negate(x1));        
  83.163 +        
  83.164 +        Circuit comp =  new Comp(c1, c2);
  83.165 +        assertEquals(0.0, comp.value());
  83.166 +        
  83.167 +        x1.setValue(1);
  83.168 +        assertEquals(0.0, comp.value());
  83.169 +        
  83.170 +        x1.setValue(0);
  83.171 +        assertEquals(1.0, comp.value());
  83.172 +        
  83.173 +    }
  83.174 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/samples/apifest1/day2/elementbasedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
    84.3 @@ -0,0 +1,69 @@
    84.4 +<?xml version="1.0" encoding="UTF-8"?>
    84.5 +<!-- You may freely edit this file. See commented blocks below for -->
    84.6 +<!-- some examples of how to customize the build. -->
    84.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    84.8 +<project name="elementbasedsolution" default="default" basedir=".">
    84.9 +    <description>Builds, tests, and runs the project elementbasedsolution.</description>
   84.10 +    <import file="nbproject/build-impl.xml"/>
   84.11 +    <!--
   84.12 +
   84.13 +    There exist several targets which are by default empty and which can be 
   84.14 +    used for execution of your tasks. These targets are usually executed 
   84.15 +    before and after some main targets. They are: 
   84.16 +
   84.17 +      -pre-init:                 called before initialization of project properties
   84.18 +      -post-init:                called after initialization of project properties
   84.19 +      -pre-compile:              called before javac compilation
   84.20 +      -post-compile:             called after javac compilation
   84.21 +      -pre-compile-single:       called before javac compilation of single file
   84.22 +      -post-compile-single:      called after javac compilation of single file
   84.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   84.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   84.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   84.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   84.27 +      -pre-jar:                  called before JAR building
   84.28 +      -post-jar:                 called after JAR building
   84.29 +      -post-clean:               called after cleaning build products
   84.30 +
   84.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   84.32 +
   84.33 +    Example of inserting an obfuscator after compilation could look like this:
   84.34 +
   84.35 +        <target name="-post-compile">
   84.36 +            <obfuscate>
   84.37 +                <fileset dir="${build.classes.dir}"/>
   84.38 +            </obfuscate>
   84.39 +        </target>
   84.40 +
   84.41 +    For list of available properties check the imported 
   84.42 +    nbproject/build-impl.xml file. 
   84.43 +
   84.44 +
   84.45 +    Another way to customize the build is by overriding existing main targets.
   84.46 +    The targets of interest are: 
   84.47 +
   84.48 +      -init-macrodef-javac:     defines macro for javac compilation
   84.49 +      -init-macrodef-junit:     defines macro for junit execution
   84.50 +      -init-macrodef-debug:     defines macro for class debugging
   84.51 +      -init-macrodef-java:      defines macro for class execution
   84.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   84.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   84.54 +      run:                      execution of project 
   84.55 +      -javadoc-build:           Javadoc generation
   84.56 +      test-report:              JUnit report generation
   84.57 +
   84.58 +    An example of overriding the target for project execution could look like this:
   84.59 +
   84.60 +        <target name="run" depends="elementbasedsolution-impl.jar">
   84.61 +            <exec dir="bin" executable="launcher.exe">
   84.62 +                <arg file="${dist.jar}"/>
   84.63 +            </exec>
   84.64 +        </target>
   84.65 +
   84.66 +    Notice that the overridden target depends on the jar target and not only on 
   84.67 +    the compile target as the regular run target does. Again, for a list of available 
   84.68 +    properties which you can use, check the target you are overriding in the
   84.69 +    nbproject/build-impl.xml file. 
   84.70 +
   84.71 +    -->
   84.72 +</project>
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/samples/apifest1/day2/elementbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    85.3 @@ -0,0 +1,547 @@
    85.4 +<?xml version="1.0" encoding="UTF-8"?>
    85.5 +<!--
    85.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    85.7 +***         EDIT ../build.xml INSTEAD         ***
    85.8 +
    85.9 +For the purpose of easier reading the script
   85.10 +is divided into following sections:
   85.11 +
   85.12 +  - initialization
   85.13 +  - compilation
   85.14 +  - jar
   85.15 +  - execution
   85.16 +  - debugging
   85.17 +  - javadoc
   85.18 +  - junit compilation
   85.19 +  - junit execution
   85.20 +  - junit debugging
   85.21 +  - applet
   85.22 +  - cleanup
   85.23 +
   85.24 +-->
   85.25 +<project name="elementbasedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   85.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   85.27 +    <!-- 
   85.28 +    ======================
   85.29 +    INITIALIZATION SECTION 
   85.30 +    ======================
   85.31 +    -->
   85.32 +    <target name="-pre-init">
   85.33 +        <!-- Empty placeholder for easier customization. -->
   85.34 +        <!-- You can override this target in the ../build.xml file. -->
   85.35 +    </target>
   85.36 +    <target name="-init-private" depends="-pre-init">
   85.37 +        <property file="nbproject/private/private.properties"/>
   85.38 +    </target>
   85.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   85.40 +        <property file="${user.properties.file}"/>
   85.41 +        <!-- The two properties below are usually overridden -->
   85.42 +        <!-- by the active platform. Just a fallback. -->
   85.43 +        <property name="default.javac.source" value="1.4"/>
   85.44 +        <property name="default.javac.target" value="1.4"/>
   85.45 +    </target>
   85.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   85.47 +        <property file="nbproject/project.properties"/>
   85.48 +    </target>
   85.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   85.50 +        <available file="${manifest.file}" property="manifest.available"/>
   85.51 +        <condition property="manifest.available+main.class">
   85.52 +            <and>
   85.53 +                <isset property="manifest.available"/>
   85.54 +                <isset property="main.class"/>
   85.55 +                <not>
   85.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   85.57 +                </not>
   85.58 +            </and>
   85.59 +        </condition>
   85.60 +        <condition property="manifest.available+main.class+mkdist.available">
   85.61 +            <and>
   85.62 +                <istrue value="${manifest.available+main.class}"/>
   85.63 +                <isset property="libs.CopyLibs.classpath"/>
   85.64 +            </and>
   85.65 +        </condition>
   85.66 +        <condition property="have.tests">
   85.67 +            <or>
   85.68 +                <available file="${test.src.dir}"/>
   85.69 +            </or>
   85.70 +        </condition>
   85.71 +        <condition property="have.sources">
   85.72 +            <or>
   85.73 +                <available file="${src.dir}"/>
   85.74 +            </or>
   85.75 +        </condition>
   85.76 +        <condition property="netbeans.home+have.tests">
   85.77 +            <and>
   85.78 +                <isset property="netbeans.home"/>
   85.79 +                <isset property="have.tests"/>
   85.80 +            </and>
   85.81 +        </condition>
   85.82 +        <condition property="no.javadoc.preview">
   85.83 +            <isfalse value="${javadoc.preview}"/>
   85.84 +        </condition>
   85.85 +        <property name="run.jvmargs" value=""/>
   85.86 +        <property name="javac.compilerargs" value=""/>
   85.87 +        <property name="work.dir" value="${basedir}"/>
   85.88 +        <condition property="no.deps">
   85.89 +            <and>
   85.90 +                <istrue value="${no.dependencies}"/>
   85.91 +            </and>
   85.92 +        </condition>
   85.93 +        <property name="javac.debug" value="true"/>
   85.94 +        <property name="javadoc.preview" value="true"/>
   85.95 +        <property name="application.args" value=""/>
   85.96 +    </target>
   85.97 +    <target name="-post-init">
   85.98 +        <!-- Empty placeholder for easier customization. -->
   85.99 +        <!-- You can override this target in the ../build.xml file. -->
  85.100 +    </target>
  85.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  85.102 +        <fail unless="src.dir">Must set src.dir</fail>
  85.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  85.104 +        <fail unless="build.dir">Must set build.dir</fail>
  85.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  85.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  85.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  85.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  85.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  85.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  85.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  85.112 +    </target>
  85.113 +    <target name="-init-macrodef-property">
  85.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  85.115 +            <attribute name="name"/>
  85.116 +            <attribute name="value"/>
  85.117 +            <sequential>
  85.118 +                <property name="@{name}" value="${@{value}}"/>
  85.119 +            </sequential>
  85.120 +        </macrodef>
  85.121 +    </target>
  85.122 +    <target name="-init-macrodef-javac">
  85.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  85.124 +            <attribute name="srcdir" default="${src.dir}"/>
  85.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  85.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  85.127 +            <attribute name="debug" default="${javac.debug}"/>
  85.128 +            <element name="customize" optional="true"/>
  85.129 +            <sequential>
  85.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  85.131 +                    <classpath>
  85.132 +                        <path path="@{classpath}"/>
  85.133 +                    </classpath>
  85.134 +                </depend>
  85.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  85.136 +                    <classpath>
  85.137 +                        <path path="@{classpath}"/>
  85.138 +                    </classpath>
  85.139 +                    <compilerarg line="${javac.compilerargs}"/>
  85.140 +                    <customize/>
  85.141 +                </javac>
  85.142 +            </sequential>
  85.143 +        </macrodef>
  85.144 +    </target>
  85.145 +    <target name="-init-macrodef-junit">
  85.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  85.147 +            <attribute name="includes" default="**/*Test.java"/>
  85.148 +            <sequential>
  85.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  85.150 +                    <batchtest todir="${build.test.results.dir}">
  85.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  85.152 +                    </batchtest>
  85.153 +                    <classpath>
  85.154 +                        <path path="${run.test.classpath}"/>
  85.155 +                    </classpath>
  85.156 +                    <syspropertyset>
  85.157 +                        <propertyref prefix="test-sys-prop."/>
  85.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  85.159 +                    </syspropertyset>
  85.160 +                    <formatter type="brief" usefile="false"/>
  85.161 +                    <formatter type="xml"/>
  85.162 +                    <jvmarg line="${run.jvmargs}"/>
  85.163 +                </junit>
  85.164 +            </sequential>
  85.165 +        </macrodef>
  85.166 +    </target>
  85.167 +    <target name="-init-macrodef-nbjpda">
  85.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  85.169 +            <attribute name="name" default="${main.class}"/>
  85.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  85.171 +            <attribute name="stopclassname" default=""/>
  85.172 +            <sequential>
  85.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  85.174 +                    <classpath>
  85.175 +                        <path path="@{classpath}"/>
  85.176 +                    </classpath>
  85.177 +                </nbjpdastart>
  85.178 +            </sequential>
  85.179 +        </macrodef>
  85.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  85.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  85.182 +            <sequential>
  85.183 +                <nbjpdareload>
  85.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  85.185 +                </nbjpdareload>
  85.186 +            </sequential>
  85.187 +        </macrodef>
  85.188 +    </target>
  85.189 +    <target name="-init-macrodef-debug">
  85.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  85.191 +            <attribute name="classname" default="${main.class}"/>
  85.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  85.193 +            <element name="customize" optional="true"/>
  85.194 +            <sequential>
  85.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  85.196 +                    <jvmarg value="-Xdebug"/>
  85.197 +                    <jvmarg value="-Xnoagent"/>
  85.198 +                    <jvmarg value="-Djava.compiler=none"/>
  85.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  85.200 +                    <jvmarg line="${run.jvmargs}"/>
  85.201 +                    <classpath>
  85.202 +                        <path path="@{classpath}"/>
  85.203 +                    </classpath>
  85.204 +                    <syspropertyset>
  85.205 +                        <propertyref prefix="run-sys-prop."/>
  85.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  85.207 +                    </syspropertyset>
  85.208 +                    <customize/>
  85.209 +                </java>
  85.210 +            </sequential>
  85.211 +        </macrodef>
  85.212 +    </target>
  85.213 +    <target name="-init-macrodef-java">
  85.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  85.215 +            <attribute name="classname" default="${main.class}"/>
  85.216 +            <element name="customize" optional="true"/>
  85.217 +            <sequential>
  85.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  85.219 +                    <jvmarg line="${run.jvmargs}"/>
  85.220 +                    <classpath>
  85.221 +                        <path path="${run.classpath}"/>
  85.222 +                    </classpath>
  85.223 +                    <syspropertyset>
  85.224 +                        <propertyref prefix="run-sys-prop."/>
  85.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  85.226 +                    </syspropertyset>
  85.227 +                    <customize/>
  85.228 +                </java>
  85.229 +            </sequential>
  85.230 +        </macrodef>
  85.231 +    </target>
  85.232 +    <target name="-init-presetdef-jar">
  85.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  85.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  85.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  85.236 +            </jar>
  85.237 +        </presetdef>
  85.238 +    </target>
  85.239 +    <target name="init" 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"/>
  85.240 +    <!--
  85.241 +    ===================
  85.242 +    COMPILATION SECTION
  85.243 +    ===================
  85.244 +    -->
  85.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  85.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  85.247 +        <mkdir dir="${build.classes.dir}"/>
  85.248 +    </target>
  85.249 +    <target name="-pre-compile">
  85.250 +        <!-- Empty placeholder for easier customization. -->
  85.251 +        <!-- You can override this target in the ../build.xml file. -->
  85.252 +    </target>
  85.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  85.254 +        <j2seproject3:javac/>
  85.255 +        <copy todir="${build.classes.dir}">
  85.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  85.257 +        </copy>
  85.258 +    </target>
  85.259 +    <target name="-post-compile">
  85.260 +        <!-- Empty placeholder for easier customization. -->
  85.261 +        <!-- You can override this target in the ../build.xml file. -->
  85.262 +    </target>
  85.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  85.264 +    <target name="-pre-compile-single">
  85.265 +        <!-- Empty placeholder for easier customization. -->
  85.266 +        <!-- You can override this target in the ../build.xml file. -->
  85.267 +    </target>
  85.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  85.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  85.270 +        <j2seproject3:javac>
  85.271 +            <customize>
  85.272 +                <patternset includes="${javac.includes}"/>
  85.273 +            </customize>
  85.274 +        </j2seproject3:javac>
  85.275 +    </target>
  85.276 +    <target name="-post-compile-single">
  85.277 +        <!-- Empty placeholder for easier customization. -->
  85.278 +        <!-- You can override this target in the ../build.xml file. -->
  85.279 +    </target>
  85.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  85.281 +    <!--
  85.282 +    ====================
  85.283 +    JAR BUILDING SECTION
  85.284 +    ====================
  85.285 +    -->
  85.286 +    <target name="-pre-pre-jar" depends="init">
  85.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  85.288 +        <mkdir dir="${dist.jar.dir}"/>
  85.289 +    </target>
  85.290 +    <target name="-pre-jar">
  85.291 +        <!-- Empty placeholder for easier customization. -->
  85.292 +        <!-- You can override this target in the ../build.xml file. -->
  85.293 +    </target>
  85.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  85.295 +        <j2seproject1:jar/>
  85.296 +    </target>
  85.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  85.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  85.299 +    </target>
  85.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  85.301 +        <j2seproject1:jar manifest="${manifest.file}">
  85.302 +            <j2seproject1:manifest>
  85.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  85.304 +            </j2seproject1:manifest>
  85.305 +        </j2seproject1:jar>
  85.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  85.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  85.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  85.309 +        <pathconvert property="run.classpath.with.dist.jar">
  85.310 +            <path path="${run.classpath}"/>
  85.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  85.312 +        </pathconvert>
  85.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  85.314 +    </target>
  85.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  85.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  85.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  85.318 +            <path path="${run.classpath}"/>
  85.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  85.320 +        </pathconvert>
  85.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  85.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  85.323 +            <chainedmapper>
  85.324 +                <flattenmapper/>
  85.325 +                <globmapper from="*" to="lib/*"/>
  85.326 +            </chainedmapper>
  85.327 +        </pathconvert>
  85.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  85.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  85.330 +            <fileset dir="${build.classes.dir}"/>
  85.331 +            <manifest>
  85.332 +                <attribute name="Main-Class" value="${main.class}"/>
  85.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  85.334 +            </manifest>
  85.335 +        </copylibs>
  85.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  85.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  85.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  85.339 +    </target>
  85.340 +    <target name="-post-jar">
  85.341 +        <!-- Empty placeholder for easier customization. -->
  85.342 +        <!-- You can override this target in the ../build.xml file. -->
  85.343 +    </target>
  85.344 +    <target name="jar" 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."/>
  85.345 +    <!--
  85.346 +    =================
  85.347 +    EXECUTION SECTION
  85.348 +    =================
  85.349 +    -->
  85.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  85.351 +        <j2seproject1:java>
  85.352 +            <customize>
  85.353 +                <arg line="${application.args}"/>
  85.354 +            </customize>
  85.355 +        </j2seproject1:java>
  85.356 +    </target>
  85.357 +    <target name="run-single" depends="init,compile-single">
  85.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  85.359 +        <j2seproject1:java classname="${run.class}"/>
  85.360 +    </target>
  85.361 +    <!--
  85.362 +    =================
  85.363 +    DEBUGGING SECTION
  85.364 +    =================
  85.365 +    -->
  85.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  85.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  85.368 +    </target>
  85.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  85.370 +        <j2seproject3:debug>
  85.371 +            <customize>
  85.372 +                <arg line="${application.args}"/>
  85.373 +            </customize>
  85.374 +        </j2seproject3:debug>
  85.375 +    </target>
  85.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  85.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  85.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  85.379 +    </target>
  85.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  85.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  85.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  85.383 +        <j2seproject3:debug classname="${debug.class}"/>
  85.384 +    </target>
  85.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  85.386 +    <target name="-pre-debug-fix" depends="init">
  85.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  85.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  85.389 +    </target>
  85.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  85.391 +        <j2seproject1:nbjpdareload/>
  85.392 +    </target>
  85.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  85.394 +    <!--
  85.395 +    ===============
  85.396 +    JAVADOC SECTION
  85.397 +    ===============
  85.398 +    -->
  85.399 +    <target name="-javadoc-build" depends="init">
  85.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  85.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  85.402 +            <classpath>
  85.403 +                <path path="${javac.classpath}"/>
  85.404 +            </classpath>
  85.405 +            <sourcepath>
  85.406 +                <pathelement location="${src.dir}"/>
  85.407 +            </sourcepath>
  85.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  85.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  85.410 +        </javadoc>
  85.411 +    </target>
  85.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  85.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  85.414 +    </target>
  85.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  85.416 +    <!--
  85.417 +    =========================
  85.418 +    JUNIT COMPILATION SECTION
  85.419 +    =========================
  85.420 +    -->
  85.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  85.422 +        <mkdir dir="${build.test.classes.dir}"/>
  85.423 +    </target>
  85.424 +    <target name="-pre-compile-test">
  85.425 +        <!-- Empty placeholder for easier customization. -->
  85.426 +        <!-- You can override this target in the ../build.xml file. -->
  85.427 +    </target>
  85.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  85.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  85.430 +        <copy todir="${build.test.classes.dir}">
  85.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  85.432 +        </copy>
  85.433 +    </target>
  85.434 +    <target name="-post-compile-test">
  85.435 +        <!-- Empty placeholder for easier customization. -->
  85.436 +        <!-- You can override this target in the ../build.xml file. -->
  85.437 +    </target>
  85.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  85.439 +    <target name="-pre-compile-test-single">
  85.440 +        <!-- Empty placeholder for easier customization. -->
  85.441 +        <!-- You can override this target in the ../build.xml file. -->
  85.442 +    </target>
  85.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  85.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  85.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  85.446 +            <customize>
  85.447 +                <patternset includes="${javac.includes}"/>
  85.448 +            </customize>
  85.449 +        </j2seproject3:javac>
  85.450 +        <copy todir="${build.test.classes.dir}">
  85.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  85.452 +        </copy>
  85.453 +    </target>
  85.454 +    <target name="-post-compile-test-single">
  85.455 +        <!-- Empty placeholder for easier customization. -->
  85.456 +        <!-- You can override this target in the ../build.xml file. -->
  85.457 +    </target>
  85.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  85.459 +    <!--
  85.460 +    =======================
  85.461 +    JUNIT EXECUTION SECTION
  85.462 +    =======================
  85.463 +    -->
  85.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  85.465 +        <mkdir dir="${build.test.results.dir}"/>
  85.466 +    </target>
  85.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  85.468 +        <j2seproject3:junit/>
  85.469 +    </target>
  85.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  85.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  85.472 +    </target>
  85.473 +    <target name="test-report" if="have.tests" depends="init"/>
  85.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  85.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  85.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  85.477 +        <mkdir dir="${build.test.results.dir}"/>
  85.478 +    </target>
  85.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  85.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  85.481 +        <j2seproject3:junit includes="${test.includes}"/>
  85.482 +    </target>
  85.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  85.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  85.485 +    </target>
  85.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  85.487 +    <!--
  85.488 +    =======================
  85.489 +    JUNIT DEBUGGING SECTION
  85.490 +    =======================
  85.491 +    -->
  85.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  85.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  85.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  85.495 +            <customize>
  85.496 +                <arg line="${test.class}"/>
  85.497 +            </customize>
  85.498 +        </j2seproject3:debug>
  85.499 +    </target>
  85.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  85.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  85.502 +    </target>
  85.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  85.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  85.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  85.506 +    </target>
  85.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  85.508 +    <!--
  85.509 +    =========================
  85.510 +    APPLET EXECUTION SECTION
  85.511 +    =========================
  85.512 +    -->
  85.513 +    <target name="run-applet" depends="init,compile-single">
  85.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  85.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  85.516 +            <customize>
  85.517 +                <arg value="${applet.url}"/>
  85.518 +            </customize>
  85.519 +        </j2seproject1:java>
  85.520 +    </target>
  85.521 +    <!--
  85.522 +    =========================
  85.523 +    APPLET DEBUGGING  SECTION
  85.524 +    =========================
  85.525 +    -->
  85.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  85.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  85.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  85.529 +            <customize>
  85.530 +                <arg value="${applet.url}"/>
  85.531 +            </customize>
  85.532 +        </j2seproject3:debug>
  85.533 +    </target>
  85.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  85.535 +    <!--
  85.536 +    ===============
  85.537 +    CLEANUP SECTION
  85.538 +    ===============
  85.539 +    -->
  85.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  85.541 +    <target name="-do-clean" depends="init">
  85.542 +        <delete dir="${build.dir}"/>
  85.543 +        <delete dir="${dist.dir}"/>
  85.544 +    </target>
  85.545 +    <target name="-post-clean">
  85.546 +        <!-- Empty placeholder for easier customization. -->
  85.547 +        <!-- You can override this target in the ../build.xml file. -->
  85.548 +    </target>
  85.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  85.550 +</project>
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/samples/apifest1/day2/elementbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    86.3 @@ -0,0 +1,8 @@
    86.4 +build.xml.data.CRC32=3856b393
    86.5 +build.xml.script.CRC32=5c47136e
    86.6 +build.xml.stylesheet.CRC32=a12b3d02
    86.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    86.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    86.9 +nbproject/build-impl.xml.data.CRC32=3856b393
   86.10 +nbproject/build-impl.xml.script.CRC32=6771a052
   86.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/samples/apifest1/day2/elementbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    87.3 @@ -0,0 +1,56 @@
    87.4 +build.classes.dir=${build.dir}/classes
    87.5 +build.classes.excludes=**/*.java,**/*.form
    87.6 +# This directory is removed when the project is cleaned:
    87.7 +build.dir=build
    87.8 +build.generated.dir=${build.dir}/generated
    87.9 +# Only compile against the classpath explicitly listed here:
   87.10 +build.sysclasspath=ignore
   87.11 +build.test.classes.dir=${build.dir}/test/classes
   87.12 +build.test.results.dir=${build.dir}/test/results
   87.13 +debug.classpath=\
   87.14 +    ${run.classpath}
   87.15 +debug.test.classpath=\
   87.16 +    ${run.test.classpath}
   87.17 +# This directory is removed when the project is cleaned:
   87.18 +dist.dir=dist
   87.19 +dist.jar=${dist.dir}/boolcircuit.jar
   87.20 +dist.javadoc.dir=${dist.dir}/javadoc
   87.21 +jar.compress=false
   87.22 +javac.classpath=
   87.23 +# Space-separated list of extra javac options
   87.24 +javac.compilerargs=
   87.25 +javac.deprecation=false
   87.26 +javac.source=1.5
   87.27 +javac.target=1.5
   87.28 +javac.test.classpath=\
   87.29 +    ${javac.classpath}:\
   87.30 +    ${build.classes.dir}:\
   87.31 +    ${libs.junit.classpath}
   87.32 +javadoc.additionalparam=
   87.33 +javadoc.author=false
   87.34 +javadoc.encoding=
   87.35 +javadoc.noindex=false
   87.36 +javadoc.nonavbar=false
   87.37 +javadoc.notree=false
   87.38 +javadoc.private=false
   87.39 +javadoc.splitindex=true
   87.40 +javadoc.use=true
   87.41 +javadoc.version=false
   87.42 +javadoc.windowtitle=
   87.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   87.44 +# The library definition has always preference over this property.
   87.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   87.46 +meta.inf.dir=${src.dir}/META-INF
   87.47 +platform.active=default_platform
   87.48 +run.classpath=\
   87.49 +    ${javac.classpath}:\
   87.50 +    ${build.classes.dir}
   87.51 +# Space-separated list of JVM arguments used when running the project
   87.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   87.53 +# or test-sys-prop.name=value to set system properties for unit tests):
   87.54 +run.jvmargs=
   87.55 +run.test.classpath=\
   87.56 +    ${javac.test.classpath}:\
   87.57 +    ${build.test.classes.dir}
   87.58 +src.dir=src
   87.59 +test.src.dir=test
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/samples/apifest1/day2/elementbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    88.3 @@ -0,0 +1,16 @@
    88.4 +<?xml version="1.0" encoding="UTF-8"?>
    88.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    88.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    88.7 +    <configuration>
    88.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    88.9 +            <name>elementbasedsolution</name>
   88.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   88.11 +            <source-roots>
   88.12 +                <root id="src.dir"/>
   88.13 +            </source-roots>
   88.14 +            <test-roots>
   88.15 +                <root id="test.src.dir"/>
   88.16 +            </test-roots>
   88.17 +        </data>
   88.18 +    </configuration>
   88.19 +</project>
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    89.3 @@ -0,0 +1,115 @@
    89.4 +/*
    89.5 + * The contents of this file are subject to the terms of the Common Development
    89.6 + * and Distribution License (the License). You may not use this file except in
    89.7 + * compliance with the License.
    89.8 + *
    89.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   89.10 + * or http://www.netbeans.org/cddl.txt.
   89.11 + *
   89.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   89.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   89.14 + * If applicable, add the following below the CDDL Header, with the fields
   89.15 + * enclosed by brackets [] replaced by your own identifying information:
   89.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   89.17 + *
   89.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   89.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   89.20 + * Microsystems, Inc. All Rights Reserved.
   89.21 + */
   89.22 +
   89.23 +package org.netbeans.apifest.boolcircuit;
   89.24 +
   89.25 +/**
   89.26 + */
   89.27 +public final class Circuit {
   89.28 +    private Circuit() {
   89.29 +    }
   89.30 +    
   89.31 +    public static Element and(final Element e1, final Element e2) {
   89.32 +        return new Element() {
   89.33 +            public boolean result() {
   89.34 +                return e1.result() && e2.result();
   89.35 +            }
   89.36 +            public double doubleResult() {
   89.37 +                return e1.doubleResult() * e2.doubleResult();
   89.38 +            }
   89.39 +        };
   89.40 +    }
   89.41 +    public static Element or(final Element e1, final Element e2) {
   89.42 +        return new Element() {
   89.43 +            public boolean result() {
   89.44 +                return e1.result() || e2.result();
   89.45 +            }
   89.46 +            public double doubleResult() {
   89.47 +                return 1.0 - (1.0 - e1.doubleResult()) * (1.0 - e2.doubleResult());
   89.48 +            }
   89.49 +        };
   89.50 +    }
   89.51 +
   89.52 +    public static Element not(final Element e1) {
   89.53 +        return new Element() {
   89.54 +            public boolean result() {
   89.55 +                return !e1.result();
   89.56 +            }
   89.57 +            public double doubleResult() {
   89.58 +                return 1 - e1.doubleResult();
   89.59 +            }
   89.60 +        };
   89.61 +    }
   89.62 +    
   89.63 +    public static Element operation(final Operation op, final Element... elements) {
   89.64 +        return new Element() {
   89.65 +            public boolean result() {
   89.66 +                return doubleResult() >= 1.0;
   89.67 +            }
   89.68 +            public double doubleResult() {
   89.69 +                double[] arr = new double[elements.length];
   89.70 +                for (int i = 0; i < arr.length; i++) {
   89.71 +                    arr[i] = elements[i].doubleResult();
   89.72 +                }
   89.73 +                return op.computeResult(arr);
   89.74 +            }
   89.75 +        };
   89.76 +        
   89.77 +    }
   89.78 +    
   89.79 +    public static Variable var() {
   89.80 +        return new Variable();
   89.81 +    }
   89.82 +    
   89.83 +    public static abstract class Element {
   89.84 +        private Element() {
   89.85 +        }
   89.86 +        
   89.87 +        public abstract boolean result();
   89.88 +        public abstract double doubleResult();
   89.89 +    }
   89.90 +    
   89.91 +    public static final class Variable extends Element {
   89.92 +        private Boolean booleanValue;
   89.93 +        private Double doubleValue;
   89.94 +        
   89.95 +        public void assignValue(boolean b) {
   89.96 +            booleanValue = b;
   89.97 +        }
   89.98 +        public void assignValue(double d) {
   89.99 +            if (d < 0 || d > 1) {
  89.100 +                throw new IllegalArgumentException();
  89.101 +            }
  89.102 +            doubleValue = d;
  89.103 +        }
  89.104 +
  89.105 +        public boolean result() {
  89.106 +            return booleanValue != null ? booleanValue : doubleValue >= 1.0;
  89.107 +        }
  89.108 +
  89.109 +        public double doubleResult() {
  89.110 +            return doubleValue != null ? doubleValue : (booleanValue ? 1.0 : 0.0);
  89.111 +        }
  89.112 +
  89.113 +    }
  89.114 +    
  89.115 +    public static interface Operation {
  89.116 +        public double computeResult(double... values);
  89.117 +    }
  89.118 +}
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/samples/apifest1/day2/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
    90.3 @@ -0,0 +1,132 @@
    90.4 +/*
    90.5 + * The contents of this file are subject to the terms of the Common Development
    90.6 + * and Distribution License (the License). You may not use this file except in
    90.7 + * compliance with the License.
    90.8 + *
    90.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   90.10 + * or http://www.netbeans.org/cddl.txt.
   90.11 + *
   90.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   90.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   90.14 + * If applicable, add the following below the CDDL Header, with the fields
   90.15 + * enclosed by brackets [] replaced by your own identifying information:
   90.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   90.17 + *
   90.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   90.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   90.20 + * Microsystems, Inc. All Rights Reserved.
   90.21 + */
   90.22 +
   90.23 +package org.netbeans.apifest.boolcircuit;
   90.24 +
   90.25 +import java.security.CodeSource;
   90.26 +import java.security.Permission;
   90.27 +import java.security.PermissionCollection;
   90.28 +import java.security.Policy;
   90.29 +import java.util.Collection;
   90.30 +import java.util.Collections;
   90.31 +import java.util.Enumeration;
   90.32 +import junit.framework.TestCase;
   90.33 +import junit.framework.*;
   90.34 +
   90.35 +/** The initial quest for this APIFest is to create an API for boolean 
   90.36 + * circuits. Such API shall be able to compose a boolean circuit from
   90.37 + * basic elements and evaluate the result given initial values for 
   90.38 + * input variables.
   90.39 + * <p>
   90.40 + * The basic elements include:
   90.41 + * <ul>
   90.42 + *   <li>negation - has one input and one output and changes 0 on input to 
   90.43 + *          on output 1 and 1 to 0
   90.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
   90.45 + *          inputs are 1, otherwise it is 0
   90.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
   90.47 + *          in the case when both inputs are 0
   90.48 + * </ul>
   90.49 + *
   90.50 + * <p>
   90.51 + * The boolean circuit can be used to represent boolean formulas and compute
   90.52 + * the results for certain values of its inputs. The individual tasks described
   90.53 + * as tests bellow.
   90.54 + *
   90.55 + * <p>
   90.56 + * Links of interest:
   90.57 + * <ul>
   90.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
   90.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
   90.60 + * </ul>
   90.61 + */
   90.62 +public class CircuitTest extends TestCase {
   90.63 +    static {
   90.64 +        // your code shall run without any permissions
   90.65 +    }
   90.66 +    
   90.67 +    public CircuitTest(String testName) {
   90.68 +        super(testName);
   90.69 +    }
   90.70 +
   90.71 +    protected void setUp() throws Exception {
   90.72 +    }
   90.73 +
   90.74 +    protected void tearDown() throws Exception {
   90.75 +    }
   90.76 +    
   90.77 +    
   90.78 +    /** 
   90.79 +     * Create a circuit to evaluate x1 and x2 and then
   90.80 +     * verify that its result is false for input (false, true) and
   90.81 +     * it is true for input (true, true).
   90.82 +     */
   90.83 +    public void testX1andX2() {
   90.84 +        Circuit.Variable x1 = Circuit.var();
   90.85 +        Circuit.Variable x2 = Circuit.var();
   90.86 +        
   90.87 +        Circuit.Element res = Circuit.and(x1, x2);
   90.88 +        
   90.89 +        x1.assignValue(false);
   90.90 +        x2.assignValue(true);
   90.91 +        assertFalse(res.result());
   90.92 +        
   90.93 +        x1.assignValue(true);
   90.94 +        x2.assignValue(true);
   90.95 +        assertTrue(res.result());
   90.96 +    }
   90.97 +    
   90.98 +    /** 
   90.99 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  90.100 +     * verify that its result is false for input (false, true, false) and
  90.101 +     * it is true for input (false, false, true).
  90.102 +     */
  90.103 +    public void testX1andX2orX3() {
  90.104 +        Circuit.Variable x1 = Circuit.var();
  90.105 +        Circuit.Variable x2 = Circuit.var();
  90.106 +        Circuit.Variable x3 = Circuit.var();
  90.107 +
  90.108 +        Circuit.Element res = Circuit.or(Circuit.and(x1, x2), x3);
  90.109 +        
  90.110 +        x1.assignValue(false);
  90.111 +        x2.assignValue(true);
  90.112 +        x3.assignValue(false);
  90.113 +        assertFalse(res.result());
  90.114 +        
  90.115 +        x1.assignValue(false);
  90.116 +        x2.assignValue(false);
  90.117 +        x3.assignValue(true);
  90.118 +        assertTrue(res.result());
  90.119 +    }
  90.120 +    /** 
  90.121 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  90.122 +     * verify that its result is true for all values of x1.
  90.123 +     */
  90.124 +    public void testAlwaysTrue() {
  90.125 +        Circuit.Variable x1 = Circuit.var();
  90.126 +        
  90.127 +        Circuit.Element res = Circuit.or(x1, Circuit.not(x1));
  90.128 +        
  90.129 +        x1.assignValue(false);
  90.130 +        assertTrue(res.result());
  90.131 +        x1.assignValue(true);
  90.132 +        assertTrue(res.result());
  90.133 +    }
  90.134 +    
  90.135 +}
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/samples/apifest1/day2/elementbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
    91.3 @@ -0,0 +1,164 @@
    91.4 +/*
    91.5 + * The contents of this file are subject to the terms of the Common Development
    91.6 + * and Distribution License (the License). You may not use this file except in
    91.7 + * compliance with the License.
    91.8 + *
    91.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   91.10 + * or http://www.netbeans.org/cddl.txt.
   91.11 + *
   91.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   91.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   91.14 + * If applicable, add the following below the CDDL Header, with the fields
   91.15 + * enclosed by brackets [] replaced by your own identifying information:
   91.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   91.17 + *
   91.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   91.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   91.20 + * Microsystems, Inc. All Rights Reserved.
   91.21 + */
   91.22 +
   91.23 +package org.netbeans.apifest.boolcircuit;
   91.24 +
   91.25 +import java.security.CodeSource;
   91.26 +import java.security.Permission;
   91.27 +import java.security.PermissionCollection;
   91.28 +import java.security.Policy;
   91.29 +import java.util.Collection;
   91.30 +import java.util.Collections;
   91.31 +import java.util.Enumeration;
   91.32 +import junit.framework.TestCase;
   91.33 +import junit.framework.*;
   91.34 +
   91.35 +/** This file contains the APIFest quest for day 2. Simply, turn the 
   91.36 + * boolean circuit into circuit that can compute with double values from 0 to 1.
   91.37 + * <p>
   91.38 + * This means that where ever a boolean was used to represent input or 
   91.39 + * output values, one can now use any double number from >= 0 and <= 1.
   91.40 + * Still, to support backward compatibility, the operations with booleans
   91.41 + * has to be kept available and have to work. In fact False shall be 
   91.42 + * treated as 0 and True as 1.
   91.43 + * <p>
   91.44 + * The basic elements has to be modified to work on doubles in the following
   91.45 + * way:
   91.46 + * <ul>
   91.47 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
   91.48 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
   91.49 + *             and(false,true)=0*1=0=false
   91.50 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
   91.51 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
   91.52 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
   91.53 + * </ul>
   91.54 + * <p>
   91.55 + * However as the circuits with doubles are more rich than plain boolean circuits,
   91.56 + * there is additional requirement to allow any user of your API to write its 
   91.57 + * own "element" type. This is all going to be exercise in the tests bellow
   91.58 + * which you are supposed to implement.
   91.59 + */
   91.60 +public class RealTest extends TestCase {
   91.61 +    static {
   91.62 +        // your code shall run without any permissions
   91.63 +    }
   91.64 +    
   91.65 +    public RealTest(String testName) {
   91.66 +        super(testName);
   91.67 +    }
   91.68 +
   91.69 +    protected void setUp() throws Exception {
   91.70 +    }
   91.71 +
   91.72 +    protected void tearDown() throws Exception {
   91.73 +    }
   91.74 +    
   91.75 +    
   91.76 +    /** First of all create a circuit which will evaluate
   91.77 +     * expression (X1 and X2) or not(x1). Hold the circuit
   91.78 +     * in some variable.
   91.79 +     *
   91.80 +     * Feed this circuit with x1=true, x2=false, assert result is false
   91.81 +     *
   91.82 +     * Feed the same circuit with x1=false, x2=true, assert result is true
   91.83 +     *
   91.84 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
   91.85 +     *
   91.86 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
   91.87 +     *
   91.88 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
   91.89 +     */
   91.90 +    public void testX1andX2orNotX1() {
   91.91 +        Circuit.Variable x1 = Circuit.var();
   91.92 +        Circuit.Variable x2 = Circuit.var();
   91.93 +        
   91.94 +        Circuit.Element el = Circuit.or(
   91.95 +            Circuit.and(x1, x2),
   91.96 +            Circuit.not(x1)
   91.97 +        );
   91.98 +        
   91.99 +        x1.assignValue(true); x2.assignValue(false);
  91.100 +        assertFalse(el.result());
  91.101 +        
  91.102 +        x1.assignValue(false); x2.assignValue(true);
  91.103 +        assertTrue(el.result());
  91.104 +        
  91.105 +        x1.assignValue(0.0); x2.assignValue(1.0);
  91.106 +        assertEquals(1.0, el.doubleResult());
  91.107 +        
  91.108 +        x1.assignValue(0.5); x2.assignValue(0.5);
  91.109 +        assertEquals(0.625, el.doubleResult());
  91.110 +        
  91.111 +        try {
  91.112 +            x1.assignValue(0.0); x2.assignValue(2.0);
  91.113 +            fail("Should throw an exception");
  91.114 +        } catch (IllegalArgumentException ex) {
  91.115 +            // ok
  91.116 +        }
  91.117 +    }
  91.118 +    
  91.119 +    /** Ensure that one variable cannot be filled with two different values.
  91.120 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
  91.121 +     * API that would not lead to x1 * x1 result, an exception is thrown.
  91.122 +     * For example if there was a way to feed the circuit with two different 
  91.123 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
  91.124 +     * improper use of the circuit.
  91.125 +     */
  91.126 +    public void testImproperUseOfTheCircuit() {
  91.127 +        // no way to get 0.3 * 0.5 from the circuit
  91.128 +        Circuit.Variable x1 = Circuit.var();
  91.129 +        Circuit.Element el = Circuit.and(x1, x1);
  91.130 +        
  91.131 +        x1.assignValue(0.3);
  91.132 +        assertEquals(0.3 * 0.3, el.doubleResult());
  91.133 +
  91.134 +        x1.assignValue(0.5);
  91.135 +        assertEquals(0.5 * 0.5, el.doubleResult());
  91.136 +    }
  91.137 +    
  91.138 +    /** Write your own element type called "gte" that will have two inputs and one output.
  91.139 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
  91.140 +     * 
  91.141 +     * Create 
  91.142 +     * circuit for following expression: (x1 and not(x1)) gte x1
  91.143 +     *
  91.144 +     * Feed the circuit with 0.5 and verify the result is 0
  91.145 +     *
  91.146 +     * Feed the same circuit with 1 and verify the result is 0
  91.147 +     *
  91.148 +     * Feed the same circuit with 0 and verify the result is 1
  91.149 +     */
  91.150 +    public void testGreaterThanElement() {
  91.151 +        class GreaterThanEqual implements Circuit.Operation {
  91.152 +            public double computeResult(double... values) {
  91.153 +                return values[0] >= values[1] ? 1.0 : 0.0;
  91.154 +            }
  91.155 +        }
  91.156 +        Circuit.Variable x1 = Circuit.var();
  91.157 +        Circuit.Element gte = Circuit.operation(
  91.158 +            new GreaterThanEqual(), 
  91.159 +            Circuit.and(x1, Circuit.not(x1)),
  91.160 +            x1
  91.161 +        );
  91.162 +       
  91.163 +        x1.assignValue(0.5); assertEquals(0.0, gte.doubleResult());
  91.164 +        x1.assignValue(1.0); assertEquals(0.0, gte.doubleResult());
  91.165 +        x1.assignValue(0.0); assertEquals(1.0, gte.doubleResult());
  91.166 +    }
  91.167 +}
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/samples/apifest1/day2/inputandoperation/build.xml	Sat Jun 14 09:52:45 2008 +0200
    92.3 @@ -0,0 +1,69 @@
    92.4 +<?xml version="1.0" encoding="UTF-8"?>
    92.5 +<!-- You may freely edit this file. See commented blocks below for -->
    92.6 +<!-- some examples of how to customize the build. -->
    92.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
    92.8 +<project name="inputandoperation" default="default" basedir=".">
    92.9 +    <description>Builds, tests, and runs the project boolcircuit.</description>
   92.10 +    <import file="nbproject/build-impl.xml"/>
   92.11 +    <!--
   92.12 +
   92.13 +    There exist several targets which are by default empty and which can be 
   92.14 +    used for execution of your tasks. These targets are usually executed 
   92.15 +    before and after some main targets. They are: 
   92.16 +
   92.17 +      -pre-init:                 called before initialization of project properties
   92.18 +      -post-init:                called after initialization of project properties
   92.19 +      -pre-compile:              called before javac compilation
   92.20 +      -post-compile:             called after javac compilation
   92.21 +      -pre-compile-single:       called before javac compilation of single file
   92.22 +      -post-compile-single:      called after javac compilation of single file
   92.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
   92.24 +      -post-compile-test:        called after javac compilation of JUnit tests
   92.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
   92.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
   92.27 +      -pre-jar:                  called before JAR building
   92.28 +      -post-jar:                 called after JAR building
   92.29 +      -post-clean:               called after cleaning build products
   92.30 +
   92.31 +    (Targets beginning with '-' are not intended to be called on their own.)
   92.32 +
   92.33 +    Example of inserting an obfuscator after compilation could look like this:
   92.34 +
   92.35 +        <target name="-post-compile">
   92.36 +            <obfuscate>
   92.37 +                <fileset dir="${build.classes.dir}"/>
   92.38 +            </obfuscate>
   92.39 +        </target>
   92.40 +
   92.41 +    For list of available properties check the imported 
   92.42 +    nbproject/build-impl.xml file. 
   92.43 +
   92.44 +
   92.45 +    Another way to customize the build is by overriding existing main targets.
   92.46 +    The targets of interest are: 
   92.47 +
   92.48 +      -init-macrodef-javac:     defines macro for javac compilation
   92.49 +      -init-macrodef-junit:     defines macro for junit execution
   92.50 +      -init-macrodef-debug:     defines macro for class debugging
   92.51 +      -init-macrodef-java:      defines macro for class execution
   92.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
   92.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
   92.54 +      run:                      execution of project 
   92.55 +      -javadoc-build:           Javadoc generation
   92.56 +      test-report:              JUnit report generation
   92.57 +
   92.58 +    An example of overriding the target for project execution could look like this:
   92.59 +
   92.60 +        <target name="run" depends="boolcircuit-impl.jar">
   92.61 +            <exec dir="bin" executable="launcher.exe">
   92.62 +                <arg file="${dist.jar}"/>
   92.63 +            </exec>
   92.64 +        </target>
   92.65 +
   92.66 +    Notice that the overridden target depends on the jar target and not only on 
   92.67 +    the compile target as the regular run target does. Again, for a list of available 
   92.68 +    properties which you can use, check the target you are overriding in the
   92.69 +    nbproject/build-impl.xml file. 
   92.70 +
   92.71 +    -->
   92.72 +</project>
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
    93.3 @@ -0,0 +1,547 @@
    93.4 +<?xml version="1.0" encoding="UTF-8"?>
    93.5 +<!--
    93.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
    93.7 +***         EDIT ../build.xml INSTEAD         ***
    93.8 +
    93.9 +For the purpose of easier reading the script
   93.10 +is divided into following sections:
   93.11 +
   93.12 +  - initialization
   93.13 +  - compilation
   93.14 +  - jar
   93.15 +  - execution
   93.16 +  - debugging
   93.17 +  - javadoc
   93.18 +  - junit compilation
   93.19 +  - junit execution
   93.20 +  - junit debugging
   93.21 +  - applet
   93.22 +  - cleanup
   93.23 +
   93.24 +-->
   93.25 +<project name="inputandoperation-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
   93.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
   93.27 +    <!-- 
   93.28 +    ======================
   93.29 +    INITIALIZATION SECTION 
   93.30 +    ======================
   93.31 +    -->
   93.32 +    <target name="-pre-init">
   93.33 +        <!-- Empty placeholder for easier customization. -->
   93.34 +        <!-- You can override this target in the ../build.xml file. -->
   93.35 +    </target>
   93.36 +    <target name="-init-private" depends="-pre-init">
   93.37 +        <property file="nbproject/private/private.properties"/>
   93.38 +    </target>
   93.39 +    <target name="-init-user" depends="-pre-init,-init-private">
   93.40 +        <property file="${user.properties.file}"/>
   93.41 +        <!-- The two properties below are usually overridden -->
   93.42 +        <!-- by the active platform. Just a fallback. -->
   93.43 +        <property name="default.javac.source" value="1.4"/>
   93.44 +        <property name="default.javac.target" value="1.4"/>
   93.45 +    </target>
   93.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
   93.47 +        <property file="nbproject/project.properties"/>
   93.48 +    </target>
   93.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
   93.50 +        <available file="${manifest.file}" property="manifest.available"/>
   93.51 +        <condition property="manifest.available+main.class">
   93.52 +            <and>
   93.53 +                <isset property="manifest.available"/>
   93.54 +                <isset property="main.class"/>
   93.55 +                <not>
   93.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
   93.57 +                </not>
   93.58 +            </and>
   93.59 +        </condition>
   93.60 +        <condition property="manifest.available+main.class+mkdist.available">
   93.61 +            <and>
   93.62 +                <istrue value="${manifest.available+main.class}"/>
   93.63 +                <isset property="libs.CopyLibs.classpath"/>
   93.64 +            </and>
   93.65 +        </condition>
   93.66 +        <condition property="have.tests">
   93.67 +            <or>
   93.68 +                <available file="${test.src.dir}"/>
   93.69 +            </or>
   93.70 +        </condition>
   93.71 +        <condition property="have.sources">
   93.72 +            <or>
   93.73 +                <available file="${src.dir}"/>
   93.74 +            </or>
   93.75 +        </condition>
   93.76 +        <condition property="netbeans.home+have.tests">
   93.77 +            <and>
   93.78 +                <isset property="netbeans.home"/>
   93.79 +                <isset property="have.tests"/>
   93.80 +            </and>
   93.81 +        </condition>
   93.82 +        <condition property="no.javadoc.preview">
   93.83 +            <isfalse value="${javadoc.preview}"/>
   93.84 +        </condition>
   93.85 +        <property name="run.jvmargs" value=""/>
   93.86 +        <property name="javac.compilerargs" value=""/>
   93.87 +        <property name="work.dir" value="${basedir}"/>
   93.88 +        <condition property="no.deps">
   93.89 +            <and>
   93.90 +                <istrue value="${no.dependencies}"/>
   93.91 +            </and>
   93.92 +        </condition>
   93.93 +        <property name="javac.debug" value="true"/>
   93.94 +        <property name="javadoc.preview" value="true"/>
   93.95 +        <property name="application.args" value=""/>
   93.96 +    </target>
   93.97 +    <target name="-post-init">
   93.98 +        <!-- Empty placeholder for easier customization. -->
   93.99 +        <!-- You can override this target in the ../build.xml file. -->
  93.100 +    </target>
  93.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
  93.102 +        <fail unless="src.dir">Must set src.dir</fail>
  93.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
  93.104 +        <fail unless="build.dir">Must set build.dir</fail>
  93.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
  93.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  93.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  93.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  93.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  93.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  93.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
  93.112 +    </target>
  93.113 +    <target name="-init-macrodef-property">
  93.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  93.115 +            <attribute name="name"/>
  93.116 +            <attribute name="value"/>
  93.117 +            <sequential>
  93.118 +                <property name="@{name}" value="${@{value}}"/>
  93.119 +            </sequential>
  93.120 +        </macrodef>
  93.121 +    </target>
  93.122 +    <target name="-init-macrodef-javac">
  93.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  93.124 +            <attribute name="srcdir" default="${src.dir}"/>
  93.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
  93.126 +            <attribute name="classpath" default="${javac.classpath}"/>
  93.127 +            <attribute name="debug" default="${javac.debug}"/>
  93.128 +            <element name="customize" optional="true"/>
  93.129 +            <sequential>
  93.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
  93.131 +                    <classpath>
  93.132 +                        <path path="@{classpath}"/>
  93.133 +                    </classpath>
  93.134 +                </depend>
  93.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
  93.136 +                    <classpath>
  93.137 +                        <path path="@{classpath}"/>
  93.138 +                    </classpath>
  93.139 +                    <compilerarg line="${javac.compilerargs}"/>
  93.140 +                    <customize/>
  93.141 +                </javac>
  93.142 +            </sequential>
  93.143 +        </macrodef>
  93.144 +    </target>
  93.145 +    <target name="-init-macrodef-junit">
  93.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  93.147 +            <attribute name="includes" default="**/*Test.java"/>
  93.148 +            <sequential>
  93.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
  93.150 +                    <batchtest todir="${build.test.results.dir}">
  93.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
  93.152 +                    </batchtest>
  93.153 +                    <classpath>
  93.154 +                        <path path="${run.test.classpath}"/>
  93.155 +                    </classpath>
  93.156 +                    <syspropertyset>
  93.157 +                        <propertyref prefix="test-sys-prop."/>
  93.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
  93.159 +                    </syspropertyset>
  93.160 +                    <formatter type="brief" usefile="false"/>
  93.161 +                    <formatter type="xml"/>
  93.162 +                    <jvmarg line="${run.jvmargs}"/>
  93.163 +                </junit>
  93.164 +            </sequential>
  93.165 +        </macrodef>
  93.166 +    </target>
  93.167 +    <target name="-init-macrodef-nbjpda">
  93.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  93.169 +            <attribute name="name" default="${main.class}"/>
  93.170 +            <attribute name="classpath" default="${debug.classpath}"/>
  93.171 +            <attribute name="stopclassname" default=""/>
  93.172 +            <sequential>
  93.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
  93.174 +                    <classpath>
  93.175 +                        <path path="@{classpath}"/>
  93.176 +                    </classpath>
  93.177 +                </nbjpdastart>
  93.178 +            </sequential>
  93.179 +        </macrodef>
  93.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  93.181 +            <attribute name="dir" default="${build.classes.dir}"/>
  93.182 +            <sequential>
  93.183 +                <nbjpdareload>
  93.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
  93.185 +                </nbjpdareload>
  93.186 +            </sequential>
  93.187 +        </macrodef>
  93.188 +    </target>
  93.189 +    <target name="-init-macrodef-debug">
  93.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  93.191 +            <attribute name="classname" default="${main.class}"/>
  93.192 +            <attribute name="classpath" default="${debug.classpath}"/>
  93.193 +            <element name="customize" optional="true"/>
  93.194 +            <sequential>
  93.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  93.196 +                    <jvmarg value="-Xdebug"/>
  93.197 +                    <jvmarg value="-Xnoagent"/>
  93.198 +                    <jvmarg value="-Djava.compiler=none"/>
  93.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
  93.200 +                    <jvmarg line="${run.jvmargs}"/>
  93.201 +                    <classpath>
  93.202 +                        <path path="@{classpath}"/>
  93.203 +                    </classpath>
  93.204 +                    <syspropertyset>
  93.205 +                        <propertyref prefix="run-sys-prop."/>
  93.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  93.207 +                    </syspropertyset>
  93.208 +                    <customize/>
  93.209 +                </java>
  93.210 +            </sequential>
  93.211 +        </macrodef>
  93.212 +    </target>
  93.213 +    <target name="-init-macrodef-java">
  93.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  93.215 +            <attribute name="classname" default="${main.class}"/>
  93.216 +            <element name="customize" optional="true"/>
  93.217 +            <sequential>
  93.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
  93.219 +                    <jvmarg line="${run.jvmargs}"/>
  93.220 +                    <classpath>
  93.221 +                        <path path="${run.classpath}"/>
  93.222 +                    </classpath>
  93.223 +                    <syspropertyset>
  93.224 +                        <propertyref prefix="run-sys-prop."/>
  93.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
  93.226 +                    </syspropertyset>
  93.227 +                    <customize/>
  93.228 +                </java>
  93.229 +            </sequential>
  93.230 +        </macrodef>
  93.231 +    </target>
  93.232 +    <target name="-init-presetdef-jar">
  93.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  93.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
  93.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
  93.236 +            </jar>
  93.237 +        </presetdef>
  93.238 +    </target>
  93.239 +    <target name="init" 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"/>
  93.240 +    <!--
  93.241 +    ===================
  93.242 +    COMPILATION SECTION
  93.243 +    ===================
  93.244 +    -->
  93.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
  93.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
  93.247 +        <mkdir dir="${build.classes.dir}"/>
  93.248 +    </target>
  93.249 +    <target name="-pre-compile">
  93.250 +        <!-- Empty placeholder for easier customization. -->
  93.251 +        <!-- You can override this target in the ../build.xml file. -->
  93.252 +    </target>
  93.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
  93.254 +        <j2seproject3:javac/>
  93.255 +        <copy todir="${build.classes.dir}">
  93.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
  93.257 +        </copy>
  93.258 +    </target>
  93.259 +    <target name="-post-compile">
  93.260 +        <!-- Empty placeholder for easier customization. -->
  93.261 +        <!-- You can override this target in the ../build.xml file. -->
  93.262 +    </target>
  93.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
  93.264 +    <target name="-pre-compile-single">
  93.265 +        <!-- Empty placeholder for easier customization. -->
  93.266 +        <!-- You can override this target in the ../build.xml file. -->
  93.267 +    </target>
  93.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
  93.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  93.270 +        <j2seproject3:javac>
  93.271 +            <customize>
  93.272 +                <patternset includes="${javac.includes}"/>
  93.273 +            </customize>
  93.274 +        </j2seproject3:javac>
  93.275 +    </target>
  93.276 +    <target name="-post-compile-single">
  93.277 +        <!-- Empty placeholder for easier customization. -->
  93.278 +        <!-- You can override this target in the ../build.xml file. -->
  93.279 +    </target>
  93.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
  93.281 +    <!--
  93.282 +    ====================
  93.283 +    JAR BUILDING SECTION
  93.284 +    ====================
  93.285 +    -->
  93.286 +    <target name="-pre-pre-jar" depends="init">
  93.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
  93.288 +        <mkdir dir="${dist.jar.dir}"/>
  93.289 +    </target>
  93.290 +    <target name="-pre-jar">
  93.291 +        <!-- Empty placeholder for easier customization. -->
  93.292 +        <!-- You can override this target in the ../build.xml file. -->
  93.293 +    </target>
  93.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
  93.295 +        <j2seproject1:jar/>
  93.296 +    </target>
  93.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
  93.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
  93.299 +    </target>
  93.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
  93.301 +        <j2seproject1:jar manifest="${manifest.file}">
  93.302 +            <j2seproject1:manifest>
  93.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
  93.304 +            </j2seproject1:manifest>
  93.305 +        </j2seproject1:jar>
  93.306 +        <echo>To run this application from the command line without Ant, try:</echo>
  93.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  93.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  93.309 +        <pathconvert property="run.classpath.with.dist.jar">
  93.310 +            <path path="${run.classpath}"/>
  93.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
  93.312 +        </pathconvert>
  93.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
  93.314 +    </target>
  93.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
  93.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
  93.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
  93.318 +            <path path="${run.classpath}"/>
  93.319 +            <map from="${build.classes.dir.resolved}" to=""/>
  93.320 +        </pathconvert>
  93.321 +        <pathconvert property="jar.classpath" pathsep=" ">
  93.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
  93.323 +            <chainedmapper>
  93.324 +                <flattenmapper/>
  93.325 +                <globmapper from="*" to="lib/*"/>
  93.326 +            </chainedmapper>
  93.327 +        </pathconvert>
  93.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
  93.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
  93.330 +            <fileset dir="${build.classes.dir}"/>
  93.331 +            <manifest>
  93.332 +                <attribute name="Main-Class" value="${main.class}"/>
  93.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
  93.334 +            </manifest>
  93.335 +        </copylibs>
  93.336 +        <echo>To run this application from the command line without Ant, try:</echo>
  93.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
  93.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
  93.339 +    </target>
  93.340 +    <target name="-post-jar">
  93.341 +        <!-- Empty placeholder for easier customization. -->
  93.342 +        <!-- You can override this target in the ../build.xml file. -->
  93.343 +    </target>
  93.344 +    <target name="jar" 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."/>
  93.345 +    <!--
  93.346 +    =================
  93.347 +    EXECUTION SECTION
  93.348 +    =================
  93.349 +    -->
  93.350 +    <target name="run" depends="init,compile" description="Run a main class.">
  93.351 +        <j2seproject1:java>
  93.352 +            <customize>
  93.353 +                <arg line="${application.args}"/>
  93.354 +            </customize>
  93.355 +        </j2seproject1:java>
  93.356 +    </target>
  93.357 +    <target name="run-single" depends="init,compile-single">
  93.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
  93.359 +        <j2seproject1:java classname="${run.class}"/>
  93.360 +    </target>
  93.361 +    <!--
  93.362 +    =================
  93.363 +    DEBUGGING SECTION
  93.364 +    =================
  93.365 +    -->
  93.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
  93.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
  93.368 +    </target>
  93.369 +    <target name="-debug-start-debuggee" depends="init,compile">
  93.370 +        <j2seproject3:debug>
  93.371 +            <customize>
  93.372 +                <arg line="${application.args}"/>
  93.373 +            </customize>
  93.374 +        </j2seproject3:debug>
  93.375 +    </target>
  93.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
  93.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
  93.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
  93.379 +    </target>
  93.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
  93.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
  93.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
  93.383 +        <j2seproject3:debug classname="${debug.class}"/>
  93.384 +    </target>
  93.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
  93.386 +    <target name="-pre-debug-fix" depends="init">
  93.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
  93.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
  93.389 +    </target>
  93.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
  93.391 +        <j2seproject1:nbjpdareload/>
  93.392 +    </target>
  93.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
  93.394 +    <!--
  93.395 +    ===============
  93.396 +    JAVADOC SECTION
  93.397 +    ===============
  93.398 +    -->
  93.399 +    <target name="-javadoc-build" depends="init">
  93.400 +        <mkdir dir="${dist.javadoc.dir}"/>
  93.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
  93.402 +            <classpath>
  93.403 +                <path path="${javac.classpath}"/>
  93.404 +            </classpath>
  93.405 +            <sourcepath>
  93.406 +                <pathelement location="${src.dir}"/>
  93.407 +            </sourcepath>
  93.408 +            <packageset dir="${src.dir}" includes="*/**"/>
  93.409 +            <fileset dir="${src.dir}" includes="*.java"/>
  93.410 +        </javadoc>
  93.411 +    </target>
  93.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
  93.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
  93.414 +    </target>
  93.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
  93.416 +    <!--
  93.417 +    =========================
  93.418 +    JUNIT COMPILATION SECTION
  93.419 +    =========================
  93.420 +    -->
  93.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
  93.422 +        <mkdir dir="${build.test.classes.dir}"/>
  93.423 +    </target>
  93.424 +    <target name="-pre-compile-test">
  93.425 +        <!-- Empty placeholder for easier customization. -->
  93.426 +        <!-- You can override this target in the ../build.xml file. -->
  93.427 +    </target>
  93.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
  93.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
  93.430 +        <copy todir="${build.test.classes.dir}">
  93.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  93.432 +        </copy>
  93.433 +    </target>
  93.434 +    <target name="-post-compile-test">
  93.435 +        <!-- Empty placeholder for easier customization. -->
  93.436 +        <!-- You can override this target in the ../build.xml file. -->
  93.437 +    </target>
  93.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
  93.439 +    <target name="-pre-compile-test-single">
  93.440 +        <!-- Empty placeholder for easier customization. -->
  93.441 +        <!-- You can override this target in the ../build.xml file. -->
  93.442 +    </target>
  93.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
  93.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  93.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
  93.446 +            <customize>
  93.447 +                <patternset includes="${javac.includes}"/>
  93.448 +            </customize>
  93.449 +        </j2seproject3:javac>
  93.450 +        <copy todir="${build.test.classes.dir}">
  93.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
  93.452 +        </copy>
  93.453 +    </target>
  93.454 +    <target name="-post-compile-test-single">
  93.455 +        <!-- Empty placeholder for easier customization. -->
  93.456 +        <!-- You can override this target in the ../build.xml file. -->
  93.457 +    </target>
  93.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
  93.459 +    <!--
  93.460 +    =======================
  93.461 +    JUNIT EXECUTION SECTION
  93.462 +    =======================
  93.463 +    -->
  93.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
  93.465 +        <mkdir dir="${build.test.results.dir}"/>
  93.466 +    </target>
  93.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
  93.468 +        <j2seproject3:junit/>
  93.469 +    </target>
  93.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
  93.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  93.472 +    </target>
  93.473 +    <target name="test-report" if="have.tests" depends="init"/>
  93.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
  93.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
  93.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
  93.477 +        <mkdir dir="${build.test.results.dir}"/>
  93.478 +    </target>
  93.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
  93.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
  93.481 +        <j2seproject3:junit includes="${test.includes}"/>
  93.482 +    </target>
  93.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
  93.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
  93.485 +    </target>
  93.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
  93.487 +    <!--
  93.488 +    =======================
  93.489 +    JUNIT DEBUGGING SECTION
  93.490 +    =======================
  93.491 +    -->
  93.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
  93.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
  93.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
  93.495 +            <customize>
  93.496 +                <arg line="${test.class}"/>
  93.497 +            </customize>
  93.498 +        </j2seproject3:debug>
  93.499 +    </target>
  93.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
  93.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
  93.502 +    </target>
  93.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
  93.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
  93.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
  93.506 +    </target>
  93.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
  93.508 +    <!--
  93.509 +    =========================
  93.510 +    APPLET EXECUTION SECTION
  93.511 +    =========================
  93.512 +    -->
  93.513 +    <target name="run-applet" depends="init,compile-single">
  93.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  93.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
  93.516 +            <customize>
  93.517 +                <arg value="${applet.url}"/>
  93.518 +            </customize>
  93.519 +        </j2seproject1:java>
  93.520 +    </target>
  93.521 +    <!--
  93.522 +    =========================
  93.523 +    APPLET DEBUGGING  SECTION
  93.524 +    =========================
  93.525 +    -->
  93.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
  93.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
  93.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
  93.529 +            <customize>
  93.530 +                <arg value="${applet.url}"/>
  93.531 +            </customize>
  93.532 +        </j2seproject3:debug>
  93.533 +    </target>
  93.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
  93.535 +    <!--
  93.536 +    ===============
  93.537 +    CLEANUP SECTION
  93.538 +    ===============
  93.539 +    -->
  93.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
  93.541 +    <target name="-do-clean" depends="init">
  93.542 +        <delete dir="${build.dir}"/>
  93.543 +        <delete dir="${dist.dir}"/>
  93.544 +    </target>
  93.545 +    <target name="-post-clean">
  93.546 +        <!-- Empty placeholder for easier customization. -->
  93.547 +        <!-- You can override this target in the ../build.xml file. -->
  93.548 +    </target>
  93.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
  93.550 +</project>
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
    94.3 @@ -0,0 +1,5 @@
    94.4 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    94.5 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    94.6 +nbproject/build-impl.xml.data.CRC32=835ca895
    94.7 +nbproject/build-impl.xml.script.CRC32=7f83eb6b
    94.8 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
    95.3 @@ -0,0 +1,56 @@
    95.4 +build.classes.dir=${build.dir}/classes
    95.5 +build.classes.excludes=**/*.java,**/*.form
    95.6 +# This directory is removed when the project is cleaned:
    95.7 +build.dir=build
    95.8 +build.generated.dir=${build.dir}/generated
    95.9 +# Only compile against the classpath explicitly listed here:
   95.10 +build.sysclasspath=ignore
   95.11 +build.test.classes.dir=${build.dir}/test/classes
   95.12 +build.test.results.dir=${build.dir}/test/results
   95.13 +debug.classpath=\
   95.14 +    ${run.classpath}
   95.15 +debug.test.classpath=\
   95.16 +    ${run.test.classpath}
   95.17 +# This directory is removed when the project is cleaned:
   95.18 +dist.dir=dist
   95.19 +dist.jar=${dist.dir}/boolcircuit.jar
   95.20 +dist.javadoc.dir=${dist.dir}/javadoc
   95.21 +jar.compress=false
   95.22 +javac.classpath=
   95.23 +# Space-separated list of extra javac options
   95.24 +javac.compilerargs=
   95.25 +javac.deprecation=false
   95.26 +javac.source=1.5
   95.27 +javac.target=1.5
   95.28 +javac.test.classpath=\
   95.29 +    ${javac.classpath}:\
   95.30 +    ${build.classes.dir}:\
   95.31 +    ${libs.junit.classpath}
   95.32 +javadoc.additionalparam=
   95.33 +javadoc.author=false
   95.34 +javadoc.encoding=
   95.35 +javadoc.noindex=false
   95.36 +javadoc.nonavbar=false
   95.37 +javadoc.notree=false
   95.38 +javadoc.private=false
   95.39 +javadoc.splitindex=true
   95.40 +javadoc.use=true
   95.41 +javadoc.version=false
   95.42 +javadoc.windowtitle=
   95.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
   95.44 +# The library definition has always preference over this property.
   95.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   95.46 +meta.inf.dir=${src.dir}/META-INF
   95.47 +platform.active=default_platform
   95.48 +run.classpath=\
   95.49 +    ${javac.classpath}:\
   95.50 +    ${build.classes.dir}
   95.51 +# Space-separated list of JVM arguments used when running the project
   95.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
   95.53 +# or test-sys-prop.name=value to set system properties for unit tests):
   95.54 +run.jvmargs=
   95.55 +run.test.classpath=\
   95.56 +    ${javac.test.classpath}:\
   95.57 +    ${build.test.classes.dir}
   95.58 +src.dir=src
   95.59 +test.src.dir=test
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
    96.3 @@ -0,0 +1,16 @@
    96.4 +<?xml version="1.0" encoding="UTF-8"?>
    96.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
    96.6 +    <type>org.netbeans.modules.java.j2seproject</type>
    96.7 +    <configuration>
    96.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    96.9 +            <name>inputandoperation</name>
   96.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
   96.11 +            <source-roots>
   96.12 +                <root id="src.dir"/>
   96.13 +            </source-roots>
   96.14 +            <test-roots>
   96.15 +                <root id="test.src.dir"/>
   96.16 +            </test-roots>
   96.17 +        </data>
   96.18 +    </configuration>
   96.19 +</project>
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/AndOperation.java	Sat Jun 14 09:52:45 2008 +0200
    97.3 @@ -0,0 +1,35 @@
    97.4 +/*
    97.5 + * AndOperation.java
    97.6 + *
    97.7 + * Created on July 12, 2006, 2:34 PM
    97.8 + *
    97.9 + * To change this template, choose Tools | Template Manager
   97.10 + * and open the template in the editor.
   97.11 + */
   97.12 +
   97.13 +package org.netbeans.apifest.boolcircuit;
   97.14 +
   97.15 +/**
   97.16 + *
   97.17 + */
   97.18 +final class AndOperation extends Operation {
   97.19 +
   97.20 +    private Input input1;
   97.21 +
   97.22 +    private Input input2;
   97.23 +    
   97.24 +    /** Creates a new instance of AndOperation */
   97.25 +    AndOperation(Input in1, Input in2) {
   97.26 +        input1 = in1;
   97.27 +        input2 = in2;
   97.28 +    }
   97.29 +
   97.30 +    public boolean performBooleanOperation() {
   97.31 +        return input1.getBooleanValue() && input2.getBooleanValue();
   97.32 +    }
   97.33 +
   97.34 +    public double performRealOperation() {
   97.35 +        return input1.getRealValue() * input2.getRealValue();
   97.36 +    }
   97.37 +    
   97.38 +}
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/BooleanInput.java	Sat Jun 14 09:52:45 2008 +0200
    98.3 @@ -0,0 +1,32 @@
    98.4 +/*
    98.5 + * BooleanInput.java
    98.6 + *
    98.7 + * Created on July 12, 2006, 2:31 PM
    98.8 + *
    98.9 + * To change this template, choose Tools | Template Manager
   98.10 + * and open the template in the editor.
   98.11 + */
   98.12 +
   98.13 +package org.netbeans.apifest.boolcircuit;
   98.14 +
   98.15 +/**
   98.16 + *
   98.17 + */
   98.18 +final class BooleanInput extends Input {
   98.19 +
   98.20 +    private boolean value;
   98.21 +    
   98.22 +    /** Creates a new instance of BooleanInput */
   98.23 +    public BooleanInput(boolean val) {
   98.24 +        value = val;
   98.25 +    }
   98.26 +
   98.27 +    public boolean getBooleanValue() {
   98.28 +        return value;
   98.29 +    }
   98.30 +
   98.31 +    public double getRealValue() {
   98.32 +        return value ? 1f : 0f; 
   98.33 +    }
   98.34 +    
   98.35 +}
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
    99.3 @@ -0,0 +1,33 @@
    99.4 +/*
    99.5 + * The contents of this file are subject to the terms of the Common Development
    99.6 + * and Distribution License (the License). You may not use this file except in
    99.7 + * compliance with the License.
    99.8 + *
    99.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   99.10 + * or http://www.netbeans.org/cddl.txt.
   99.11 + *
   99.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   99.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   99.14 + * If applicable, add the following below the CDDL Header, with the fields
   99.15 + * enclosed by brackets [] replaced by your own identifying information:
   99.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   99.17 + *
   99.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   99.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   99.20 + * Microsystems, Inc. All Rights Reserved.
   99.21 + */
   99.22 +
   99.23 +package org.netbeans.apifest.boolcircuit;
   99.24 +
   99.25 +/**
   99.26 + */
   99.27 +class Circuit {
   99.28 +    
   99.29 +    public static boolean evaluateBooleanOperation(Operation op) {
   99.30 +        return op.performBooleanOperation();
   99.31 +    }
   99.32 +    
   99.33 +    public static double evaluateRealOperation(Operation op) {
   99.34 +        return op.performRealOperation();
   99.35 +    }
   99.36 +}
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Factory.java	Sat Jun 14 09:52:45 2008 +0200
   100.3 @@ -0,0 +1,70 @@
   100.4 +/*
   100.5 + * Factory.java
   100.6 + *
   100.7 + * Created on July 12, 2006, 2:21 PM
   100.8 + *
   100.9 + * To change this template, choose Tools | Template Manager
  100.10 + * and open the template in the editor.
  100.11 + */
  100.12 +
  100.13 +package org.netbeans.apifest.boolcircuit;
  100.14 +
  100.15 +/**
  100.16 + *
  100.17 + */
  100.18 +public class Factory {
  100.19 +    
  100.20 +    /** Creates a new instance of Factory */
  100.21 +    private Factory() {
  100.22 +    }
  100.23 +    
  100.24 +    /**
  100.25 +     * @deprecated use for constants only.. use VariableInput instead..
  100.26 +     */
  100.27 +    public static Input createSimpleBooleanInput(boolean value) {
  100.28 +        return new BooleanInput(value);
  100.29 +    }
  100.30 +    
  100.31 +    public static VariableInput createVariableInput() {
  100.32 +        return new VariableInput();
  100.33 +    }
  100.34 +    /**
  100.35 +     * @throws IllegalArgument if the boolean operation was already used as input for another operation..
  100.36 +     * @deprecated
  100.37 +     */
  100.38 +    public static Input createOperationBasedBooleanInput(Operation op) throws IllegalArgumentException {
  100.39 +        assert op != null;
  100.40 +        if (op.isUsed()) {
  100.41 +            throw new IllegalArgumentException("Cannot use a single operation repeatedly.");
  100.42 +        }
  100.43 +        op.markOperationAsUsed();
  100.44 +        return new OperationInput(op);
  100.45 +    }
  100.46 +    
  100.47 +    /**
  100.48 +     * WTF, just make another reasonable sounding factory method now that we have reals..
  100.49 +     */
  100.50 +    
  100.51 +    public static Input createOperationBasedInput(Operation op) throws IllegalArgumentException {
  100.52 +        return createOperationBasedBooleanInput(op);
  100.53 +    }
  100.54 +    
  100.55 +    public static Operation createAndOperation(Input one, Input two) {
  100.56 +        assert one != null;
  100.57 +        assert two != null;
  100.58 +        return new AndOperation(one, two);
  100.59 +    }
  100.60 +    
  100.61 +    public static Operation createOrOperation(Input one, Input two) {
  100.62 +        assert one != null;
  100.63 +        assert two != null;
  100.64 +        return new OrOperation(one, two);
  100.65 +    }
  100.66 +    
  100.67 +    public static Operation createNotOperation(Input one) {
  100.68 +        assert one != null;
  100.69 +        return new NotOperation(one);
  100.70 +    }
  100.71 +    
  100.72 +    
  100.73 +}
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Input.java	Sat Jun 14 09:52:45 2008 +0200
   101.3 @@ -0,0 +1,25 @@
   101.4 +/*
   101.5 + * Input.java
   101.6 + *
   101.7 + * Created on July 12, 2006, 2:20 PM
   101.8 + *
   101.9 + * To change this template, choose Tools | Template Manager
  101.10 + * and open the template in the editor.
  101.11 + */
  101.12 +
  101.13 +package org.netbeans.apifest.boolcircuit;
  101.14 +
  101.15 +/**
  101.16 + *
  101.17 + */
  101.18 +public abstract class Input {
  101.19 +
  101.20 +    Input() {
  101.21 +        
  101.22 +    }
  101.23 +    
  101.24 +    public abstract boolean getBooleanValue();
  101.25 +    
  101.26 +    public abstract double getRealValue();
  101.27 +    
  101.28 +}
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/NotOperation.java	Sat Jun 14 09:52:45 2008 +0200
   102.3 @@ -0,0 +1,33 @@
   102.4 +/*
   102.5 + * NotOperation.java
   102.6 + *
   102.7 + * Created on July 12, 2006, 2:35 PM
   102.8 + *
   102.9 + * To change this template, choose Tools | Template Manager
  102.10 + * and open the template in the editor.
  102.11 + */
  102.12 +
  102.13 +package org.netbeans.apifest.boolcircuit;
  102.14 +
  102.15 +/**
  102.16 + *
  102.17 + */
  102.18 +final class NotOperation extends Operation {
  102.19 +
  102.20 +    private Input input;
  102.21 +    
  102.22 +    /** Creates a new instance of NotOperation */
  102.23 +    NotOperation(Input input) {
  102.24 +        this.input = input;
  102.25 +    }
  102.26 +
  102.27 +    public boolean performBooleanOperation() {
  102.28 +        return !input.getBooleanValue();
  102.29 +    }
  102.30 +
  102.31 +    public double performRealOperation() {
  102.32 +        return 1f - input.getRealValue();
  102.33 +    }
  102.34 +    
  102.35 +    
  102.36 +}
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Operation.java	Sat Jun 14 09:52:45 2008 +0200
   103.3 @@ -0,0 +1,35 @@
   103.4 +/*
   103.5 + * Operation.java
   103.6 + *
   103.7 + * Created on July 12, 2006, 2:26 PM
   103.8 + *
   103.9 + * To change this template, choose Tools | Template Manager
  103.10 + * and open the template in the editor.
  103.11 + */
  103.12 +
  103.13 +package org.netbeans.apifest.boolcircuit;
  103.14 +
  103.15 +/**
  103.16 + *
  103.17 + */
  103.18 +public abstract class Operation {
  103.19 +
  103.20 +    private boolean used;
  103.21 +    
  103.22 +    /** Creates a new instance of Operation */
  103.23 +    protected Operation() {
  103.24 +    }
  103.25 +    
  103.26 +    public abstract boolean performBooleanOperation();
  103.27 +    
  103.28 +    final void markOperationAsUsed() {
  103.29 +        used = true;
  103.30 +    }
  103.31 +    
  103.32 +    final boolean isUsed() {
  103.33 +        return used;
  103.34 +    }
  103.35 +
  103.36 +    public abstract double performRealOperation();
  103.37 +    
  103.38 +}
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/OperationInput.java	Sat Jun 14 09:52:45 2008 +0200
   104.3 @@ -0,0 +1,30 @@
   104.4 +/*
   104.5 + * OperationInput.java
   104.6 + *
   104.7 + * Created on July 12, 2006, 2:32 PM
   104.8 + *
   104.9 + * To change this template, choose Tools | Template Manager
  104.10 + * and open the template in the editor.
  104.11 + */
  104.12 +
  104.13 +package org.netbeans.apifest.boolcircuit;
  104.14 +
  104.15 +/**
  104.16 + *
  104.17 + */
  104.18 +final class OperationInput extends Input {
  104.19 +    private Operation operation;
  104.20 +    /** Creates a new instance of OperationInput */
  104.21 +    public OperationInput(Operation oper) {
  104.22 +        operation = oper;
  104.23 +    }
  104.24 +
  104.25 +    public boolean getBooleanValue() {
  104.26 +        return operation.performBooleanOperation();
  104.27 +    }
  104.28 +
  104.29 +    public double getRealValue() {
  104.30 +        return operation.performRealOperation();
  104.31 +    }
  104.32 +    
  104.33 +}
   105.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/OrOperation.java	Sat Jun 14 09:52:45 2008 +0200
   105.3 @@ -0,0 +1,35 @@
   105.4 +/*
   105.5 + * OrOperation.java
   105.6 + *
   105.7 + * Created on July 12, 2006, 2:34 PM
   105.8 + *
   105.9 + * To change this template, choose Tools | Template Manager
  105.10 + * and open the template in the editor.
  105.11 + */
  105.12 +
  105.13 +package org.netbeans.apifest.boolcircuit;
  105.14 +
  105.15 +/**
  105.16 + *
  105.17 + */
  105.18 +final class OrOperation extends Operation {
  105.19 +    
  105.20 +    private Input input1;
  105.21 +
  105.22 +    private Input input2;
  105.23 +    
  105.24 +    /** Creates a new instance of orOperation */
  105.25 +    OrOperation(Input in1, Input in2) {
  105.26 +        input1 = in1;
  105.27 +        input2 = in2;
  105.28 +    }
  105.29 +
  105.30 +    public boolean performBooleanOperation() {
  105.31 +        return input1.getBooleanValue() || input2.getBooleanValue();
  105.32 +    }
  105.33 +
  105.34 +    public double performRealOperation() {
  105.35 +        return 1 - ( 1 - input1.getRealValue()) * (1 - input2.getRealValue());
  105.36 +    }
  105.37 +    
  105.38 +}
   106.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   106.2 +++ b/samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/VariableInput.java	Sat Jun 14 09:52:45 2008 +0200
   106.3 @@ -0,0 +1,44 @@
   106.4 +/*
   106.5 + * VariableInput.java
   106.6 + *
   106.7 + * Created on July 13, 2006, 3:02 PM
   106.8 + *
   106.9 + * To change this template, choose Tools | Template Manager
  106.10 + * and open the template in the editor.
  106.11 + */
  106.12 +
  106.13 +package org.netbeans.apifest.boolcircuit;
  106.14 +
  106.15 +/**
  106.16 + *
  106.17 + * @author mkleint
  106.18 + */
  106.19 +public final class VariableInput extends Input {
  106.20 +    
  106.21 +    private double value;
  106.22 +    
  106.23 +    /** Creates a new instance of VariableInput */
  106.24 +    VariableInput() {
  106.25 +        value = 0f;
  106.26 +    }
  106.27 +    
  106.28 +    public void setBooleanValue(boolean bool) {
  106.29 +        value = bool ? 1d : 0d;
  106.30 +    }
  106.31 +    
  106.32 +    public boolean getBooleanValue() {
  106.33 +        return value == 1d;
  106.34 +    }
  106.35 +
  106.36 +    public double getRealValue() {
  106.37 +        return value;
  106.38 +    }
  106.39 +    
  106.40 +    public void setRealValue(double real) throws IllegalArgumentException {
  106.41 +        if (real < 0d || real > 1d) {
  106.42 +            throw new IllegalArgumentException();
  106.43 +        };
  106.44 +        value = real;
  106.45 +    }
  106.46 +    
  106.47 +}
   107.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.2 +++ b/samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   107.3 @@ -0,0 +1,116 @@
   107.4 +/*
   107.5 + * The contents of this file are subject to the terms of the Common Development
   107.6 + * and Distribution License (the License). You may not use this file except in
   107.7 + * compliance with the License.
   107.8 + *
   107.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  107.10 + * or http://www.netbeans.org/cddl.txt.
  107.11 + *
  107.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  107.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  107.14 + * If applicable, add the following below the CDDL Header, with the fields
  107.15 + * enclosed by brackets [] replaced by your own identifying information:
  107.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  107.17 + *
  107.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  107.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  107.20 + * Microsystems, Inc. All Rights Reserved.
  107.21 + */
  107.22 +
  107.23 +package org.netbeans.apifest.boolcircuit;
  107.24 +
  107.25 +import java.security.CodeSource;
  107.26 +import java.security.Permission;
  107.27 +import java.security.PermissionCollection;
  107.28 +import java.security.Policy;
  107.29 +import java.util.Collection;
  107.30 +import java.util.Collections;
  107.31 +import java.util.Enumeration;
  107.32 +import junit.framework.TestCase;
  107.33 +import junit.framework.*;
  107.34 +
  107.35 +/** The initial quest for this APIFest is to create an API for boolean 
  107.36 + * circuits. Such API shall be able to compose a boolean circuit from
  107.37 + * basic elements and evaluate the result given initial values for 
  107.38 + * input variables.
  107.39 + * <p>
  107.40 + * The basic elements include:
  107.41 + * <ul>
  107.42 + *   <li>negation - has one input and one output and changes 0 on input to 
  107.43 + *          on output 1 and 1 to 0
  107.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
  107.45 + *          inputs are 1, otherwise it is 0
  107.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
  107.47 + *          in the case when both inputs are 0
  107.48 + * </ul>
  107.49 + *
  107.50 + * <p>
  107.51 + * The boolean circuit can be used to represent boolean formulas and compute
  107.52 + * the results for certain values of its inputs. The individual tasks described
  107.53 + * as tests bellow.
  107.54 + *
  107.55 + * <p>
  107.56 + * Links of interest:
  107.57 + * <ul>
  107.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
  107.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
  107.60 + * </ul>
  107.61 + */
  107.62 +public class CircuitTest extends TestCase {
  107.63 +    static {
  107.64 +        // your code shall run without any permissions
  107.65 +    }
  107.66 +    
  107.67 +    Input inTrue;
  107.68 +    Input inFalse;
  107.69 +    public CircuitTest(String testName) {
  107.70 +        super(testName);
  107.71 +    }
  107.72 +
  107.73 +    
  107.74 +    /** 
  107.75 +     * Create a circuit to evaluate x1 and x2 and then
  107.76 +     * verify that its result is false for input (false, true) and
  107.77 +     * it is true for input (true, true).
  107.78 +     */
  107.79 +    public void testX1andX2() {
  107.80 +        inTrue = Factory.createSimpleBooleanInput(true);
  107.81 +        inFalse = Factory.createSimpleBooleanInput(false);
  107.82 +        Operation op1 = Factory.createAndOperation(inFalse, inTrue);
  107.83 +        assertFalse(Circuit.evaluateBooleanOperation(op1));
  107.84 +        Operation op2 = Factory.createAndOperation(inTrue, inTrue);
  107.85 +        assertTrue(Circuit.evaluateBooleanOperation(op2));
  107.86 +    }
  107.87 +    
  107.88 +    /** 
  107.89 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  107.90 +     * verify that its result is false for input (false, true, false) and
  107.91 +     * it is true for input (false, false, true).
  107.92 +     */
  107.93 +    public void testX1andX2orX3() {
  107.94 +        inTrue = Factory.createSimpleBooleanInput(true);
  107.95 +        inFalse = Factory.createSimpleBooleanInput(false);
  107.96 +        Operation op1 = Factory.createAndOperation(inFalse, inTrue);
  107.97 +        Operation op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inFalse);
  107.98 +        assertFalse(Circuit.evaluateBooleanOperation(op2));
  107.99 +        
 107.100 +        op1 = Factory.createAndOperation(inFalse, inFalse);
 107.101 +        op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inTrue);
 107.102 +        assertTrue(Circuit.evaluateBooleanOperation(op2));
 107.103 +    }
 107.104 +    /** 
 107.105 +     * Create a circuit to evaluate (x1 or not(x1)) and then
 107.106 +     * verify that its result is true for all values of x1.
 107.107 +     */
 107.108 +    public void testAlwaysTrue() {
 107.109 +        inTrue = Factory.createSimpleBooleanInput(true);
 107.110 +        inFalse = Factory.createSimpleBooleanInput(false);
 107.111 +        Operation not = Factory.createNotOperation(inTrue);
 107.112 +        Operation or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inTrue);
 107.113 +        assertTrue(Circuit.evaluateBooleanOperation(or));
 107.114 +        not = Factory.createNotOperation(inFalse);
 107.115 +        or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inFalse);
 107.116 +        assertTrue(Circuit.evaluateBooleanOperation(or));
 107.117 +    }
 107.118 +    
 107.119 +}
   108.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.2 +++ b/samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
   108.3 @@ -0,0 +1,191 @@
   108.4 +/*
   108.5 + * The contents of this file are subject to the terms of the Common Development
   108.6 + * and Distribution License (the License). You may not use this file except in
   108.7 + * compliance with the License.
   108.8 + *
   108.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  108.10 + * or http://www.netbeans.org/cddl.txt.
  108.11 + *
  108.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  108.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  108.14 + * If applicable, add the following below the CDDL Header, with the fields
  108.15 + * enclosed by brackets [] replaced by your own identifying information:
  108.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  108.17 + *
  108.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  108.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  108.20 + * Microsystems, Inc. All Rights Reserved.
  108.21 + */
  108.22 +
  108.23 +package org.netbeans.apifest.boolcircuit;
  108.24 +
  108.25 +import java.security.CodeSource;
  108.26 +import java.security.Permission;
  108.27 +import java.security.PermissionCollection;
  108.28 +import java.security.Policy;
  108.29 +import java.util.Collection;
  108.30 +import java.util.Collections;
  108.31 +import java.util.Enumeration;
  108.32 +import junit.framework.TestCase;
  108.33 +import junit.framework.*;
  108.34 +
  108.35 +/** This file contains the APIFest quest for day 2. Simply, turn the 
  108.36 + * boolean circuit into circuit that can compute with double values from 0 to 1.
  108.37 + * <p>
  108.38 + * This means that where ever a boolean was used to represent input or 
  108.39 + * output values, one can now use any double number from >= 0 and <= 1.
  108.40 + * Still, to support backward compatibility, the operations with booleans
  108.41 + * has to be kept available and have to work. In fact False shall be 
  108.42 + * treated as 0 and True as 1.
  108.43 + * <p>
  108.44 + * The basic elements has to be modified to work on doubles in the following
  108.45 + * way:
  108.46 + * <ul>
  108.47 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
  108.48 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
  108.49 + *             and(false,true)=0*1=0=false
  108.50 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
  108.51 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
  108.52 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
  108.53 + * </ul>
  108.54 + * <p>
  108.55 + * However as the circuits with doubles are more rich than plain boolean circuits,
  108.56 + * there is additional requirement to allow any user of your API to write its 
  108.57 + * own "element" type. This is all going to be exercise in the tests bellow
  108.58 + * which you are supposed to implement.
  108.59 + */
  108.60 +public class RealTest extends TestCase {
  108.61 +    static {
  108.62 +        // your code shall run without any permissions
  108.63 +    }
  108.64 +    
  108.65 +    public RealTest(String testName) {
  108.66 +        super(testName);
  108.67 +    }
  108.68 +
  108.69 +    protected void setUp() throws Exception {
  108.70 +    }
  108.71 +
  108.72 +    protected void tearDown() throws Exception {
  108.73 +    }
  108.74 +    
  108.75 +    
  108.76 +    /** First of all create a circuit which will evaluate
  108.77 +     * expression (X1 and X2) or not(x1). Hold the circuit
  108.78 +     * in some variable.
  108.79 +     *
  108.80 +     * Feed this circuit with x1=true, x2=false, assert result is false
  108.81 +     *
  108.82 +     * Feed the same circuit with x1=false, x2=true, assert result is true
  108.83 +     *
  108.84 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
  108.85 +     *
  108.86 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
  108.87 +     *
  108.88 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
  108.89 +     */
  108.90 +    public void testX1andX2orNotX1() {
  108.91 +        VariableInput x1 = Factory.createVariableInput();
  108.92 +        VariableInput x2 = Factory.createVariableInput();
  108.93 +        Operation and = Factory.createAndOperation(x1, x2);
  108.94 +        Operation not = Factory.createNotOperation(x1);
  108.95 +        Operation or = Factory.createOrOperation(Factory.createOperationBasedInput(and), Factory.createOperationBasedInput(not));
  108.96 +        
  108.97 +        x1.setBooleanValue(false);
  108.98 +        x2.setBooleanValue(true);
  108.99 +        assertTrue(Circuit.evaluateBooleanOperation(or));
 108.100 +        
 108.101 +        x1.setRealValue(0.0);
 108.102 +        x2.setRealValue(1.0);
 108.103 +        assertEquals(1.0, Circuit.evaluateRealOperation(or));
 108.104 +        
 108.105 +        x1.setRealValue(0.5);
 108.106 +        x2.setRealValue(0.5);
 108.107 +        assertEquals(0.625, Circuit.evaluateRealOperation(or));
 108.108 +        
 108.109 +        try {
 108.110 +            x1.setRealValue(0.0);
 108.111 +            x2.setRealValue(2.0);
 108.112 +            Circuit.evaluateRealOperation(or);
 108.113 +            fail();
 108.114 +        } catch (IllegalArgumentException exc) {
 108.115 +            //good..
 108.116 +        }
 108.117 +
 108.118 +    }
 108.119 +    
 108.120 +    /** Ensure that one variable cannot be filled with two different values.
 108.121 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
 108.122 +     * API that would not lead to x1 * x1 result, an exception is thrown.
 108.123 +     * For example if there was a way to feed the circuit with two different 
 108.124 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
 108.125 +     * improper use of the circuit.
 108.126 +     */
 108.127 +    public void testImproperUseOfTheCircuit() {
 108.128 +
 108.129 +        // this is enforced by the setter on the VariableInput.. how to test??
 108.130 +        
 108.131 +        
 108.132 +        
 108.133 +//        fail("task2");
 108.134 +        // PS: This request is based on observation that some API from day1
 108.135 +        // solved the multiple usage of one variable, by repeating its 
 108.136 +        // value multiple times. This tasks says that if this is case of
 108.137 +        // your API you must make sure, when that usage of different values
 108.138 +        // for one variable is prohibited. If there is no way in your API to
 108.139 +        // express this task, just say so, and you do not need to write a test.
 108.140 +        // However if anyone else finds a way to simulate such situation in your
 108.141 +        // API later, it will get points for breaking your API.
 108.142 +    }
 108.143 +    
 108.144 +    /** Write your own element type called "gte" that will have two inputs and one output.
 108.145 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
 108.146 +     * 
 108.147 +     * Create 
 108.148 +     * circuit for following expression: (x1 and not(x1)) gte x1
 108.149 +     *
 108.150 +     * Feed the circuit with 0.5 and verify the result is 0
 108.151 +     *
 108.152 +     * Feed the same circuit with 1 and verify the result is 0
 108.153 +     *
 108.154 +     * Feed the same circuit with 0 and verify the result is 1
 108.155 +     */
 108.156 +    public void testGreaterThanEqualElement() {
 108.157 +        VariableInput x1 = Factory.createVariableInput();
 108.158 +        Operation not = Factory.createNotOperation(x1);
 108.159 +        Operation and = Factory.createAndOperation(x1, Factory.createOperationBasedInput(not));
 108.160 +        Operation gte = new GTEOperation(Factory.createOperationBasedInput(and), x1);
 108.161 +        
 108.162 +        x1.setRealValue(0.5);
 108.163 +        assertEquals(0.0, Circuit.evaluateRealOperation(gte));
 108.164 +        
 108.165 +        x1.setRealValue(1.0);
 108.166 +        assertEquals(0.0, Circuit.evaluateRealOperation(gte));
 108.167 +        
 108.168 +        x1.setRealValue(0.0);
 108.169 +        assertEquals(1.0, Circuit.evaluateRealOperation(gte));
 108.170 +        
 108.171 +    }
 108.172 +    
 108.173 +    private final class GTEOperation extends Operation {
 108.174 +
 108.175 +        private Input input2;
 108.176 +
 108.177 +        private Input input1;
 108.178 +        
 108.179 +        public GTEOperation(Input in1, Input in2) {
 108.180 +            super();
 108.181 +            input1 = in1;
 108.182 +            input2 = in2;
 108.183 +        }
 108.184 +        
 108.185 +        public boolean performBooleanOperation() {
 108.186 +            return input1.getRealValue() >= input2.getRealValue();
 108.187 +        }
 108.188 +
 108.189 +        public double performRealOperation() {
 108.190 +            return (input1.getRealValue() >= input2.getRealValue()) ? 1.0 : 0.0;
 108.191 +        }
 108.192 +        
 108.193 +    }
 108.194 +}
   109.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.2 +++ b/samples/apifest1/day2/pinbasedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
   109.3 @@ -0,0 +1,69 @@
   109.4 +<?xml version="1.0" encoding="UTF-8"?>
   109.5 +<!-- You may freely edit this file. See commented blocks below for -->
   109.6 +<!-- some examples of how to customize the build. -->
   109.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   109.8 +<project name="pinbasedsolution" default="default" basedir=".">
   109.9 +    <description>Builds, tests, and runs the project pinbasedsolution.</description>
  109.10 +    <import file="nbproject/build-impl.xml"/>
  109.11 +    <!--
  109.12 +
  109.13 +    There exist several targets which are by default empty and which can be 
  109.14 +    used for execution of your tasks. These targets are usually executed 
  109.15 +    before and after some main targets. They are: 
  109.16 +
  109.17 +      -pre-init:                 called before initialization of project properties
  109.18 +      -post-init:                called after initialization of project properties
  109.19 +      -pre-compile:              called before javac compilation
  109.20 +      -post-compile:             called after javac compilation
  109.21 +      -pre-compile-single:       called before javac compilation of single file
  109.22 +      -post-compile-single:      called after javac compilation of single file
  109.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  109.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  109.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  109.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  109.27 +      -pre-jar:                  called before JAR building
  109.28 +      -post-jar:                 called after JAR building
  109.29 +      -post-clean:               called after cleaning build products
  109.30 +
  109.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  109.32 +
  109.33 +    Example of inserting an obfuscator after compilation could look like this:
  109.34 +
  109.35 +        <target name="-post-compile">
  109.36 +            <obfuscate>
  109.37 +                <fileset dir="${build.classes.dir}"/>
  109.38 +            </obfuscate>
  109.39 +        </target>
  109.40 +
  109.41 +    For list of available properties check the imported 
  109.42 +    nbproject/build-impl.xml file. 
  109.43 +
  109.44 +
  109.45 +    Another way to customize the build is by overriding existing main targets.
  109.46 +    The targets of interest are: 
  109.47 +
  109.48 +      -init-macrodef-javac:     defines macro for javac compilation
  109.49 +      -init-macrodef-junit:     defines macro for junit execution
  109.50 +      -init-macrodef-debug:     defines macro for class debugging
  109.51 +      -init-macrodef-java:      defines macro for class execution
  109.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  109.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  109.54 +      run:                      execution of project 
  109.55 +      -javadoc-build:           Javadoc generation
  109.56 +      test-report:              JUnit report generation
  109.57 +
  109.58 +    An example of overriding the target for project execution could look like this:
  109.59 +
  109.60 +        <target name="run" depends="pinbasedsolution-impl.jar">
  109.61 +            <exec dir="bin" executable="launcher.exe">
  109.62 +                <arg file="${dist.jar}"/>
  109.63 +            </exec>
  109.64 +        </target>
  109.65 +
  109.66 +    Notice that the overridden target depends on the jar target and not only on 
  109.67 +    the compile target as the regular run target does. Again, for a list of available 
  109.68 +    properties which you can use, check the target you are overriding in the
  109.69 +    nbproject/build-impl.xml file. 
  109.70 +
  109.71 +    -->
  109.72 +</project>
   110.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.2 +++ b/samples/apifest1/day2/pinbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
   110.3 @@ -0,0 +1,547 @@
   110.4 +<?xml version="1.0" encoding="UTF-8"?>
   110.5 +<!--
   110.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   110.7 +***         EDIT ../build.xml INSTEAD         ***
   110.8 +
   110.9 +For the purpose of easier reading the script
  110.10 +is divided into following sections:
  110.11 +
  110.12 +  - initialization
  110.13 +  - compilation
  110.14 +  - jar
  110.15 +  - execution
  110.16 +  - debugging
  110.17 +  - javadoc
  110.18 +  - junit compilation
  110.19 +  - junit execution
  110.20 +  - junit debugging
  110.21 +  - applet
  110.22 +  - cleanup
  110.23 +
  110.24 +-->
  110.25 +<project name="pinbasedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
  110.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
  110.27 +    <!-- 
  110.28 +    ======================
  110.29 +    INITIALIZATION SECTION 
  110.30 +    ======================
  110.31 +    -->
  110.32 +    <target name="-pre-init">
  110.33 +        <!-- Empty placeholder for easier customization. -->
  110.34 +        <!-- You can override this target in the ../build.xml file. -->
  110.35 +    </target>
  110.36 +    <target name="-init-private" depends="-pre-init">
  110.37 +        <property file="nbproject/private/private.properties"/>
  110.38 +    </target>
  110.39 +    <target name="-init-user" depends="-pre-init,-init-private">
  110.40 +        <property file="${user.properties.file}"/>
  110.41 +        <!-- The two properties below are usually overridden -->
  110.42 +        <!-- by the active platform. Just a fallback. -->
  110.43 +        <property name="default.javac.source" value="1.4"/>
  110.44 +        <property name="default.javac.target" value="1.4"/>
  110.45 +    </target>
  110.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
  110.47 +        <property file="nbproject/project.properties"/>
  110.48 +    </target>
  110.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
  110.50 +        <available file="${manifest.file}" property="manifest.available"/>
  110.51 +        <condition property="manifest.available+main.class">
  110.52 +            <and>
  110.53 +                <isset property="manifest.available"/>
  110.54 +                <isset property="main.class"/>
  110.55 +                <not>
  110.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  110.57 +                </not>
  110.58 +            </and>
  110.59 +        </condition>
  110.60 +        <condition property="manifest.available+main.class+mkdist.available">
  110.61 +            <and>
  110.62 +                <istrue value="${manifest.available+main.class}"/>
  110.63 +                <isset property="libs.CopyLibs.classpath"/>
  110.64 +            </and>
  110.65 +        </condition>
  110.66 +        <condition property="have.tests">
  110.67 +            <or>
  110.68 +                <available file="${test.src.dir}"/>
  110.69 +            </or>
  110.70 +        </condition>
  110.71 +        <condition property="have.sources">
  110.72 +            <or>
  110.73 +                <available file="${src.dir}"/>
  110.74 +            </or>
  110.75 +        </condition>
  110.76 +        <condition property="netbeans.home+have.tests">
  110.77 +            <and>
  110.78 +                <isset property="netbeans.home"/>
  110.79 +                <isset property="have.tests"/>
  110.80 +            </and>
  110.81 +        </condition>
  110.82 +        <condition property="no.javadoc.preview">
  110.83 +            <isfalse value="${javadoc.preview}"/>
  110.84 +        </condition>
  110.85 +        <property name="run.jvmargs" value=""/>
  110.86 +        <property name="javac.compilerargs" value=""/>
  110.87 +        <property name="work.dir" value="${basedir}"/>
  110.88 +        <condition property="no.deps">
  110.89 +            <and>
  110.90 +                <istrue value="${no.dependencies}"/>
  110.91 +            </and>
  110.92 +        </condition>
  110.93 +        <property name="javac.debug" value="true"/>
  110.94 +        <property name="javadoc.preview" value="true"/>
  110.95 +        <property name="application.args" value=""/>
  110.96 +    </target>
  110.97 +    <target name="-post-init">
  110.98 +        <!-- Empty placeholder for easier customization. -->
  110.99 +        <!-- You can override this target in the ../build.xml file. -->
 110.100 +    </target>
 110.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
 110.102 +        <fail unless="src.dir">Must set src.dir</fail>
 110.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 110.104 +        <fail unless="build.dir">Must set build.dir</fail>
 110.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
 110.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 110.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 110.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 110.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 110.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 110.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
 110.112 +    </target>
 110.113 +    <target name="-init-macrodef-property">
 110.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 110.115 +            <attribute name="name"/>
 110.116 +            <attribute name="value"/>
 110.117 +            <sequential>
 110.118 +                <property name="@{name}" value="${@{value}}"/>
 110.119 +            </sequential>
 110.120 +        </macrodef>
 110.121 +    </target>
 110.122 +    <target name="-init-macrodef-javac">
 110.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 110.124 +            <attribute name="srcdir" default="${src.dir}"/>
 110.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
 110.126 +            <attribute name="classpath" default="${javac.classpath}"/>
 110.127 +            <attribute name="debug" default="${javac.debug}"/>
 110.128 +            <element name="customize" optional="true"/>
 110.129 +            <sequential>
 110.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
 110.131 +                    <classpath>
 110.132 +                        <path path="@{classpath}"/>
 110.133 +                    </classpath>
 110.134 +                </depend>
 110.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
 110.136 +                    <classpath>
 110.137 +                        <path path="@{classpath}"/>
 110.138 +                    </classpath>
 110.139 +                    <compilerarg line="${javac.compilerargs}"/>
 110.140 +                    <customize/>
 110.141 +                </javac>
 110.142 +            </sequential>
 110.143 +        </macrodef>
 110.144 +    </target>
 110.145 +    <target name="-init-macrodef-junit">
 110.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 110.147 +            <attribute name="includes" default="**/*Test.java"/>
 110.148 +            <sequential>
 110.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
 110.150 +                    <batchtest todir="${build.test.results.dir}">
 110.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
 110.152 +                    </batchtest>
 110.153 +                    <classpath>
 110.154 +                        <path path="${run.test.classpath}"/>
 110.155 +                    </classpath>
 110.156 +                    <syspropertyset>
 110.157 +                        <propertyref prefix="test-sys-prop."/>
 110.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
 110.159 +                    </syspropertyset>
 110.160 +                    <formatter type="brief" usefile="false"/>
 110.161 +                    <formatter type="xml"/>
 110.162 +                    <jvmarg line="${run.jvmargs}"/>
 110.163 +                </junit>
 110.164 +            </sequential>
 110.165 +        </macrodef>
 110.166 +    </target>
 110.167 +    <target name="-init-macrodef-nbjpda">
 110.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 110.169 +            <attribute name="name" default="${main.class}"/>
 110.170 +            <attribute name="classpath" default="${debug.classpath}"/>
 110.171 +            <attribute name="stopclassname" default=""/>
 110.172 +            <sequential>
 110.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
 110.174 +                    <classpath>
 110.175 +                        <path path="@{classpath}"/>
 110.176 +                    </classpath>
 110.177 +                </nbjpdastart>
 110.178 +            </sequential>
 110.179 +        </macrodef>
 110.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 110.181 +            <attribute name="dir" default="${build.classes.dir}"/>
 110.182 +            <sequential>
 110.183 +                <nbjpdareload>
 110.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
 110.185 +                </nbjpdareload>
 110.186 +            </sequential>
 110.187 +        </macrodef>
 110.188 +    </target>
 110.189 +    <target name="-init-macrodef-debug">
 110.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 110.191 +            <attribute name="classname" default="${main.class}"/>
 110.192 +            <attribute name="classpath" default="${debug.classpath}"/>
 110.193 +            <element name="customize" optional="true"/>
 110.194 +            <sequential>
 110.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 110.196 +                    <jvmarg value="-Xdebug"/>
 110.197 +                    <jvmarg value="-Xnoagent"/>
 110.198 +                    <jvmarg value="-Djava.compiler=none"/>
 110.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
 110.200 +                    <jvmarg line="${run.jvmargs}"/>
 110.201 +                    <classpath>
 110.202 +                        <path path="@{classpath}"/>
 110.203 +                    </classpath>
 110.204 +                    <syspropertyset>
 110.205 +                        <propertyref prefix="run-sys-prop."/>
 110.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 110.207 +                    </syspropertyset>
 110.208 +                    <customize/>
 110.209 +                </java>
 110.210 +            </sequential>
 110.211 +        </macrodef>
 110.212 +    </target>
 110.213 +    <target name="-init-macrodef-java">
 110.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 110.215 +            <attribute name="classname" default="${main.class}"/>
 110.216 +            <element name="customize" optional="true"/>
 110.217 +            <sequential>
 110.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 110.219 +                    <jvmarg line="${run.jvmargs}"/>
 110.220 +                    <classpath>
 110.221 +                        <path path="${run.classpath}"/>
 110.222 +                    </classpath>
 110.223 +                    <syspropertyset>
 110.224 +                        <propertyref prefix="run-sys-prop."/>
 110.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 110.226 +                    </syspropertyset>
 110.227 +                    <customize/>
 110.228 +                </java>
 110.229 +            </sequential>
 110.230 +        </macrodef>
 110.231 +    </target>
 110.232 +    <target name="-init-presetdef-jar">
 110.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 110.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
 110.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 110.236 +            </jar>
 110.237 +        </presetdef>
 110.238 +    </target>
 110.239 +    <target name="init" 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"/>
 110.240 +    <!--
 110.241 +    ===================
 110.242 +    COMPILATION SECTION
 110.243 +    ===================
 110.244 +    -->
 110.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
 110.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
 110.247 +        <mkdir dir="${build.classes.dir}"/>
 110.248 +    </target>
 110.249 +    <target name="-pre-compile">
 110.250 +        <!-- Empty placeholder for easier customization. -->
 110.251 +        <!-- You can override this target in the ../build.xml file. -->
 110.252 +    </target>
 110.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
 110.254 +        <j2seproject3:javac/>
 110.255 +        <copy todir="${build.classes.dir}">
 110.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
 110.257 +        </copy>
 110.258 +    </target>
 110.259 +    <target name="-post-compile">
 110.260 +        <!-- Empty placeholder for easier customization. -->
 110.261 +        <!-- You can override this target in the ../build.xml file. -->
 110.262 +    </target>
 110.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
 110.264 +    <target name="-pre-compile-single">
 110.265 +        <!-- Empty placeholder for easier customization. -->
 110.266 +        <!-- You can override this target in the ../build.xml file. -->
 110.267 +    </target>
 110.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
 110.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 110.270 +        <j2seproject3:javac>
 110.271 +            <customize>
 110.272 +                <patternset includes="${javac.includes}"/>
 110.273 +            </customize>
 110.274 +        </j2seproject3:javac>
 110.275 +    </target>
 110.276 +    <target name="-post-compile-single">
 110.277 +        <!-- Empty placeholder for easier customization. -->
 110.278 +        <!-- You can override this target in the ../build.xml file. -->
 110.279 +    </target>
 110.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
 110.281 +    <!--
 110.282 +    ====================
 110.283 +    JAR BUILDING SECTION
 110.284 +    ====================
 110.285 +    -->
 110.286 +    <target name="-pre-pre-jar" depends="init">
 110.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
 110.288 +        <mkdir dir="${dist.jar.dir}"/>
 110.289 +    </target>
 110.290 +    <target name="-pre-jar">
 110.291 +        <!-- Empty placeholder for easier customization. -->
 110.292 +        <!-- You can override this target in the ../build.xml file. -->
 110.293 +    </target>
 110.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
 110.295 +        <j2seproject1:jar/>
 110.296 +    </target>
 110.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
 110.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
 110.299 +    </target>
 110.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
 110.301 +        <j2seproject1:jar manifest="${manifest.file}">
 110.302 +            <j2seproject1:manifest>
 110.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 110.304 +            </j2seproject1:manifest>
 110.305 +        </j2seproject1:jar>
 110.306 +        <echo>To run this application from the command line without Ant, try:</echo>
 110.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 110.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 110.309 +        <pathconvert property="run.classpath.with.dist.jar">
 110.310 +            <path path="${run.classpath}"/>
 110.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 110.312 +        </pathconvert>
 110.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 110.314 +    </target>
 110.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
 110.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 110.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
 110.318 +            <path path="${run.classpath}"/>
 110.319 +            <map from="${build.classes.dir.resolved}" to=""/>
 110.320 +        </pathconvert>
 110.321 +        <pathconvert property="jar.classpath" pathsep=" ">
 110.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
 110.323 +            <chainedmapper>
 110.324 +                <flattenmapper/>
 110.325 +                <globmapper from="*" to="lib/*"/>
 110.326 +            </chainedmapper>
 110.327 +        </pathconvert>
 110.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
 110.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
 110.330 +            <fileset dir="${build.classes.dir}"/>
 110.331 +            <manifest>
 110.332 +                <attribute name="Main-Class" value="${main.class}"/>
 110.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 110.334 +            </manifest>
 110.335 +        </copylibs>
 110.336 +        <echo>To run this application from the command line without Ant, try:</echo>
 110.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 110.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 110.339 +    </target>
 110.340 +    <target name="-post-jar">
 110.341 +        <!-- Empty placeholder for easier customization. -->
 110.342 +        <!-- You can override this target in the ../build.xml file. -->
 110.343 +    </target>
 110.344 +    <target name="jar" 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."/>
 110.345 +    <!--
 110.346 +    =================
 110.347 +    EXECUTION SECTION
 110.348 +    =================
 110.349 +    -->
 110.350 +    <target name="run" depends="init,compile" description="Run a main class.">
 110.351 +        <j2seproject1:java>
 110.352 +            <customize>
 110.353 +                <arg line="${application.args}"/>
 110.354 +            </customize>
 110.355 +        </j2seproject1:java>
 110.356 +    </target>
 110.357 +    <target name="run-single" depends="init,compile-single">
 110.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 110.359 +        <j2seproject1:java classname="${run.class}"/>
 110.360 +    </target>
 110.361 +    <!--
 110.362 +    =================
 110.363 +    DEBUGGING SECTION
 110.364 +    =================
 110.365 +    -->
 110.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
 110.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 110.368 +    </target>
 110.369 +    <target name="-debug-start-debuggee" depends="init,compile">
 110.370 +        <j2seproject3:debug>
 110.371 +            <customize>
 110.372 +                <arg line="${application.args}"/>
 110.373 +            </customize>
 110.374 +        </j2seproject3:debug>
 110.375 +    </target>
 110.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
 110.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
 110.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 110.379 +    </target>
 110.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
 110.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
 110.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 110.383 +        <j2seproject3:debug classname="${debug.class}"/>
 110.384 +    </target>
 110.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
 110.386 +    <target name="-pre-debug-fix" depends="init">
 110.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
 110.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
 110.389 +    </target>
 110.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
 110.391 +        <j2seproject1:nbjpdareload/>
 110.392 +    </target>
 110.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
 110.394 +    <!--
 110.395 +    ===============
 110.396 +    JAVADOC SECTION
 110.397 +    ===============
 110.398 +    -->
 110.399 +    <target name="-javadoc-build" depends="init">
 110.400 +        <mkdir dir="${dist.javadoc.dir}"/>
 110.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
 110.402 +            <classpath>
 110.403 +                <path path="${javac.classpath}"/>
 110.404 +            </classpath>
 110.405 +            <sourcepath>
 110.406 +                <pathelement location="${src.dir}"/>
 110.407 +            </sourcepath>
 110.408 +            <packageset dir="${src.dir}" includes="*/**"/>
 110.409 +            <fileset dir="${src.dir}" includes="*.java"/>
 110.410 +        </javadoc>
 110.411 +    </target>
 110.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
 110.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 110.414 +    </target>
 110.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
 110.416 +    <!--
 110.417 +    =========================
 110.418 +    JUNIT COMPILATION SECTION
 110.419 +    =========================
 110.420 +    -->
 110.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
 110.422 +        <mkdir dir="${build.test.classes.dir}"/>
 110.423 +    </target>
 110.424 +    <target name="-pre-compile-test">
 110.425 +        <!-- Empty placeholder for easier customization. -->
 110.426 +        <!-- You can override this target in the ../build.xml file. -->
 110.427 +    </target>
 110.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
 110.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
 110.430 +        <copy todir="${build.test.classes.dir}">
 110.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 110.432 +        </copy>
 110.433 +    </target>
 110.434 +    <target name="-post-compile-test">
 110.435 +        <!-- Empty placeholder for easier customization. -->
 110.436 +        <!-- You can override this target in the ../build.xml file. -->
 110.437 +    </target>
 110.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
 110.439 +    <target name="-pre-compile-test-single">
 110.440 +        <!-- Empty placeholder for easier customization. -->
 110.441 +        <!-- You can override this target in the ../build.xml file. -->
 110.442 +    </target>
 110.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
 110.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 110.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
 110.446 +            <customize>
 110.447 +                <patternset includes="${javac.includes}"/>
 110.448 +            </customize>
 110.449 +        </j2seproject3:javac>
 110.450 +        <copy todir="${build.test.classes.dir}">
 110.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 110.452 +        </copy>
 110.453 +    </target>
 110.454 +    <target name="-post-compile-test-single">
 110.455 +        <!-- Empty placeholder for easier customization. -->
 110.456 +        <!-- You can override this target in the ../build.xml file. -->
 110.457 +    </target>
 110.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
 110.459 +    <!--
 110.460 +    =======================
 110.461 +    JUNIT EXECUTION SECTION
 110.462 +    =======================
 110.463 +    -->
 110.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
 110.465 +        <mkdir dir="${build.test.results.dir}"/>
 110.466 +    </target>
 110.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
 110.468 +        <j2seproject3:junit/>
 110.469 +    </target>
 110.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
 110.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 110.472 +    </target>
 110.473 +    <target name="test-report" if="have.tests" depends="init"/>
 110.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
 110.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
 110.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
 110.477 +        <mkdir dir="${build.test.results.dir}"/>
 110.478 +    </target>
 110.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
 110.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 110.481 +        <j2seproject3:junit includes="${test.includes}"/>
 110.482 +    </target>
 110.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
 110.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 110.485 +    </target>
 110.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
 110.487 +    <!--
 110.488 +    =======================
 110.489 +    JUNIT DEBUGGING SECTION
 110.490 +    =======================
 110.491 +    -->
 110.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
 110.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 110.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
 110.495 +            <customize>
 110.496 +                <arg line="${test.class}"/>
 110.497 +            </customize>
 110.498 +        </j2seproject3:debug>
 110.499 +    </target>
 110.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
 110.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
 110.502 +    </target>
 110.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
 110.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
 110.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 110.506 +    </target>
 110.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
 110.508 +    <!--
 110.509 +    =========================
 110.510 +    APPLET EXECUTION SECTION
 110.511 +    =========================
 110.512 +    -->
 110.513 +    <target name="run-applet" depends="init,compile-single">
 110.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 110.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 110.516 +            <customize>
 110.517 +                <arg value="${applet.url}"/>
 110.518 +            </customize>
 110.519 +        </j2seproject1:java>
 110.520 +    </target>
 110.521 +    <!--
 110.522 +    =========================
 110.523 +    APPLET DEBUGGING  SECTION
 110.524 +    =========================
 110.525 +    -->
 110.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
 110.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 110.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 110.529 +            <customize>
 110.530 +                <arg value="${applet.url}"/>
 110.531 +            </customize>
 110.532 +        </j2seproject3:debug>
 110.533 +    </target>
 110.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
 110.535 +    <!--
 110.536 +    ===============
 110.537 +    CLEANUP SECTION
 110.538 +    ===============
 110.539 +    -->
 110.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
 110.541 +    <target name="-do-clean" depends="init">
 110.542 +        <delete dir="${build.dir}"/>
 110.543 +        <delete dir="${dist.dir}"/>
 110.544 +    </target>
 110.545 +    <target name="-post-clean">
 110.546 +        <!-- Empty placeholder for easier customization. -->
 110.547 +        <!-- You can override this target in the ../build.xml file. -->
 110.548 +    </target>
 110.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
 110.550 +</project>
   111.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   111.2 +++ b/samples/apifest1/day2/pinbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
   111.3 @@ -0,0 +1,8 @@
   111.4 +build.xml.data.CRC32=c2d9be31
   111.5 +build.xml.script.CRC32=09dc18c1
   111.6 +build.xml.stylesheet.CRC32=a12b3d02
   111.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   111.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   111.9 +nbproject/build-impl.xml.data.CRC32=c2d9be31
  111.10 +nbproject/build-impl.xml.script.CRC32=716bfc49
  111.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
   112.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   112.2 +++ b/samples/apifest1/day2/pinbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
   112.3 @@ -0,0 +1,56 @@
   112.4 +build.classes.dir=${build.dir}/classes
   112.5 +build.classes.excludes=**/*.java,**/*.form
   112.6 +# This directory is removed when the project is cleaned:
   112.7 +build.dir=build
   112.8 +build.generated.dir=${build.dir}/generated
   112.9 +# Only compile against the classpath explicitly listed here:
  112.10 +build.sysclasspath=ignore
  112.11 +build.test.classes.dir=${build.dir}/test/classes
  112.12 +build.test.results.dir=${build.dir}/test/results
  112.13 +debug.classpath=\
  112.14 +    ${run.classpath}
  112.15 +debug.test.classpath=\
  112.16 +    ${run.test.classpath}
  112.17 +# This directory is removed when the project is cleaned:
  112.18 +dist.dir=dist
  112.19 +dist.jar=${dist.dir}/boolcircuit.jar
  112.20 +dist.javadoc.dir=${dist.dir}/javadoc
  112.21 +jar.compress=false
  112.22 +javac.classpath=
  112.23 +# Space-separated list of extra javac options
  112.24 +javac.compilerargs=
  112.25 +javac.deprecation=false
  112.26 +javac.source=1.5
  112.27 +javac.target=1.5
  112.28 +javac.test.classpath=\
  112.29 +    ${javac.classpath}:\
  112.30 +    ${build.classes.dir}:\
  112.31 +    ${libs.junit.classpath}
  112.32 +javadoc.additionalparam=
  112.33 +javadoc.author=false
  112.34 +javadoc.encoding=
  112.35 +javadoc.noindex=false
  112.36 +javadoc.nonavbar=false
  112.37 +javadoc.notree=false
  112.38 +javadoc.private=false
  112.39 +javadoc.splitindex=true
  112.40 +javadoc.use=true
  112.41 +javadoc.version=false
  112.42 +javadoc.windowtitle=
  112.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
  112.44 +# The library definition has always preference over this property.
  112.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
  112.46 +meta.inf.dir=${src.dir}/META-INF
  112.47 +platform.active=default_platform
  112.48 +run.classpath=\
  112.49 +    ${javac.classpath}:\
  112.50 +    ${build.classes.dir}
  112.51 +# Space-separated list of JVM arguments used when running the project
  112.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  112.53 +# or test-sys-prop.name=value to set system properties for unit tests):
  112.54 +run.jvmargs=
  112.55 +run.test.classpath=\
  112.56 +    ${javac.test.classpath}:\
  112.57 +    ${build.test.classes.dir}
  112.58 +src.dir=src
  112.59 +test.src.dir=test
   113.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.2 +++ b/samples/apifest1/day2/pinbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   113.3 @@ -0,0 +1,16 @@
   113.4 +<?xml version="1.0" encoding="UTF-8"?>
   113.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   113.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   113.7 +    <configuration>
   113.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   113.9 +            <name>pinbasedsolution</name>
  113.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  113.11 +            <source-roots>
  113.12 +                <root id="src.dir"/>
  113.13 +            </source-roots>
  113.14 +            <test-roots>
  113.15 +                <root id="test.src.dir"/>
  113.16 +            </test-roots>
  113.17 +        </data>
  113.18 +    </configuration>
  113.19 +</project>
   114.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.2 +++ b/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
   114.3 @@ -0,0 +1,86 @@
   114.4 +/*
   114.5 + * The contents of this file are subject to the terms of the Common Development
   114.6 + * and Distribution License (the License). You may not use this file except in
   114.7 + * compliance with the License.
   114.8 + *
   114.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  114.10 + * or http://www.netbeans.org/cddl.txt.
  114.11 + *
  114.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  114.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  114.14 + * If applicable, add the following below the CDDL Header, with the fields
  114.15 + * enclosed by brackets [] replaced by your own identifying information:
  114.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  114.17 + *
  114.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  114.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  114.20 + * Microsystems, Inc. All Rights Reserved.
  114.21 + */
  114.22 +
  114.23 +package org.netbeans.apifest.boolcircuit;
  114.24 +
  114.25 +/**
  114.26 + * A representation of a logic circuit.
  114.27 + * It can only be constructed from an element net.
  114.28 + * Usage:
  114.29 + * <pre>
  114.30 + *  Circuit c = Circuit.construct(
  114.31 + *      Element.createOr(
  114.32 + *          Element.createAnd(
  114.33 + *              Element.createInput(0),
  114.34 + *              Element.createInput(1)
  114.35 + *          ),
  114.36 + *          Element.createInput(2)
  114.37 + *      )
  114.38 + *  );
  114.39 + *            
  114.40 + *  boolean val = c.evaluate(false, true, false));
  114.41 + * </pre>
  114.42 + */
  114.43 +public class Circuit {
  114.44 +    Element root;
  114.45 +    int pins;
  114.46 +    
  114.47 +    private Circuit(Element elem) {
  114.48 +        root = elem;
  114.49 +        pins = 1 + root.maxInput();
  114.50 +    }
  114.51 +    
  114.52 +    /**
  114.53 +     * Evaluate output of the circuit for given inputs.
  114.54 +     * For general 
  114.55 +     */
  114.56 +    public boolean evaluate(Boolean ... inputs) throws UnstableException {
  114.57 +        if (inputs.length != pins) throw new IllegalArgumentException("Wrong number of inputs, " + pins + " expected.");
  114.58 +        double[] inp = new double[pins];
  114.59 +        for (int i=0; i<pins; i++) inp[i] = inputs[i] ? 1 : 0;
  114.60 +        double res = root.evaluate(inp);
  114.61 +        return res > 0.5;
  114.62 +    }
  114.63 +
  114.64 +    public double evaluate(double ... inputs) throws UnstableException {
  114.65 +        if (inputs.length != pins) throw new IllegalArgumentException("Wrong number of inputs, " + pins + " expected.");
  114.66 +        
  114.67 +        double[] inp = new double[pins]; // defensive copy with a check
  114.68 +        for (int i=0; i<inputs.length; i++) {
  114.69 +            if (inputs[i] < 0.0 || inputs[i] > 1.0) {
  114.70 +                throw new IllegalArgumentException("Out of range, pin " + i + ", value=" + inputs[i]);
  114.71 +            }
  114.72 +            inp[i] = inputs[i];
  114.73 +        }
  114.74 +        
  114.75 +        return root.evaluate(inp);
  114.76 +    }
  114.77 +    
  114.78 +    /**
  114.79 +     * Creates a circuit from a preconstructed element net.
  114.80 +     *
  114.81 +     * @param a top-level element representing the logic net.
  114.82 +     * @return a circuit prepared for evaluating result for given inputs.
  114.83 +     * 
  114.84 +     */
  114.85 +    public static Circuit construct(Element elem) {
  114.86 +        return new Circuit(elem);
  114.87 +    }
  114.88 +    
  114.89 +}
   115.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.2 +++ b/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java	Sat Jun 14 09:52:45 2008 +0200
   115.3 @@ -0,0 +1,119 @@
   115.4 +/*
   115.5 + * Element.java
   115.6 + *
   115.7 + * Created on 12. červenec 2006, 14:14
   115.8 + *
   115.9 + * To change this template, choose Tools | Template Manager
  115.10 + * and open the template in the editor.
  115.11 + */
  115.12 +
  115.13 +package org.netbeans.apifest.boolcircuit;
  115.14 +
  115.15 +/**
  115.16 + * Representation of an element in the circuit.
  115.17 + * The internal behaviour of the element is opaque to the API user, it can only
  115.18 + * be used as a building block for logical equations, using primitive operation
  115.19 + * factories and a factory for input pin representation.
  115.20 + * Elements are chained to create the logical net. The inputs to the net are
  115.21 + * represented by the elements created by {@link #createInput(boolean[])}
  115.22 + * factory method.
  115.23 + */
  115.24 +public abstract class Element {
  115.25 +        
  115.26 +    /** Creates a new instance of Element */
  115.27 +    private Element() {
  115.28 +    }
  115.29 +    
  115.30 +    /**
  115.31 +      */
  115.32 +    abstract double evaluate(double[] inputs);
  115.33 +    
  115.34 +    abstract int maxInput();
  115.35 +    
  115.36 +    /**
  115.37 +     * Creates an Element representing 2-input AND function.
  115.38 +     *
  115.39 +     */
  115.40 +    public static Element createAnd(final Element source1, final Element source2) {
  115.41 +        return new Element() {
  115.42 +            double evaluate(double[] inputs) {
  115.43 +                return source1.evaluate(inputs) * source2.evaluate(inputs);
  115.44 +            }
  115.45 +            
  115.46 +            int maxInput() {
  115.47 +                return Math.max(source1.maxInput(), source2.maxInput());
  115.48 +            }
  115.49 +        };
  115.50 +    }
  115.51 +
  115.52 +    /**
  115.53 +     * Creates an Element representing 2-input OR function.
  115.54 +     *
  115.55 +     */
  115.56 +    public static Element createOr(final Element source1, final Element source2) {
  115.57 +        return new Element() {
  115.58 +            double evaluate(double[] inputs) {
  115.59 +                double x = source1.evaluate(inputs);
  115.60 +                double y = source2.evaluate(inputs);
  115.61 +                return 1 - (1 - x)*(1-y);
  115.62 +            }
  115.63 +            
  115.64 +            int maxInput() {
  115.65 +                return Math.max(source1.maxInput(), source2.maxInput());
  115.66 +            }
  115.67 +        };
  115.68 +    }
  115.69 +    
  115.70 +    /**
  115.71 +     * Creates an Element representing negation.
  115.72 +     *
  115.73 +     */
  115.74 +    public static Element createNot(final Element source1) {
  115.75 +        return new Element() {
  115.76 +            double evaluate(double[] inputs) {
  115.77 +                return 1 - source1.evaluate(inputs);
  115.78 +            }
  115.79 +            
  115.80 +            int maxInput() {
  115.81 +                return source1.maxInput();
  115.82 +            }
  115.83 +        };
  115.84 +    }
  115.85 +    
  115.86 +    /**
  115.87 +     * Creates an Element representing input to the logical net.
  115.88 +     *
  115.89 +     */
  115.90 +    public static Element createInput(final int pin) {
  115.91 +        return new Element() {
  115.92 +            double evaluate(double[] inputs) {
  115.93 +                return inputs[pin];
  115.94 +            }
  115.95 +            
  115.96 +            int maxInput() {
  115.97 +                return pin;
  115.98 +            }
  115.99 +        };
 115.100 +    }
 115.101 +
 115.102 +    /**
 115.103 +     * Creates an Element with user-defined transfer function.
 115.104 +     *
 115.105 +     */
 115.106 +    public static Element createGate(final Element source1, final Element source2, final Function function) {
 115.107 +        return new Element() {
 115.108 +            double evaluate(double[] inputs) {
 115.109 +                double x = source1.evaluate(inputs);
 115.110 +                double y = source2.evaluate(inputs);
 115.111 +                double result = function.evaluate(x, y);
 115.112 +                if (result < 0.0 || result > 1.0) throw new InternalError("Illegal gate function");
 115.113 +                return result;
 115.114 +            }
 115.115 +            
 115.116 +            int maxInput() {
 115.117 +                return Math.max(source1.maxInput(), source2.maxInput());
 115.118 +            }
 115.119 +        };
 115.120 +    }
 115.121 +
 115.122 +}
   116.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.2 +++ b/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Function.java	Sat Jun 14 09:52:45 2008 +0200
   116.3 @@ -0,0 +1,19 @@
   116.4 +/*
   116.5 + * Function.java
   116.6 + *
   116.7 + * Created on 13. červenec 2006, 14:40
   116.8 + *
   116.9 + * To change this template, choose Tools | Template Manager
  116.10 + * and open the template in the editor.
  116.11 + */
  116.12 +
  116.13 +package org.netbeans.apifest.boolcircuit;
  116.14 +
  116.15 +/**
  116.16 + * An abstract transfer function of a gate.
  116.17 + * @author nenik
  116.18 + */
  116.19 +public abstract class Function {
  116.20 +    
  116.21 +    public abstract double evaluate(double input1, double input2);
  116.22 +}
   117.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.2 +++ b/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/UnstableException.java	Sat Jun 14 09:52:45 2008 +0200
   117.3 @@ -0,0 +1,24 @@
   117.4 +/*
   117.5 + * UnstableException.java
   117.6 + *
   117.7 + * Created on 12. červenec 2006, 14:15
   117.8 + *
   117.9 + * To change this template, choose Tools | Template Manager
  117.10 + * and open the template in the editor.
  117.11 + */
  117.12 +
  117.13 +package org.netbeans.apifest.boolcircuit;
  117.14 +
  117.15 +/**
  117.16 + * Exception representing that the circuit is unstable for given
  117.17 + * input configuration. It can happen in case there is backward loop
  117.18 + * in the logic.
  117.19 + *
  117.20 + */
  117.21 +public class UnstableException extends Exception {
  117.22 +    
  117.23 +    /** Creates a new instance of UnstableException */
  117.24 +    public UnstableException() {
  117.25 +    }
  117.26 +    
  117.27 +}
   118.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.2 +++ b/samples/apifest1/day2/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   118.3 @@ -0,0 +1,128 @@
   118.4 +/*
   118.5 + * The contents of this file are subject to the terms of the Common Development
   118.6 + * and Distribution License (the License). You may not use this file except in
   118.7 + * compliance with the License.
   118.8 + *
   118.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  118.10 + * or http://www.netbeans.org/cddl.txt.
  118.11 + *
  118.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  118.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  118.14 + * If applicable, add the following below the CDDL Header, with the fields
  118.15 + * enclosed by brackets [] replaced by your own identifying information:
  118.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  118.17 + *
  118.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  118.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  118.20 + * Microsystems, Inc. All Rights Reserved.
  118.21 + */
  118.22 +
  118.23 +package org.netbeans.apifest.boolcircuit;
  118.24 +
  118.25 +import java.security.CodeSource;
  118.26 +import java.security.Permission;
  118.27 +import java.security.PermissionCollection;
  118.28 +import java.security.Policy;
  118.29 +import java.util.Collection;
  118.30 +import java.util.Collections;
  118.31 +import java.util.Enumeration;
  118.32 +import junit.framework.TestCase;
  118.33 +import junit.framework.*;
  118.34 +
  118.35 +/** The initial quest for this APIFest is to create an API for boolean 
  118.36 + * circuits. Such API shall be able to compose a boolean circuit from
  118.37 + * basic elements and evaluate the result given initial values for 
  118.38 + * input variables.
  118.39 + * <p>
  118.40 + * The basic elements include:
  118.41 + * <ul>
  118.42 + *   <li>negation - has one input and one output and changes 0 on input to 
  118.43 + *          on output 1 and 1 to 0
  118.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
  118.45 + *          inputs are 1, otherwise it is 0
  118.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
  118.47 + *          in the case when both inputs are 0
  118.48 + * </ul>
  118.49 + *
  118.50 + * <p>
  118.51 + * The boolean circuit can be used to represent boolean formulas and compute
  118.52 + * the results for certain values of its inputs. The individual tasks described
  118.53 + * as tests bellow.
  118.54 + *
  118.55 + * <p>
  118.56 + * Links of interest:
  118.57 + * <ul>
  118.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
  118.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
  118.60 + * </ul>
  118.61 + */
  118.62 +public class CircuitTest extends TestCase {
  118.63 +    static {
  118.64 +        // your code shall run without any permissions
  118.65 +    }
  118.66 +    
  118.67 +    public CircuitTest(String testName) {
  118.68 +        super(testName);
  118.69 +    }
  118.70 +
  118.71 +    protected void setUp() throws Exception {
  118.72 +    }
  118.73 +
  118.74 +    protected void tearDown() throws Exception {
  118.75 +    }
  118.76 +    
  118.77 +    
  118.78 +    /** 
  118.79 +     * Create a circuit to evaluate x1 and x2 and then
  118.80 +     * verify that its result is false for input (false, true) and
  118.81 +     * it is true for input (true, true).
  118.82 +     */
  118.83 +    public void testX1andX2() throws Exception {
  118.84 +        Circuit c = Circuit.construct(
  118.85 +            Element.createAnd(
  118.86 +                Element.createInput(0),
  118.87 +                Element.createInput(1)
  118.88 +            )
  118.89 +        );
  118.90 +        
  118.91 +        assertFalse ("false AND true is false", c.evaluate(false, true));
  118.92 +        assertTrue ("true AND true is true", c.evaluate(true, true));
  118.93 +    }
  118.94 +    
  118.95 +    /** 
  118.96 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  118.97 +     * verify that its result is false for input (false, true, false) and
  118.98 +     * it is true for input (false, false, true).
  118.99 +     */
 118.100 +    public void testX1andX2orX3() throws Exception {
 118.101 +        Circuit c = Circuit.construct(
 118.102 +            Element.createOr(
 118.103 +                Element.createAnd(
 118.104 +                    Element.createInput(0),
 118.105 +                    Element.createInput(1)
 118.106 +                ),
 118.107 +                Element.createInput(2)
 118.108 +            )
 118.109 +        );
 118.110 +        
 118.111 +        assertFalse ("(false AND true) OR false is false", c.evaluate(false, true, false));
 118.112 +        assertTrue ("(false AND false) OR true is true", c.evaluate(false, false, true));
 118.113 +    }
 118.114 +    
 118.115 +    /** 
 118.116 +     * Create a circuit to evaluate (x1 or not(x1)) and then
 118.117 +     * verify that its result is true for all values of x1.
 118.118 +     */
 118.119 +    public void testAlwaysTrue() throws Exception {
 118.120 +        Circuit c = Circuit.construct(
 118.121 +            Element.createOr(
 118.122 +                Element.createInput(0),
 118.123 +                Element.createNot(Element.createInput(0))
 118.124 +            )
 118.125 +        );
 118.126 +        
 118.127 +        assertTrue ("tautology is true", c.evaluate(false));
 118.128 +        assertTrue ("tautology is true", c.evaluate(true));
 118.129 +    }
 118.130 +    
 118.131 +}
   119.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   119.2 +++ b/samples/apifest1/day2/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
   119.3 @@ -0,0 +1,177 @@
   119.4 +/*
   119.5 + * The contents of this file are subject to the terms of the Common Development
   119.6 + * and Distribution License (the License). You may not use this file except in
   119.7 + * compliance with the License.
   119.8 + *
   119.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  119.10 + * or http://www.netbeans.org/cddl.txt.
  119.11 + *
  119.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  119.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  119.14 + * If applicable, add the following below the CDDL Header, with the fields
  119.15 + * enclosed by brackets [] replaced by your own identifying information:
  119.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  119.17 + *
  119.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  119.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  119.20 + * Microsystems, Inc. All Rights Reserved.
  119.21 + */
  119.22 +
  119.23 +package org.netbeans.apifest.boolcircuit;
  119.24 +
  119.25 +import java.security.CodeSource;
  119.26 +import java.security.Permission;
  119.27 +import java.security.PermissionCollection;
  119.28 +import java.security.Policy;
  119.29 +import java.util.Collection;
  119.30 +import java.util.Collections;
  119.31 +import java.util.Enumeration;
  119.32 +import junit.framework.TestCase;
  119.33 +import junit.framework.*;
  119.34 +
  119.35 +/** This file contains the APIFest quest for day 2. Simply, turn the 
  119.36 + * boolean circuit into circuit that can compute with double values from 0 to 1.
  119.37 + * <p>
  119.38 + * This means that where ever a boolean was used to represent input or 
  119.39 + * output values, one can now use any double number from >= 0 and <= 1.
  119.40 + * Still, to support backward compatibility, the operations with booleans
  119.41 + * has to be kept available and have to work. In fact False shall be 
  119.42 + * treated as 0 and True as 1.
  119.43 + * <p>
  119.44 + * The basic elements has to be modified to work on doubles in the following
  119.45 + * way:
  119.46 + * <ul>
  119.47 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
  119.48 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
  119.49 + *             and(false,true)=0*1=0=false
  119.50 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
  119.51 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
  119.52 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
  119.53 + * </ul>
  119.54 + * <p>
  119.55 + * However as the circuits with doubles are more rich than plain boolean circuits,
  119.56 + * there is additional requirement to allow any user of your API to write its 
  119.57 + * own "element" type. This is all going to be exercise in the tests bellow
  119.58 + * which you are supposed to implement.
  119.59 + */
  119.60 +public class RealTest extends TestCase {
  119.61 +    static {
  119.62 +        // your code shall run without any permissions
  119.63 +    }
  119.64 +    
  119.65 +    public RealTest(String testName) {
  119.66 +        super(testName);
  119.67 +    }
  119.68 +
  119.69 +    protected void setUp() throws Exception {
  119.70 +    }
  119.71 +
  119.72 +    protected void tearDown() throws Exception {
  119.73 +    }
  119.74 +    
  119.75 +    
  119.76 +    /** First of all create a circuit which will evaluate
  119.77 +     * expression (X1 and X2) or not(x1). Hold the circuit
  119.78 +     * in some variable.
  119.79 +     *
  119.80 +     * Feed this circuit with x1=true, x2=false, assert result is false
  119.81 +     *
  119.82 +     * Feed the same circuit with x1=false, x2=true, assert result is true
  119.83 +     *
  119.84 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
  119.85 +     *
  119.86 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
  119.87 +     *
  119.88 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
  119.89 +     */
  119.90 +    public void testX1andX2orNotX1() throws Exception {
  119.91 +        boolean fired = false;
  119.92 +
  119.93 +        Circuit c = Circuit.construct(
  119.94 +            Element.createOr(
  119.95 +                Element.createAnd(
  119.96 +                    Element.createInput(0),
  119.97 +                    Element.createInput(1)
  119.98 +                ),
  119.99 +                Element.createNot(Element.createInput(0))
 119.100 +            )
 119.101 +        );
 119.102 +        
 119.103 +        assertFalse ("false", c.evaluate(true, false));
 119.104 +        assertTrue ("true", c.evaluate(false, true));
 119.105 +        assertEquals ("1.0", 1.0, c.evaluate(0.0, 1.0));
 119.106 +        assertEquals ("0.625", 0.625, c.evaluate(0.5, 0.5));
 119.107 +        try {
 119.108 +            c.evaluate(0.0, 2.0);
 119.109 +        } catch (Exception exc) {
 119.110 +            fired = true;
 119.111 +        }
 119.112 +        assertTrue ("Fired an exception for wrong input", fired);
 119.113 +    }
 119.114 +    
 119.115 +    /** Ensure that one variable cannot be filled with two different values.
 119.116 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
 119.117 +     * API that would not lead to x1 * x1 result, an exception is thrown.
 119.118 +     * For example if there was a way to feed the circuit with two different 
 119.119 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
 119.120 +     * improper use of the circuit.
 119.121 +     */
 119.122 +    public void testImproperUseOfTheCircuit() throws Exception {
 119.123 +        final double[] inputs = new double[] {1.0};
 119.124 +        
 119.125 +        // Cheating a little bit with one more gate, but the same effect
 119.126 +        // could be obtained with (hard to achieve) thread race condition.
 119.127 +        Circuit evil = Circuit.construct(
 119.128 +            Element.createAnd(
 119.129 +                Element.createGate(
 119.130 +                    Element.createInput(0),
 119.131 +                    Element.createInput(0),
 119.132 +                    new Function() {
 119.133 +                        public double evaluate(double input1, double input2) {
 119.134 +                            inputs[0] = 0.0;
 119.135 +                            return input1*input2;
 119.136 +                        }
 119.137 +
 119.138 +                    }
 119.139 +                ),
 119.140 +                Element.createInput(0)
 119.141 +            )
 119.142 +        );
 119.143 +        assertEquals ("1 and 1 'and' 1 = 1", 1.0, evil.evaluate(inputs));
 119.144 +                
 119.145 +    }
 119.146 +    
 119.147 +    /** Write your own element type called "gte" that will have two inputs and one output.
 119.148 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
 119.149 +     * 
 119.150 +     * Create 
 119.151 +     * circuit for following expression: (x1 and not(x1)) gte x1
 119.152 +     *
 119.153 +     * Feed the circuit with 0.5 and verify the result is 0
 119.154 +     *
 119.155 +     * Feed the same circuit with 1 and verify the result is 0
 119.156 +     *
 119.157 +     * Feed the same circuit with 0 and verify the result is 1
 119.158 +     */
 119.159 +    public void testGreaterThanEqualElement() throws Exception {
 119.160 +        Circuit c = Circuit.construct(
 119.161 +            Element.createGate(
 119.162 +                Element.createAnd(
 119.163 +                    Element.createInput(0),
 119.164 +                    Element.createNot(Element.createInput(0))
 119.165 +                ),
 119.166 +                Element.createInput(0),
 119.167 +                new Function() {
 119.168 +                    public double evaluate(double input1, double input2) {
 119.169 +                        return input1 >= input2 ? 1.0 : 0.0;
 119.170 +                    }
 119.171 +
 119.172 +                }
 119.173 +            )
 119.174 +        );
 119.175 +        
 119.176 +        assertEquals ("0.0", 0.0, c.evaluate(0.5));
 119.177 +        assertEquals ("0.0", 0.0, c.evaluate(1.0));
 119.178 +        assertEquals ("1.0", 1.0, c.evaluate(0.0));
 119.179 +    }
 119.180 +}
   120.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.2 +++ b/samples/apifest1/day2/stackbasedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
   120.3 @@ -0,0 +1,69 @@
   120.4 +<?xml version="1.0" encoding="UTF-8"?>
   120.5 +<!-- You may freely edit this file. See commented blocks below for -->
   120.6 +<!-- some examples of how to customize the build. -->
   120.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   120.8 +<project name="stackbasedsolution" default="default" basedir=".">
   120.9 +    <description>Builds, tests, and runs the project stackbasedsolution.</description>
  120.10 +    <import file="nbproject/build-impl.xml"/>
  120.11 +    <!--
  120.12 +
  120.13 +    There exist several targets which are by default empty and which can be 
  120.14 +    used for execution of your tasks. These targets are usually executed 
  120.15 +    before and after some main targets. They are: 
  120.16 +
  120.17 +      -pre-init:                 called before initialization of project properties
  120.18 +      -post-init:                called after initialization of project properties
  120.19 +      -pre-compile:              called before javac compilation
  120.20 +      -post-compile:             called after javac compilation
  120.21 +      -pre-compile-single:       called before javac compilation of single file
  120.22 +      -post-compile-single:      called after javac compilation of single file
  120.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  120.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  120.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  120.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  120.27 +      -pre-jar:                  called before JAR building
  120.28 +      -post-jar:                 called after JAR building
  120.29 +      -post-clean:               called after cleaning build products
  120.30 +
  120.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  120.32 +
  120.33 +    Example of inserting an obfuscator after compilation could look like this:
  120.34 +
  120.35 +        <target name="-post-compile">
  120.36 +            <obfuscate>
  120.37 +                <fileset dir="${build.classes.dir}"/>
  120.38 +            </obfuscate>
  120.39 +        </target>
  120.40 +
  120.41 +    For list of available properties check the imported 
  120.42 +    nbproject/build-impl.xml file. 
  120.43 +
  120.44 +
  120.45 +    Another way to customize the build is by overriding existing main targets.
  120.46 +    The targets of interest are: 
  120.47 +
  120.48 +      -init-macrodef-javac:     defines macro for javac compilation
  120.49 +      -init-macrodef-junit:     defines macro for junit execution
  120.50 +      -init-macrodef-debug:     defines macro for class debugging
  120.51 +      -init-macrodef-java:      defines macro for class execution
  120.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  120.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  120.54 +      run:                      execution of project 
  120.55 +      -javadoc-build:           Javadoc generation
  120.56 +      test-report:              JUnit report generation
  120.57 +
  120.58 +    An example of overriding the target for project execution could look like this:
  120.59 +
  120.60 +        <target name="run" depends="stackbasedsolution-impl.jar">
  120.61 +            <exec dir="bin" executable="launcher.exe">
  120.62 +                <arg file="${dist.jar}"/>
  120.63 +            </exec>
  120.64 +        </target>
  120.65 +
  120.66 +    Notice that the overridden target depends on the jar target and not only on 
  120.67 +    the compile target as the regular run target does. Again, for a list of available 
  120.68 +    properties which you can use, check the target you are overriding in the
  120.69 +    nbproject/build-impl.xml file. 
  120.70 +
  120.71 +    -->
  120.72 +</project>
   121.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.2 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
   121.3 @@ -0,0 +1,547 @@
   121.4 +<?xml version="1.0" encoding="UTF-8"?>
   121.5 +<!--
   121.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   121.7 +***         EDIT ../build.xml INSTEAD         ***
   121.8 +
   121.9 +For the purpose of easier reading the script
  121.10 +is divided into following sections:
  121.11 +
  121.12 +  - initialization
  121.13 +  - compilation
  121.14 +  - jar
  121.15 +  - execution
  121.16 +  - debugging
  121.17 +  - javadoc
  121.18 +  - junit compilation
  121.19 +  - junit execution
  121.20 +  - junit debugging
  121.21 +  - applet
  121.22 +  - cleanup
  121.23 +
  121.24 +-->
  121.25 +<project name="stackbasedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
  121.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
  121.27 +    <!-- 
  121.28 +    ======================
  121.29 +    INITIALIZATION SECTION 
  121.30 +    ======================
  121.31 +    -->
  121.32 +    <target name="-pre-init">
  121.33 +        <!-- Empty placeholder for easier customization. -->
  121.34 +        <!-- You can override this target in the ../build.xml file. -->
  121.35 +    </target>
  121.36 +    <target name="-init-private" depends="-pre-init">
  121.37 +        <property file="nbproject/private/private.properties"/>
  121.38 +    </target>
  121.39 +    <target name="-init-user" depends="-pre-init,-init-private">
  121.40 +        <property file="${user.properties.file}"/>
  121.41 +        <!-- The two properties below are usually overridden -->
  121.42 +        <!-- by the active platform. Just a fallback. -->
  121.43 +        <property name="default.javac.source" value="1.4"/>
  121.44 +        <property name="default.javac.target" value="1.4"/>
  121.45 +    </target>
  121.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
  121.47 +        <property file="nbproject/project.properties"/>
  121.48 +    </target>
  121.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
  121.50 +        <available file="${manifest.file}" property="manifest.available"/>
  121.51 +        <condition property="manifest.available+main.class">
  121.52 +            <and>
  121.53 +                <isset property="manifest.available"/>
  121.54 +                <isset property="main.class"/>
  121.55 +                <not>
  121.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  121.57 +                </not>
  121.58 +            </and>
  121.59 +        </condition>
  121.60 +        <condition property="manifest.available+main.class+mkdist.available">
  121.61 +            <and>
  121.62 +                <istrue value="${manifest.available+main.class}"/>
  121.63 +                <isset property="libs.CopyLibs.classpath"/>
  121.64 +            </and>
  121.65 +        </condition>
  121.66 +        <condition property="have.tests">
  121.67 +            <or>
  121.68 +                <available file="${test.src.dir}"/>
  121.69 +            </or>
  121.70 +        </condition>
  121.71 +        <condition property="have.sources">
  121.72 +            <or>
  121.73 +                <available file="${src.dir}"/>
  121.74 +            </or>
  121.75 +        </condition>
  121.76 +        <condition property="netbeans.home+have.tests">
  121.77 +            <and>
  121.78 +                <isset property="netbeans.home"/>
  121.79 +                <isset property="have.tests"/>
  121.80 +            </and>
  121.81 +        </condition>
  121.82 +        <condition property="no.javadoc.preview">
  121.83 +            <isfalse value="${javadoc.preview}"/>
  121.84 +        </condition>
  121.85 +        <property name="run.jvmargs" value=""/>
  121.86 +        <property name="javac.compilerargs" value=""/>
  121.87 +        <property name="work.dir" value="${basedir}"/>
  121.88 +        <condition property="no.deps">
  121.89 +            <and>
  121.90 +                <istrue value="${no.dependencies}"/>
  121.91 +            </and>
  121.92 +        </condition>
  121.93 +        <property name="javac.debug" value="true"/>
  121.94 +        <property name="javadoc.preview" value="true"/>
  121.95 +        <property name="application.args" value=""/>
  121.96 +    </target>
  121.97 +    <target name="-post-init">
  121.98 +        <!-- Empty placeholder for easier customization. -->
  121.99 +        <!-- You can override this target in the ../build.xml file. -->
 121.100 +    </target>
 121.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
 121.102 +        <fail unless="src.dir">Must set src.dir</fail>
 121.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 121.104 +        <fail unless="build.dir">Must set build.dir</fail>
 121.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
 121.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 121.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 121.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 121.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 121.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 121.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
 121.112 +    </target>
 121.113 +    <target name="-init-macrodef-property">
 121.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 121.115 +            <attribute name="name"/>
 121.116 +            <attribute name="value"/>
 121.117 +            <sequential>
 121.118 +                <property name="@{name}" value="${@{value}}"/>
 121.119 +            </sequential>
 121.120 +        </macrodef>
 121.121 +    </target>
 121.122 +    <target name="-init-macrodef-javac">
 121.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 121.124 +            <attribute name="srcdir" default="${src.dir}"/>
 121.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
 121.126 +            <attribute name="classpath" default="${javac.classpath}"/>
 121.127 +            <attribute name="debug" default="${javac.debug}"/>
 121.128 +            <element name="customize" optional="true"/>
 121.129 +            <sequential>
 121.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
 121.131 +                    <classpath>
 121.132 +                        <path path="@{classpath}"/>
 121.133 +                    </classpath>
 121.134 +                </depend>
 121.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
 121.136 +                    <classpath>
 121.137 +                        <path path="@{classpath}"/>
 121.138 +                    </classpath>
 121.139 +                    <compilerarg line="${javac.compilerargs}"/>
 121.140 +                    <customize/>
 121.141 +                </javac>
 121.142 +            </sequential>
 121.143 +        </macrodef>
 121.144 +    </target>
 121.145 +    <target name="-init-macrodef-junit">
 121.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 121.147 +            <attribute name="includes" default="**/*Test.java"/>
 121.148 +            <sequential>
 121.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
 121.150 +                    <batchtest todir="${build.test.results.dir}">
 121.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
 121.152 +                    </batchtest>
 121.153 +                    <classpath>
 121.154 +                        <path path="${run.test.classpath}"/>
 121.155 +                    </classpath>
 121.156 +                    <syspropertyset>
 121.157 +                        <propertyref prefix="test-sys-prop."/>
 121.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
 121.159 +                    </syspropertyset>
 121.160 +                    <formatter type="brief" usefile="false"/>
 121.161 +                    <formatter type="xml"/>
 121.162 +                    <jvmarg line="${run.jvmargs}"/>
 121.163 +                </junit>
 121.164 +            </sequential>
 121.165 +        </macrodef>
 121.166 +    </target>
 121.167 +    <target name="-init-macrodef-nbjpda">
 121.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 121.169 +            <attribute name="name" default="${main.class}"/>
 121.170 +            <attribute name="classpath" default="${debug.classpath}"/>
 121.171 +            <attribute name="stopclassname" default=""/>
 121.172 +            <sequential>
 121.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
 121.174 +                    <classpath>
 121.175 +                        <path path="@{classpath}"/>
 121.176 +                    </classpath>
 121.177 +                </nbjpdastart>
 121.178 +            </sequential>
 121.179 +        </macrodef>
 121.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 121.181 +            <attribute name="dir" default="${build.classes.dir}"/>
 121.182 +            <sequential>
 121.183 +                <nbjpdareload>
 121.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
 121.185 +                </nbjpdareload>
 121.186 +            </sequential>
 121.187 +        </macrodef>
 121.188 +    </target>
 121.189 +    <target name="-init-macrodef-debug">
 121.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 121.191 +            <attribute name="classname" default="${main.class}"/>
 121.192 +            <attribute name="classpath" default="${debug.classpath}"/>
 121.193 +            <element name="customize" optional="true"/>
 121.194 +            <sequential>
 121.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 121.196 +                    <jvmarg value="-Xdebug"/>
 121.197 +                    <jvmarg value="-Xnoagent"/>
 121.198 +                    <jvmarg value="-Djava.compiler=none"/>
 121.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
 121.200 +                    <jvmarg line="${run.jvmargs}"/>
 121.201 +                    <classpath>
 121.202 +                        <path path="@{classpath}"/>
 121.203 +                    </classpath>
 121.204 +                    <syspropertyset>
 121.205 +                        <propertyref prefix="run-sys-prop."/>
 121.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 121.207 +                    </syspropertyset>
 121.208 +                    <customize/>
 121.209 +                </java>
 121.210 +            </sequential>
 121.211 +        </macrodef>
 121.212 +    </target>
 121.213 +    <target name="-init-macrodef-java">
 121.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 121.215 +            <attribute name="classname" default="${main.class}"/>
 121.216 +            <element name="customize" optional="true"/>
 121.217 +            <sequential>
 121.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 121.219 +                    <jvmarg line="${run.jvmargs}"/>
 121.220 +                    <classpath>
 121.221 +                        <path path="${run.classpath}"/>
 121.222 +                    </classpath>
 121.223 +                    <syspropertyset>
 121.224 +                        <propertyref prefix="run-sys-prop."/>
 121.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 121.226 +                    </syspropertyset>
 121.227 +                    <customize/>
 121.228 +                </java>
 121.229 +            </sequential>
 121.230 +        </macrodef>
 121.231 +    </target>
 121.232 +    <target name="-init-presetdef-jar">
 121.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 121.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
 121.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 121.236 +            </jar>
 121.237 +        </presetdef>
 121.238 +    </target>
 121.239 +    <target name="init" 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"/>
 121.240 +    <!--
 121.241 +    ===================
 121.242 +    COMPILATION SECTION
 121.243 +    ===================
 121.244 +    -->
 121.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
 121.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
 121.247 +        <mkdir dir="${build.classes.dir}"/>
 121.248 +    </target>
 121.249 +    <target name="-pre-compile">
 121.250 +        <!-- Empty placeholder for easier customization. -->
 121.251 +        <!-- You can override this target in the ../build.xml file. -->
 121.252 +    </target>
 121.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
 121.254 +        <j2seproject3:javac/>
 121.255 +        <copy todir="${build.classes.dir}">
 121.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
 121.257 +        </copy>
 121.258 +    </target>
 121.259 +    <target name="-post-compile">
 121.260 +        <!-- Empty placeholder for easier customization. -->
 121.261 +        <!-- You can override this target in the ../build.xml file. -->
 121.262 +    </target>
 121.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
 121.264 +    <target name="-pre-compile-single">
 121.265 +        <!-- Empty placeholder for easier customization. -->
 121.266 +        <!-- You can override this target in the ../build.xml file. -->
 121.267 +    </target>
 121.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
 121.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 121.270 +        <j2seproject3:javac>
 121.271 +            <customize>
 121.272 +                <patternset includes="${javac.includes}"/>
 121.273 +            </customize>
 121.274 +        </j2seproject3:javac>
 121.275 +    </target>
 121.276 +    <target name="-post-compile-single">
 121.277 +        <!-- Empty placeholder for easier customization. -->
 121.278 +        <!-- You can override this target in the ../build.xml file. -->
 121.279 +    </target>
 121.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
 121.281 +    <!--
 121.282 +    ====================
 121.283 +    JAR BUILDING SECTION
 121.284 +    ====================
 121.285 +    -->
 121.286 +    <target name="-pre-pre-jar" depends="init">
 121.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
 121.288 +        <mkdir dir="${dist.jar.dir}"/>
 121.289 +    </target>
 121.290 +    <target name="-pre-jar">
 121.291 +        <!-- Empty placeholder for easier customization. -->
 121.292 +        <!-- You can override this target in the ../build.xml file. -->
 121.293 +    </target>
 121.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
 121.295 +        <j2seproject1:jar/>
 121.296 +    </target>
 121.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
 121.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
 121.299 +    </target>
 121.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
 121.301 +        <j2seproject1:jar manifest="${manifest.file}">
 121.302 +            <j2seproject1:manifest>
 121.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 121.304 +            </j2seproject1:manifest>
 121.305 +        </j2seproject1:jar>
 121.306 +        <echo>To run this application from the command line without Ant, try:</echo>
 121.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 121.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 121.309 +        <pathconvert property="run.classpath.with.dist.jar">
 121.310 +            <path path="${run.classpath}"/>
 121.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 121.312 +        </pathconvert>
 121.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 121.314 +    </target>
 121.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
 121.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 121.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
 121.318 +            <path path="${run.classpath}"/>
 121.319 +            <map from="${build.classes.dir.resolved}" to=""/>
 121.320 +        </pathconvert>
 121.321 +        <pathconvert property="jar.classpath" pathsep=" ">
 121.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
 121.323 +            <chainedmapper>
 121.324 +                <flattenmapper/>
 121.325 +                <globmapper from="*" to="lib/*"/>
 121.326 +            </chainedmapper>
 121.327 +        </pathconvert>
 121.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
 121.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
 121.330 +            <fileset dir="${build.classes.dir}"/>
 121.331 +            <manifest>
 121.332 +                <attribute name="Main-Class" value="${main.class}"/>
 121.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 121.334 +            </manifest>
 121.335 +        </copylibs>
 121.336 +        <echo>To run this application from the command line without Ant, try:</echo>
 121.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 121.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 121.339 +    </target>
 121.340 +    <target name="-post-jar">
 121.341 +        <!-- Empty placeholder for easier customization. -->
 121.342 +        <!-- You can override this target in the ../build.xml file. -->
 121.343 +    </target>
 121.344 +    <target name="jar" 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."/>
 121.345 +    <!--
 121.346 +    =================
 121.347 +    EXECUTION SECTION
 121.348 +    =================
 121.349 +    -->
 121.350 +    <target name="run" depends="init,compile" description="Run a main class.">
 121.351 +        <j2seproject1:java>
 121.352 +            <customize>
 121.353 +                <arg line="${application.args}"/>
 121.354 +            </customize>
 121.355 +        </j2seproject1:java>
 121.356 +    </target>
 121.357 +    <target name="run-single" depends="init,compile-single">
 121.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 121.359 +        <j2seproject1:java classname="${run.class}"/>
 121.360 +    </target>
 121.361 +    <!--
 121.362 +    =================
 121.363 +    DEBUGGING SECTION
 121.364 +    =================
 121.365 +    -->
 121.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
 121.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 121.368 +    </target>
 121.369 +    <target name="-debug-start-debuggee" depends="init,compile">
 121.370 +        <j2seproject3:debug>
 121.371 +            <customize>
 121.372 +                <arg line="${application.args}"/>
 121.373 +            </customize>
 121.374 +        </j2seproject3:debug>
 121.375 +    </target>
 121.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
 121.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
 121.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 121.379 +    </target>
 121.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
 121.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
 121.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 121.383 +        <j2seproject3:debug classname="${debug.class}"/>
 121.384 +    </target>
 121.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
 121.386 +    <target name="-pre-debug-fix" depends="init">
 121.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
 121.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
 121.389 +    </target>
 121.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
 121.391 +        <j2seproject1:nbjpdareload/>
 121.392 +    </target>
 121.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
 121.394 +    <!--
 121.395 +    ===============
 121.396 +    JAVADOC SECTION
 121.397 +    ===============
 121.398 +    -->
 121.399 +    <target name="-javadoc-build" depends="init">
 121.400 +        <mkdir dir="${dist.javadoc.dir}"/>
 121.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
 121.402 +            <classpath>
 121.403 +                <path path="${javac.classpath}"/>
 121.404 +            </classpath>
 121.405 +            <sourcepath>
 121.406 +                <pathelement location="${src.dir}"/>
 121.407 +            </sourcepath>
 121.408 +            <packageset dir="${src.dir}" includes="*/**"/>
 121.409 +            <fileset dir="${src.dir}" includes="*.java"/>
 121.410 +        </javadoc>
 121.411 +    </target>
 121.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
 121.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 121.414 +    </target>
 121.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
 121.416 +    <!--
 121.417 +    =========================
 121.418 +    JUNIT COMPILATION SECTION
 121.419 +    =========================
 121.420 +    -->
 121.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
 121.422 +        <mkdir dir="${build.test.classes.dir}"/>
 121.423 +    </target>
 121.424 +    <target name="-pre-compile-test">
 121.425 +        <!-- Empty placeholder for easier customization. -->
 121.426 +        <!-- You can override this target in the ../build.xml file. -->
 121.427 +    </target>
 121.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
 121.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
 121.430 +        <copy todir="${build.test.classes.dir}">
 121.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 121.432 +        </copy>
 121.433 +    </target>
 121.434 +    <target name="-post-compile-test">
 121.435 +        <!-- Empty placeholder for easier customization. -->
 121.436 +        <!-- You can override this target in the ../build.xml file. -->
 121.437 +    </target>
 121.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
 121.439 +    <target name="-pre-compile-test-single">
 121.440 +        <!-- Empty placeholder for easier customization. -->
 121.441 +        <!-- You can override this target in the ../build.xml file. -->
 121.442 +    </target>
 121.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
 121.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 121.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
 121.446 +            <customize>
 121.447 +                <patternset includes="${javac.includes}"/>
 121.448 +            </customize>
 121.449 +        </j2seproject3:javac>
 121.450 +        <copy todir="${build.test.classes.dir}">
 121.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 121.452 +        </copy>
 121.453 +    </target>
 121.454 +    <target name="-post-compile-test-single">
 121.455 +        <!-- Empty placeholder for easier customization. -->
 121.456 +        <!-- You can override this target in the ../build.xml file. -->
 121.457 +    </target>
 121.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
 121.459 +    <!--
 121.460 +    =======================
 121.461 +    JUNIT EXECUTION SECTION
 121.462 +    =======================
 121.463 +    -->
 121.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
 121.465 +        <mkdir dir="${build.test.results.dir}"/>
 121.466 +    </target>
 121.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
 121.468 +        <j2seproject3:junit/>
 121.469 +    </target>
 121.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
 121.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 121.472 +    </target>
 121.473 +    <target name="test-report" if="have.tests" depends="init"/>
 121.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
 121.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
 121.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
 121.477 +        <mkdir dir="${build.test.results.dir}"/>
 121.478 +    </target>
 121.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
 121.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 121.481 +        <j2seproject3:junit includes="${test.includes}"/>
 121.482 +    </target>
 121.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
 121.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 121.485 +    </target>
 121.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
 121.487 +    <!--
 121.488 +    =======================
 121.489 +    JUNIT DEBUGGING SECTION
 121.490 +    =======================
 121.491 +    -->
 121.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
 121.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 121.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
 121.495 +            <customize>
 121.496 +                <arg line="${test.class}"/>
 121.497 +            </customize>
 121.498 +        </j2seproject3:debug>
 121.499 +    </target>
 121.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
 121.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
 121.502 +    </target>
 121.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
 121.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
 121.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 121.506 +    </target>
 121.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
 121.508 +    <!--
 121.509 +    =========================
 121.510 +    APPLET EXECUTION SECTION
 121.511 +    =========================
 121.512 +    -->
 121.513 +    <target name="run-applet" depends="init,compile-single">
 121.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 121.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 121.516 +            <customize>
 121.517 +                <arg value="${applet.url}"/>
 121.518 +            </customize>
 121.519 +        </j2seproject1:java>
 121.520 +    </target>
 121.521 +    <!--
 121.522 +    =========================
 121.523 +    APPLET DEBUGGING  SECTION
 121.524 +    =========================
 121.525 +    -->
 121.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
 121.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 121.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 121.529 +            <customize>
 121.530 +                <arg value="${applet.url}"/>
 121.531 +            </customize>
 121.532 +        </j2seproject3:debug>
 121.533 +    </target>
 121.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
 121.535 +    <!--
 121.536 +    ===============
 121.537 +    CLEANUP SECTION
 121.538 +    ===============
 121.539 +    -->
 121.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
 121.541 +    <target name="-do-clean" depends="init">
 121.542 +        <delete dir="${build.dir}"/>
 121.543 +        <delete dir="${dist.dir}"/>
 121.544 +    </target>
 121.545 +    <target name="-post-clean">
 121.546 +        <!-- Empty placeholder for easier customization. -->
 121.547 +        <!-- You can override this target in the ../build.xml file. -->
 121.548 +    </target>
 121.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
 121.550 +</project>
   122.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.2 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
   122.3 @@ -0,0 +1,8 @@
   122.4 +build.xml.data.CRC32=10562595
   122.5 +build.xml.script.CRC32=8e100d5a
   122.6 +build.xml.stylesheet.CRC32=a12b3d02
   122.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   122.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   122.9 +nbproject/build-impl.xml.data.CRC32=10562595
  122.10 +nbproject/build-impl.xml.script.CRC32=50f3448d
  122.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
   123.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   123.2 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
   123.3 @@ -0,0 +1,56 @@
   123.4 +build.classes.dir=${build.dir}/classes
   123.5 +build.classes.excludes=**/*.java,**/*.form
   123.6 +# This directory is removed when the project is cleaned:
   123.7 +build.dir=build
   123.8 +build.generated.dir=${build.dir}/generated
   123.9 +# Only compile against the classpath explicitly listed here:
  123.10 +build.sysclasspath=ignore
  123.11 +build.test.classes.dir=${build.dir}/test/classes
  123.12 +build.test.results.dir=${build.dir}/test/results
  123.13 +debug.classpath=\
  123.14 +    ${run.classpath}
  123.15 +debug.test.classpath=\
  123.16 +    ${run.test.classpath}
  123.17 +# This directory is removed when the project is cleaned:
  123.18 +dist.dir=dist
  123.19 +dist.jar=${dist.dir}/boolcircuit.jar
  123.20 +dist.javadoc.dir=${dist.dir}/javadoc
  123.21 +jar.compress=false
  123.22 +javac.classpath=
  123.23 +# Space-separated list of extra javac options
  123.24 +javac.compilerargs=
  123.25 +javac.deprecation=false
  123.26 +javac.source=1.5
  123.27 +javac.target=1.5
  123.28 +javac.test.classpath=\
  123.29 +    ${javac.classpath}:\
  123.30 +    ${build.classes.dir}:\
  123.31 +    ${libs.junit.classpath}
  123.32 +javadoc.additionalparam=
  123.33 +javadoc.author=false
  123.34 +javadoc.encoding=
  123.35 +javadoc.noindex=false
  123.36 +javadoc.nonavbar=false
  123.37 +javadoc.notree=false
  123.38 +javadoc.private=false
  123.39 +javadoc.splitindex=true
  123.40 +javadoc.use=true
  123.41 +javadoc.version=false
  123.42 +javadoc.windowtitle=
  123.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
  123.44 +# The library definition has always preference over this property.
  123.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
  123.46 +meta.inf.dir=${src.dir}/META-INF
  123.47 +platform.active=default_platform
  123.48 +run.classpath=\
  123.49 +    ${javac.classpath}:\
  123.50 +    ${build.classes.dir}
  123.51 +# Space-separated list of JVM arguments used when running the project
  123.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  123.53 +# or test-sys-prop.name=value to set system properties for unit tests):
  123.54 +run.jvmargs=
  123.55 +run.test.classpath=\
  123.56 +    ${javac.test.classpath}:\
  123.57 +    ${build.test.classes.dir}
  123.58 +src.dir=src
  123.59 +test.src.dir=test
   124.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   124.2 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   124.3 @@ -0,0 +1,16 @@
   124.4 +<?xml version="1.0" encoding="UTF-8"?>
   124.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   124.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   124.7 +    <configuration>
   124.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   124.9 +            <name>stackbasedsolution</name>
  124.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  124.11 +            <source-roots>
  124.12 +                <root id="src.dir"/>
  124.13 +            </source-roots>
  124.14 +            <test-roots>
  124.15 +                <root id="test.src.dir"/>
  124.16 +            </test-roots>
  124.17 +        </data>
  124.18 +    </configuration>
  124.19 +</project>
   125.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   125.2 +++ b/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
   125.3 @@ -0,0 +1,28 @@
   125.4 +/*
   125.5 + * The contents of this file are subject to the terms of the Common Development
   125.6 + * and Distribution License (the License). You may not use this file except in
   125.7 + * compliance with the License.
   125.8 + *
   125.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  125.10 + * or http://www.netbeans.org/cddl.txt.
  125.11 + *
  125.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  125.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  125.14 + * If applicable, add the following below the CDDL Header, with the fields
  125.15 + * enclosed by brackets [] replaced by your own identifying information:
  125.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  125.17 + *
  125.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  125.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  125.20 + * Microsystems, Inc. All Rights Reserved.
  125.21 + */
  125.22 +
  125.23 +package org.netbeans.apifest.boolcircuit;
  125.24 +
  125.25 +import java.util.Stack;
  125.26 +
  125.27 +/**
  125.28 + */ 
  125.29 +public interface Circuit {
  125.30 +    public char evaluate (Stack<Character> input) throws IllegalArgumentException;
  125.31 +}
   126.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   126.2 +++ b/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit2.java	Sat Jun 14 09:52:45 2008 +0200
   126.3 @@ -0,0 +1,28 @@
   126.4 +/*
   126.5 + * The contents of this file are subject to the terms of the Common Development
   126.6 + * and Distribution License (the License). You may not use this file except in
   126.7 + * compliance with the License.
   126.8 + *
   126.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  126.10 + * or http://www.netbeans.org/cddl.txt.
  126.11 + *
  126.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  126.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  126.14 + * If applicable, add the following below the CDDL Header, with the fields
  126.15 + * enclosed by brackets [] replaced by your own identifying information:
  126.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  126.17 + *
  126.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  126.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  126.20 + * Microsystems, Inc. All Rights Reserved.
  126.21 + */
  126.22 +
  126.23 +package org.netbeans.apifest.boolcircuit;
  126.24 +
  126.25 +import java.util.Stack;
  126.26 +
  126.27 +/**
  126.28 + */ 
  126.29 +public interface Circuit2 extends Circuit {
  126.30 +    public double evaluate (double ... input) throws IllegalArgumentException;
  126.31 +}
   127.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   127.2 +++ b/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/CircuitFactory.java	Sat Jun 14 09:52:45 2008 +0200
   127.3 @@ -0,0 +1,101 @@
   127.4 +/*
   127.5 + * CircuitFactory.java
   127.6 + *
   127.7 + * Created on July 12, 2006, 3:01 PM
   127.8 + *
   127.9 + * To change this template, choose Tools | Template Manager
  127.10 + * and open the template in the editor.
  127.11 + */
  127.12 +
  127.13 +package org.netbeans.apifest.boolcircuit;
  127.14 +
  127.15 +import java.util.Stack;
  127.16 +
  127.17 +/**
  127.18 + *
  127.19 + */
  127.20 +public class CircuitFactory {
  127.21 +    
  127.22 +    /** Creates a new instance of CircuitFactory */
  127.23 +    private  CircuitFactory() {
  127.24 +    }
  127.25 +    
  127.26 +    public final static Circuit join (final Circuit c1, final Circuit c2, final Operation op) {
  127.27 +        return new Circuit () {
  127.28 +            public char evaluate(Stack input) throws IllegalArgumentException {
  127.29 +                return op.evaluate(c1.evaluate(input), c2.evaluate(input));
  127.30 +            }
  127.31 +        };
  127.32 +    }
  127.33 +    
  127.34 +    public final static Circuit2 join (final Circuit2 c1, final Circuit2 c2, final Operation op) {
  127.35 +        return new Circuit2 () {
  127.36 +            public char evaluate(Stack input) throws IllegalArgumentException {
  127.37 +                return op.evaluate(c1.evaluate(input), c2.evaluate(input));
  127.38 +            }
  127.39 +            public double evaluate(double ... input) throws IllegalArgumentException {
  127.40 +                return op.evaluate(c1.evaluate(input), c2.evaluate(input));
  127.41 +            }
  127.42 +        };
  127.43 +    }
  127.44 +    
  127.45 +    public final static Circuit2 getBasicCircuit (final Operation op) {
  127.46 +        return new Circuit2 () {
  127.47 +            public double evaluate(double... input) throws IllegalArgumentException {
  127.48 +                if (input == null || input.length == 1) {
  127.49 +                    throw new IllegalArgumentException ("Invalid input array.");
  127.50 +                }
  127.51 +                return op.evaluate(input[0], input[1]);
  127.52 +            }
  127.53 +
  127.54 +            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
  127.55 +                // special handling of unary oparation
  127.56 +                if (op instanceof Operation.Neg) {
  127.57 +                    return op.evaluate(input.pop(), input.peek());
  127.58 +                } else {
  127.59 +                    return op.evaluate(input.pop(), input.pop());
  127.60 +                }
  127.61 +            }
  127.62 +        };
  127.63 +    }
  127.64 +//    public final static Circuit2 getBasicCircuit (final Operation op, final int posX, final int posY) {
  127.65 +//        return new Circuit2 () {
  127.66 +//            public double evaluate(double... input) throws IllegalArgumentException {
  127.67 +//                return op.evaluate(input[posX], input[posY]);
  127.68 +//            }
  127.69 +//
  127.70 +//            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
  127.71 +//                return getBasicCircuit (op).evaluate(input);
  127.72 +//            }
  127.73 +//        };
  127.74 +//    }
  127.75 +//    public final static Circuit2 getBasicCircuit (final Operation op, final Circuit2 c1, final Circuit2 c2) {
  127.76 +//        return new Circuit2 () {
  127.77 +//            public double evaluate(double... input) throws IllegalArgumentException {
  127.78 +//                return op.evaluate(c2.evaluate(input), c2.evaluate(input));
  127.79 +//            }
  127.80 +//
  127.81 +//            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
  127.82 +//                return getBasicCircuit (op).evaluate(input);
  127.83 +//            }
  127.84 +//        };
  127.85 +//    }
  127.86 +    public final static Circuit getTrivialCircuit () {
  127.87 +        return new Circuit () {
  127.88 +            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
  127.89 +                return input.peek();
  127.90 +            }
  127.91 +        };
  127.92 +    }
  127.93 +    public final static Circuit2 getTrivialCircuit (final int posX) {
  127.94 +        return new Circuit2 () {
  127.95 +            public double evaluate(double... input) throws IllegalArgumentException {
  127.96 +                return input[posX];
  127.97 +            }
  127.98 +
  127.99 +            public char evaluate(Stack<Character> input) throws IllegalArgumentException {
 127.100 +                return getTrivialCircuit ().evaluate(input);
 127.101 +            }
 127.102 +        };
 127.103 +    }
 127.104 +}
   128.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   128.2 +++ b/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Operation.java	Sat Jun 14 09:52:45 2008 +0200
   128.3 @@ -0,0 +1,84 @@
   128.4 +/*
   128.5 + * Operation.java
   128.6 + *
   128.7 + * Created on July 12, 2006, 3:06 PM
   128.8 + *
   128.9 + * To change this template, choose Tools | Template Manager
  128.10 + * and open the template in the editor.
  128.11 + */
  128.12 +
  128.13 +package org.netbeans.apifest.boolcircuit;
  128.14 +
  128.15 +/**
  128.16 + *
  128.17 + */
  128.18 +public interface Operation {
  128.19 +    public char evaluate (char i1, char i2) throws IllegalArgumentException;
  128.20 +    public double evaluate (double i1, double i2) throws IllegalArgumentException;
  128.21 +    public final static Operation OR = new Or ();
  128.22 +    public final static Operation AND = new And ();
  128.23 +    public final static Operation NEG = new Neg ();
  128.24 +    
  128.25 +    
  128.26 +    static class And implements Operation {
  128.27 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
  128.28 +            if (i1 != '0' && i1 != '1') {
  128.29 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.30 +            }
  128.31 +            if (i2 != '0' && i2 != '1') {
  128.32 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
  128.33 +            }
  128.34 +            return i1 == '1' && i2 == '1' ? '1' : '0';
  128.35 +        }
  128.36 +
  128.37 +        public double evaluate(double i1, double i2) throws IllegalArgumentException {
  128.38 +            if (i1 < 0 || i1 > 1) {
  128.39 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.40 +            }
  128.41 +            if (i2 < 0 || i2 > 1) {
  128.42 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
  128.43 +            }
  128.44 +            return i1 * i2;
  128.45 +        }
  128.46 +    }
  128.47 +    static class Or implements Operation {
  128.48 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
  128.49 +            if (i1 != '0' && i1 != '1') {
  128.50 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.51 +            }
  128.52 +            if (i2 != '0' && i2 != '1') {
  128.53 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
  128.54 +            }
  128.55 +            return i1 == '1' || i2 == '1' ? '1' : '0';
  128.56 +        }
  128.57 +
  128.58 +        public double evaluate(double i1, double i2) throws IllegalArgumentException {
  128.59 +            if (i1 < 0 || i1 > 1) {
  128.60 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.61 +            }
  128.62 +            if (i2 < 0 || i2 > 1) {
  128.63 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
  128.64 +            }
  128.65 +            return 1 - (1 - i1) * (1 - i2);
  128.66 +        }
  128.67 +    }
  128.68 +    static class Neg implements Operation {
  128.69 +        public char evaluate(char i1, char i2) throws IllegalArgumentException {
  128.70 +            if (i1 != '0' && i1 != '1') {
  128.71 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.72 +            }
  128.73 +            return i1 == '1' ? '0' : '1';
  128.74 +        }
  128.75 +
  128.76 +        public double evaluate(double i1, double i2) throws IllegalArgumentException {
  128.77 +            if (i1 < 0 || i1 > 1) {
  128.78 +                throw new IllegalArgumentException ("Invalid input parameter: " + i1);
  128.79 +            }
  128.80 +            if (i2 < 0 || i2 > 1) {
  128.81 +                throw new IllegalArgumentException ("Invalid input parameter: " + i2);
  128.82 +            }
  128.83 +            return 1 - i1;
  128.84 +        }
  128.85 +    }
  128.86 +}
  128.87 +
   129.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   129.2 +++ b/samples/apifest1/day2/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   129.3 @@ -0,0 +1,107 @@
   129.4 +/*
   129.5 + * The contents of this file are subject to the terms of the Common Development
   129.6 + * and Distribution License (the License). You may not use this file except in
   129.7 + * compliance with the License.
   129.8 + *
   129.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  129.10 + * or http://www.netbeans.org/cddl.txt.
  129.11 + *
  129.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  129.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  129.14 + * If applicable, add the following below the CDDL Header, with the fields
  129.15 + * enclosed by brackets [] replaced by your own identifying information:
  129.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  129.17 + *
  129.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  129.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  129.20 + * Microsystems, Inc. All Rights Reserved.
  129.21 + */
  129.22 +
  129.23 +package org.netbeans.apifest.boolcircuit;
  129.24 +
  129.25 +import java.util.Arrays;
  129.26 +import java.util.Stack;
  129.27 +import junit.framework.TestCase;
  129.28 +
  129.29 +/** The initial quest for this APIFest is to create an API for boolean 
  129.30 + * circuits. Such API shall be able to compose a boolean circuit from
  129.31 + * basic elements and evaluate the result given initial values for 
  129.32 + * input variables.
  129.33 + * <p>
  129.34 + * The basic elements include:
  129.35 + * <ul>
  129.36 + *   <li>negation - has one input and one output and changes 0 on input to 
  129.37 + *          on output 1 and 1 to 0
  129.38 + *   <li>and - has two inputs and one output. The output is 1 only if both 
  129.39 + *          inputs are 1, otherwise it is 0
  129.40 + *   <li>or - has two inputs and one output. The output is 1 always, except
  129.41 + *          in the case when both inputs are 0
  129.42 + * </ul>
  129.43 + *
  129.44 + * <p>
  129.45 + * The boolean circuit can be used to represent boolean formulas and compute
  129.46 + * the results for certain values of its inputs. The individual tasks described
  129.47 + * as tests bellow.
  129.48 + *
  129.49 + * <p>
  129.50 + * Links of interest:
  129.51 + * <ul>
  129.52 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
  129.53 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
  129.54 + * </ul>
  129.55 + */
  129.56 +public class CircuitTest extends TestCase {
  129.57 +    static {
  129.58 +        // your code shall run without any permissions
  129.59 +    }
  129.60 +    
  129.61 +    public CircuitTest(String testName) {
  129.62 +        super(testName);
  129.63 +    }
  129.64 +
  129.65 +    protected void setUp() throws Exception {
  129.66 +    }
  129.67 +
  129.68 +    protected void tearDown() throws Exception {
  129.69 +    }
  129.70 +    
  129.71 +    
  129.72 +    /** 
  129.73 +     * Create a circuit to evaluate x1 and x2 and then
  129.74 +     * verify that its result is false for input (false, true) and
  129.75 +     * it is true for input (true, true).
  129.76 +     */
  129.77 +    public void testX1andX2() {
  129.78 +        Stack<Character> s = new Stack<Character> ();
  129.79 +        s.addAll(Arrays.asList('1', '1'));
  129.80 +        assertEquals("'1' for '11' input.", '1', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
  129.81 +        s.addAll(Arrays.asList('1', '0'));
  129.82 +        assertEquals("'0' for '10' input.", '0', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
  129.83 +    }
  129.84 +    
  129.85 +    /** 
  129.86 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  129.87 +     * verify that its result is false for input (false, true, false) and
  129.88 +     * it is true for input (false, false, true).
  129.89 +     */
  129.90 +    public void testX1andX2orX3() {
  129.91 +        Stack<Character> s = new Stack<Character> ();
  129.92 +        s.addAll(Arrays.asList('0', '1', '0'));
  129.93 +        assertEquals("'0' for '010' input.", '0', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
  129.94 +        s.addAll(Arrays.asList('0', '0', '1'));
  129.95 +        assertEquals("'1' for '001' input.", '1', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
  129.96 +    }
  129.97 +    /** 
  129.98 +     * Create a circuit to evaluate (x1 or not(x1)) and then
  129.99 +     * verify that its result is true for all values of x1.
 129.100 +     */
 129.101 +    public void testAlwaysTrue() {
 129.102 +        Circuit alwaysTrue = CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.NEG), Operation.OR);
 129.103 +        Stack<Character> s = new Stack<Character> ();
 129.104 +        s.addAll(Arrays.asList('0', '0'));
 129.105 +        assertEquals ("'1' for '00'", '1', alwaysTrue.evaluate(s));
 129.106 +        s.addAll(Arrays.asList('1', '1'));
 129.107 +        assertEquals ("'1' for '11'", '1', alwaysTrue.evaluate(s));
 129.108 +    }
 129.109 +    
 129.110 +}
   130.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   130.2 +++ b/samples/apifest1/day2/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
   130.3 @@ -0,0 +1,153 @@
   130.4 +/*
   130.5 + * The contents of this file are subject to the terms of the Common Development
   130.6 + * and Distribution License (the License). You may not use this file except in
   130.7 + * compliance with the License.
   130.8 + *
   130.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  130.10 + * or http://www.netbeans.org/cddl.txt.
  130.11 + *
  130.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  130.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  130.14 + * If applicable, add the following below the CDDL Header, with the fields
  130.15 + * enclosed by brackets [] replaced by your own identifying information:
  130.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  130.17 + *
  130.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  130.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  130.20 + * Microsystems, Inc. All Rights Reserved.
  130.21 + */
  130.22 +
  130.23 +package org.netbeans.apifest.boolcircuit;
  130.24 +
  130.25 +import java.security.CodeSource;
  130.26 +import java.security.Permission;
  130.27 +import java.security.PermissionCollection;
  130.28 +import java.security.Policy;
  130.29 +import java.util.Arrays;
  130.30 +import java.util.Collection;
  130.31 +import java.util.Collections;
  130.32 +import java.util.Enumeration;
  130.33 +import java.util.Stack;
  130.34 +import junit.framework.TestCase;
  130.35 +import junit.framework.*;
  130.36 +
  130.37 +/** This file contains the APIFest quest for day 2. Simply, turn the 
  130.38 + * boolean circuit into circuit that can compute with double values from 0 to 1.
  130.39 + * <p>
  130.40 + * This means that where ever a boolean was used to represent input or 
  130.41 + * output values, one can now use any double number from >= 0 and <= 1.
  130.42 + * Still, to support backward compatibility, the operations with booleans
  130.43 + * has to be kept available and have to work. In fact False shall be 
  130.44 + * treated as 0 and True as 1.
  130.45 + * <p>
  130.46 + * The basic elements has to be modified to work on doubles in the following
  130.47 + * way:
  130.48 + * <ul>
  130.49 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
  130.50 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
  130.51 + *             and(false,true)=0*1=0=false
  130.52 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
  130.53 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
  130.54 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
  130.55 + * </ul>
  130.56 + * <p>
  130.57 + * However as the circuits with doubles are more rich than plain boolean circuits,
  130.58 + * there is additional requirement to allow any user of your API to write its 
  130.59 + * own "element" type. This is all going to be exercise in the tests bellow
  130.60 + * which you are supposed to implement.
  130.61 + */
  130.62 +public class RealTest extends TestCase {
  130.63 +    static {
  130.64 +        // your code shall run without any permissions
  130.65 +    }
  130.66 +    
  130.67 +    public RealTest(String testName) {
  130.68 +        super(testName);
  130.69 +    }
  130.70 +
  130.71 +    protected void setUp() throws Exception {
  130.72 +    }
  130.73 +
  130.74 +    protected void tearDown() throws Exception {
  130.75 +    }
  130.76 +    
  130.77 +    
  130.78 +    /** First of all create a circuit which will evaluate
  130.79 +     * expression (X1 and X2) or not(x1). Hold the circuit
  130.80 +     * in some variable.
  130.81 +     *
  130.82 +     * Feed this circuit with x1=true, x2=false, assert result is false
  130.83 +     *
  130.84 +     * Feed the same circuit with x1=false, x2=true, assert result is true
  130.85 +     *
  130.86 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
  130.87 +     *
  130.88 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
  130.89 +     *
  130.90 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
  130.91 +     */
  130.92 +    public void testX1andX2orNotX1() {
  130.93 +        Circuit2 trivX1 = CircuitFactory.getTrivialCircuit(0);
  130.94 +        Circuit2 trivX2 = CircuitFactory.getTrivialCircuit(1);
  130.95 +        Circuit2 cAnd = CircuitFactory.join(trivX1, trivX2, Operation.AND);
  130.96 +        Circuit2 cNeg = CircuitFactory.join(trivX1, trivX2, Operation.NEG);
  130.97 +        Circuit2 cOr = CircuitFactory.join(CircuitFactory.getBasicCircuit (Operation.AND), CircuitFactory.getBasicCircuit(Operation.NEG), Operation.OR);
  130.98 +
  130.99 +        Stack<Character> s = new Stack<Character> ();
 130.100 +        s.addAll(Arrays.asList('1', '1', '0', '1'));
 130.101 +        
 130.102 +        assertEquals ("Feed this circuit with x1=true, x2=false, assert result is false", '0', cOr.evaluate(s));        
 130.103 +        assertEquals ("Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0", 1.0, cOr.evaluate(0.0,1.0));
 130.104 +        assertEquals ("Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625", 0.625, cOr.evaluate(0.5,0.5));
 130.105 +        try {
 130.106 +            assertEquals ("Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception", 0, cOr.evaluate(0.0,2.0));
 130.107 +            fail ("Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception");
 130.108 +        } catch (Exception x) {
 130.109 +        }
 130.110 +    }
 130.111 +    
 130.112 +    /** Ensure that one variable cannot be filled with two different values.
 130.113 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
 130.114 +     * API that would not lead to x1 * x1 result, an exception is thrown.
 130.115 +     * For example if there was a way to feed the circuit with two different 
 130.116 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
 130.117 +     * improper use of the circuit.
 130.118 +     */
 130.119 +    public void testImproperUseOfTheCircuit() {
 130.120 +        Circuit2 trivX1 = CircuitFactory.getTrivialCircuit(0);
 130.121 +        assertEquals ("0.25", 0.25, CircuitFactory.join(trivX1, trivX1, Operation.AND).evaluate(0.5, 2));
 130.122 +    }
 130.123 +    
 130.124 +    /** Write your own element type called "gte" that will have two inputs and one output.
 130.125 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
 130.126 +     * 
 130.127 +     * Create 
 130.128 +     * circuit for following expression: (x1 and not(x1)) gte x1
 130.129 +     *
 130.130 +     * Feed the circuit with 0.5 and verify the result is 0
 130.131 +     *
 130.132 +     * Feed the same circuit with 1 and verify the result is 0
 130.133 +     *
 130.134 +     * Feed the same circuit with 0 and verify the result is 1
 130.135 +     */
 130.136 +    public void testGreaterThanEqualElement() {
 130.137 +//        fail("task3");
 130.138 +        Operation gte = new Operation () {
 130.139 +
 130.140 +            public char evaluate(char i1, char i2) throws IllegalArgumentException {
 130.141 +                assert false : "Not supported";
 130.142 +                return 'x';
 130.143 +            }
 130.144 +
 130.145 +            public double evaluate(double i1, double i2) throws IllegalArgumentException {
 130.146 +                if (i1 < 0 || i1 > 1) {
 130.147 +                    throw new IllegalArgumentException ("Invalid input parameter: " + i1);
 130.148 +                }
 130.149 +                if (i2 < 0 || i2 > 1) {
 130.150 +                    throw new IllegalArgumentException ("Invalid input parameter: " + i2);
 130.151 +                }
 130.152 +                return i1 >= i2 ? 1 : 0;
 130.153 +            }
 130.154 +        };
 130.155 +    }
 130.156 +}
   131.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   131.2 +++ b/samples/apifest1/day2/subclassingsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
   131.3 @@ -0,0 +1,69 @@
   131.4 +<?xml version="1.0" encoding="UTF-8"?>
   131.5 +<!-- You may freely edit this file. See commented blocks below for -->
   131.6 +<!-- some examples of how to customize the build. -->
   131.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   131.8 +<project name="subclassingsolution" default="default" basedir=".">
   131.9 +    <description>Builds, tests, and runs the project boolcircuit.</description>
  131.10 +    <import file="nbproject/build-impl.xml"/>
  131.11 +    <!--
  131.12 +
  131.13 +    There exist several targets which are by default empty and which can be 
  131.14 +    used for execution of your tasks. These targets are usually executed 
  131.15 +    before and after some main targets. They are: 
  131.16 +
  131.17 +      -pre-init:                 called before initialization of project properties
  131.18 +      -post-init:                called after initialization of project properties
  131.19 +      -pre-compile:              called before javac compilation
  131.20 +      -post-compile:             called after javac compilation
  131.21 +      -pre-compile-single:       called before javac compilation of single file
  131.22 +      -post-compile-single:      called after javac compilation of single file
  131.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  131.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  131.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  131.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  131.27 +      -pre-jar:                  called before JAR building
  131.28 +      -post-jar:                 called after JAR building
  131.29 +      -post-clean:               called after cleaning build products
  131.30 +
  131.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  131.32 +
  131.33 +    Example of inserting an obfuscator after compilation could look like this:
  131.34 +
  131.35 +        <target name="-post-compile">
  131.36 +            <obfuscate>
  131.37 +                <fileset dir="${build.classes.dir}"/>
  131.38 +            </obfuscate>
  131.39 +        </target>
  131.40 +
  131.41 +    For list of available properties check the imported 
  131.42 +    nbproject/build-impl.xml file. 
  131.43 +
  131.44 +
  131.45 +    Another way to customize the build is by overriding existing main targets.
  131.46 +    The targets of interest are: 
  131.47 +
  131.48 +      -init-macrodef-javac:     defines macro for javac compilation
  131.49 +      -init-macrodef-junit:     defines macro for junit execution
  131.50 +      -init-macrodef-debug:     defines macro for class debugging
  131.51 +      -init-macrodef-java:      defines macro for class execution
  131.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  131.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  131.54 +      run:                      execution of project 
  131.55 +      -javadoc-build:           Javadoc generation
  131.56 +      test-report:              JUnit report generation
  131.57 +
  131.58 +    An example of overriding the target for project execution could look like this:
  131.59 +
  131.60 +        <target name="run" depends="boolcircuit-impl.jar">
  131.61 +            <exec dir="bin" executable="launcher.exe">
  131.62 +                <arg file="${dist.jar}"/>
  131.63 +            </exec>
  131.64 +        </target>
  131.65 +
  131.66 +    Notice that the overridden target depends on the jar target and not only on 
  131.67 +    the compile target as the regular run target does. Again, for a list of available 
  131.68 +    properties which you can use, check the target you are overriding in the
  131.69 +    nbproject/build-impl.xml file. 
  131.70 +
  131.71 +    -->
  131.72 +</project>
   132.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   132.2 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
   132.3 @@ -0,0 +1,547 @@
   132.4 +<?xml version="1.0" encoding="UTF-8"?>
   132.5 +<!--
   132.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   132.7 +***         EDIT ../build.xml INSTEAD         ***
   132.8 +
   132.9 +For the purpose of easier reading the script
  132.10 +is divided into following sections:
  132.11 +
  132.12 +  - initialization
  132.13 +  - compilation
  132.14 +  - jar
  132.15 +  - execution
  132.16 +  - debugging
  132.17 +  - javadoc
  132.18 +  - junit compilation
  132.19 +  - junit execution
  132.20 +  - junit debugging
  132.21 +  - applet
  132.22 +  - cleanup
  132.23 +
  132.24 +-->
  132.25 +<project name="subclassingsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
  132.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
  132.27 +    <!-- 
  132.28 +    ======================
  132.29 +    INITIALIZATION SECTION 
  132.30 +    ======================
  132.31 +    -->
  132.32 +    <target name="-pre-init">
  132.33 +        <!-- Empty placeholder for easier customization. -->
  132.34 +        <!-- You can override this target in the ../build.xml file. -->
  132.35 +    </target>
  132.36 +    <target name="-init-private" depends="-pre-init">
  132.37 +        <property file="nbproject/private/private.properties"/>
  132.38 +    </target>
  132.39 +    <target name="-init-user" depends="-pre-init,-init-private">
  132.40 +        <property file="${user.properties.file}"/>
  132.41 +        <!-- The two properties below are usually overridden -->
  132.42 +        <!-- by the active platform. Just a fallback. -->
  132.43 +        <property name="default.javac.source" value="1.4"/>
  132.44 +        <property name="default.javac.target" value="1.4"/>
  132.45 +    </target>
  132.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
  132.47 +        <property file="nbproject/project.properties"/>
  132.48 +    </target>
  132.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
  132.50 +        <available file="${manifest.file}" property="manifest.available"/>
  132.51 +        <condition property="manifest.available+main.class">
  132.52 +            <and>
  132.53 +                <isset property="manifest.available"/>
  132.54 +                <isset property="main.class"/>
  132.55 +                <not>
  132.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  132.57 +                </not>
  132.58 +            </and>
  132.59 +        </condition>
  132.60 +        <condition property="manifest.available+main.class+mkdist.available">
  132.61 +            <and>
  132.62 +                <istrue value="${manifest.available+main.class}"/>
  132.63 +                <isset property="libs.CopyLibs.classpath"/>
  132.64 +            </and>
  132.65 +        </condition>
  132.66 +        <condition property="have.tests">
  132.67 +            <or>
  132.68 +                <available file="${test.src.dir}"/>
  132.69 +            </or>
  132.70 +        </condition>
  132.71 +        <condition property="have.sources">
  132.72 +            <or>
  132.73 +                <available file="${src.dir}"/>
  132.74 +            </or>
  132.75 +        </condition>
  132.76 +        <condition property="netbeans.home+have.tests">
  132.77 +            <and>
  132.78 +                <isset property="netbeans.home"/>
  132.79 +                <isset property="have.tests"/>
  132.80 +            </and>
  132.81 +        </condition>
  132.82 +        <condition property="no.javadoc.preview">
  132.83 +            <isfalse value="${javadoc.preview}"/>
  132.84 +        </condition>
  132.85 +        <property name="run.jvmargs" value=""/>
  132.86 +        <property name="javac.compilerargs" value=""/>
  132.87 +        <property name="work.dir" value="${basedir}"/>
  132.88 +        <condition property="no.deps">
  132.89 +            <and>
  132.90 +                <istrue value="${no.dependencies}"/>
  132.91 +            </and>
  132.92 +        </condition>
  132.93 +        <property name="javac.debug" value="true"/>
  132.94 +        <property name="javadoc.preview" value="true"/>
  132.95 +        <property name="application.args" value=""/>
  132.96 +    </target>
  132.97 +    <target name="-post-init">
  132.98 +        <!-- Empty placeholder for easier customization. -->
  132.99 +        <!-- You can override this target in the ../build.xml file. -->
 132.100 +    </target>
 132.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
 132.102 +        <fail unless="src.dir">Must set src.dir</fail>
 132.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 132.104 +        <fail unless="build.dir">Must set build.dir</fail>
 132.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
 132.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 132.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 132.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 132.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 132.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 132.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
 132.112 +    </target>
 132.113 +    <target name="-init-macrodef-property">
 132.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 132.115 +            <attribute name="name"/>
 132.116 +            <attribute name="value"/>
 132.117 +            <sequential>
 132.118 +                <property name="@{name}" value="${@{value}}"/>
 132.119 +            </sequential>
 132.120 +        </macrodef>
 132.121 +    </target>
 132.122 +    <target name="-init-macrodef-javac">
 132.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 132.124 +            <attribute name="srcdir" default="${src.dir}"/>
 132.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
 132.126 +            <attribute name="classpath" default="${javac.classpath}"/>
 132.127 +            <attribute name="debug" default="${javac.debug}"/>
 132.128 +            <element name="customize" optional="true"/>
 132.129 +            <sequential>
 132.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
 132.131 +                    <classpath>
 132.132 +                        <path path="@{classpath}"/>
 132.133 +                    </classpath>
 132.134 +                </depend>
 132.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
 132.136 +                    <classpath>
 132.137 +                        <path path="@{classpath}"/>
 132.138 +                    </classpath>
 132.139 +                    <compilerarg line="${javac.compilerargs}"/>
 132.140 +                    <customize/>
 132.141 +                </javac>
 132.142 +            </sequential>
 132.143 +        </macrodef>
 132.144 +    </target>
 132.145 +    <target name="-init-macrodef-junit">
 132.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 132.147 +            <attribute name="includes" default="**/*Test.java"/>
 132.148 +            <sequential>
 132.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
 132.150 +                    <batchtest todir="${build.test.results.dir}">
 132.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
 132.152 +                    </batchtest>
 132.153 +                    <classpath>
 132.154 +                        <path path="${run.test.classpath}"/>
 132.155 +                    </classpath>
 132.156 +                    <syspropertyset>
 132.157 +                        <propertyref prefix="test-sys-prop."/>
 132.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
 132.159 +                    </syspropertyset>
 132.160 +                    <formatter type="brief" usefile="false"/>
 132.161 +                    <formatter type="xml"/>
 132.162 +                    <jvmarg line="${run.jvmargs}"/>
 132.163 +                </junit>
 132.164 +            </sequential>
 132.165 +        </macrodef>
 132.166 +    </target>
 132.167 +    <target name="-init-macrodef-nbjpda">
 132.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 132.169 +            <attribute name="name" default="${main.class}"/>
 132.170 +            <attribute name="classpath" default="${debug.classpath}"/>
 132.171 +            <attribute name="stopclassname" default=""/>
 132.172 +            <sequential>
 132.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
 132.174 +                    <classpath>
 132.175 +                        <path path="@{classpath}"/>
 132.176 +                    </classpath>
 132.177 +                </nbjpdastart>
 132.178 +            </sequential>
 132.179 +        </macrodef>
 132.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 132.181 +            <attribute name="dir" default="${build.classes.dir}"/>
 132.182 +            <sequential>
 132.183 +                <nbjpdareload>
 132.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
 132.185 +                </nbjpdareload>
 132.186 +            </sequential>
 132.187 +        </macrodef>
 132.188 +    </target>
 132.189 +    <target name="-init-macrodef-debug">
 132.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 132.191 +            <attribute name="classname" default="${main.class}"/>
 132.192 +            <attribute name="classpath" default="${debug.classpath}"/>
 132.193 +            <element name="customize" optional="true"/>
 132.194 +            <sequential>
 132.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 132.196 +                    <jvmarg value="-Xdebug"/>
 132.197 +                    <jvmarg value="-Xnoagent"/>
 132.198 +                    <jvmarg value="-Djava.compiler=none"/>
 132.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
 132.200 +                    <jvmarg line="${run.jvmargs}"/>
 132.201 +                    <classpath>
 132.202 +                        <path path="@{classpath}"/>
 132.203 +                    </classpath>
 132.204 +                    <syspropertyset>
 132.205 +                        <propertyref prefix="run-sys-prop."/>
 132.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 132.207 +                    </syspropertyset>
 132.208 +                    <customize/>
 132.209 +                </java>
 132.210 +            </sequential>
 132.211 +        </macrodef>
 132.212 +    </target>
 132.213 +    <target name="-init-macrodef-java">
 132.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 132.215 +            <attribute name="classname" default="${main.class}"/>
 132.216 +            <element name="customize" optional="true"/>
 132.217 +            <sequential>
 132.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 132.219 +                    <jvmarg line="${run.jvmargs}"/>
 132.220 +                    <classpath>
 132.221 +                        <path path="${run.classpath}"/>
 132.222 +                    </classpath>
 132.223 +                    <syspropertyset>
 132.224 +                        <propertyref prefix="run-sys-prop."/>
 132.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 132.226 +                    </syspropertyset>
 132.227 +                    <customize/>
 132.228 +                </java>
 132.229 +            </sequential>
 132.230 +        </macrodef>
 132.231 +    </target>
 132.232 +    <target name="-init-presetdef-jar">
 132.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 132.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
 132.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 132.236 +            </jar>
 132.237 +        </presetdef>
 132.238 +    </target>
 132.239 +    <target name="init" 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"/>
 132.240 +    <!--
 132.241 +    ===================
 132.242 +    COMPILATION SECTION
 132.243 +    ===================
 132.244 +    -->
 132.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
 132.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
 132.247 +        <mkdir dir="${build.classes.dir}"/>
 132.248 +    </target>
 132.249 +    <target name="-pre-compile">
 132.250 +        <!-- Empty placeholder for easier customization. -->
 132.251 +        <!-- You can override this target in the ../build.xml file. -->
 132.252 +    </target>
 132.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
 132.254 +        <j2seproject3:javac/>
 132.255 +        <copy todir="${build.classes.dir}">
 132.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
 132.257 +        </copy>
 132.258 +    </target>
 132.259 +    <target name="-post-compile">
 132.260 +        <!-- Empty placeholder for easier customization. -->
 132.261 +        <!-- You can override this target in the ../build.xml file. -->
 132.262 +    </target>
 132.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
 132.264 +    <target name="-pre-compile-single">
 132.265 +        <!-- Empty placeholder for easier customization. -->
 132.266 +        <!-- You can override this target in the ../build.xml file. -->
 132.267 +    </target>
 132.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
 132.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 132.270 +        <j2seproject3:javac>
 132.271 +            <customize>
 132.272 +                <patternset includes="${javac.includes}"/>
 132.273 +            </customize>
 132.274 +        </j2seproject3:javac>
 132.275 +    </target>
 132.276 +    <target name="-post-compile-single">
 132.277 +        <!-- Empty placeholder for easier customization. -->
 132.278 +        <!-- You can override this target in the ../build.xml file. -->
 132.279 +    </target>
 132.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
 132.281 +    <!--
 132.282 +    ====================
 132.283 +    JAR BUILDING SECTION
 132.284 +    ====================
 132.285 +    -->
 132.286 +    <target name="-pre-pre-jar" depends="init">
 132.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
 132.288 +        <mkdir dir="${dist.jar.dir}"/>
 132.289 +    </target>
 132.290 +    <target name="-pre-jar">
 132.291 +        <!-- Empty placeholder for easier customization. -->
 132.292 +        <!-- You can override this target in the ../build.xml file. -->
 132.293 +    </target>
 132.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
 132.295 +        <j2seproject1:jar/>
 132.296 +    </target>
 132.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
 132.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
 132.299 +    </target>
 132.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
 132.301 +        <j2seproject1:jar manifest="${manifest.file}">
 132.302 +            <j2seproject1:manifest>
 132.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 132.304 +            </j2seproject1:manifest>
 132.305 +        </j2seproject1:jar>
 132.306 +        <echo>To run this application from the command line without Ant, try:</echo>
 132.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 132.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 132.309 +        <pathconvert property="run.classpath.with.dist.jar">
 132.310 +            <path path="${run.classpath}"/>
 132.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 132.312 +        </pathconvert>
 132.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 132.314 +    </target>
 132.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
 132.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 132.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
 132.318 +            <path path="${run.classpath}"/>
 132.319 +            <map from="${build.classes.dir.resolved}" to=""/>
 132.320 +        </pathconvert>
 132.321 +        <pathconvert property="jar.classpath" pathsep=" ">
 132.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
 132.323 +            <chainedmapper>
 132.324 +                <flattenmapper/>
 132.325 +                <globmapper from="*" to="lib/*"/>
 132.326 +            </chainedmapper>
 132.327 +        </pathconvert>
 132.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
 132.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
 132.330 +            <fileset dir="${build.classes.dir}"/>
 132.331 +            <manifest>
 132.332 +                <attribute name="Main-Class" value="${main.class}"/>
 132.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 132.334 +            </manifest>
 132.335 +        </copylibs>
 132.336 +        <echo>To run this application from the command line without Ant, try:</echo>
 132.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 132.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 132.339 +    </target>
 132.340 +    <target name="-post-jar">
 132.341 +        <!-- Empty placeholder for easier customization. -->
 132.342 +        <!-- You can override this target in the ../build.xml file. -->
 132.343 +    </target>
 132.344 +    <target name="jar" 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."/>
 132.345 +    <!--
 132.346 +    =================
 132.347 +    EXECUTION SECTION
 132.348 +    =================
 132.349 +    -->
 132.350 +    <target name="run" depends="init,compile" description="Run a main class.">
 132.351 +        <j2seproject1:java>
 132.352 +            <customize>
 132.353 +                <arg line="${application.args}"/>
 132.354 +            </customize>
 132.355 +        </j2seproject1:java>
 132.356 +    </target>
 132.357 +    <target name="run-single" depends="init,compile-single">
 132.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 132.359 +        <j2seproject1:java classname="${run.class}"/>
 132.360 +    </target>
 132.361 +    <!--
 132.362 +    =================
 132.363 +    DEBUGGING SECTION
 132.364 +    =================
 132.365 +    -->
 132.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
 132.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 132.368 +    </target>
 132.369 +    <target name="-debug-start-debuggee" depends="init,compile">
 132.370 +        <j2seproject3:debug>
 132.371 +            <customize>
 132.372 +                <arg line="${application.args}"/>
 132.373 +            </customize>
 132.374 +        </j2seproject3:debug>
 132.375 +    </target>
 132.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
 132.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
 132.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 132.379 +    </target>
 132.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
 132.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
 132.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 132.383 +        <j2seproject3:debug classname="${debug.class}"/>
 132.384 +    </target>
 132.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
 132.386 +    <target name="-pre-debug-fix" depends="init">
 132.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
 132.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
 132.389 +    </target>
 132.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
 132.391 +        <j2seproject1:nbjpdareload/>
 132.392 +    </target>
 132.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
 132.394 +    <!--
 132.395 +    ===============
 132.396 +    JAVADOC SECTION
 132.397 +    ===============
 132.398 +    -->
 132.399 +    <target name="-javadoc-build" depends="init">
 132.400 +        <mkdir dir="${dist.javadoc.dir}"/>
 132.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
 132.402 +            <classpath>
 132.403 +                <path path="${javac.classpath}"/>
 132.404 +            </classpath>
 132.405 +            <sourcepath>
 132.406 +                <pathelement location="${src.dir}"/>
 132.407 +            </sourcepath>
 132.408 +            <packageset dir="${src.dir}" includes="*/**"/>
 132.409 +            <fileset dir="${src.dir}" includes="*.java"/>
 132.410 +        </javadoc>
 132.411 +    </target>
 132.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
 132.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 132.414 +    </target>
 132.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
 132.416 +    <!--
 132.417 +    =========================
 132.418 +    JUNIT COMPILATION SECTION
 132.419 +    =========================
 132.420 +    -->
 132.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
 132.422 +        <mkdir dir="${build.test.classes.dir}"/>
 132.423 +    </target>
 132.424 +    <target name="-pre-compile-test">
 132.425 +        <!-- Empty placeholder for easier customization. -->
 132.426 +        <!-- You can override this target in the ../build.xml file. -->
 132.427 +    </target>
 132.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
 132.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
 132.430 +        <copy todir="${build.test.classes.dir}">
 132.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 132.432 +        </copy>
 132.433 +    </target>
 132.434 +    <target name="-post-compile-test">
 132.435 +        <!-- Empty placeholder for easier customization. -->
 132.436 +        <!-- You can override this target in the ../build.xml file. -->
 132.437 +    </target>
 132.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
 132.439 +    <target name="-pre-compile-test-single">
 132.440 +        <!-- Empty placeholder for easier customization. -->
 132.441 +        <!-- You can override this target in the ../build.xml file. -->
 132.442 +    </target>
 132.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
 132.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 132.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
 132.446 +            <customize>
 132.447 +                <patternset includes="${javac.includes}"/>
 132.448 +            </customize>
 132.449 +        </j2seproject3:javac>
 132.450 +        <copy todir="${build.test.classes.dir}">
 132.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 132.452 +        </copy>
 132.453 +    </target>
 132.454 +    <target name="-post-compile-test-single">
 132.455 +        <!-- Empty placeholder for easier customization. -->
 132.456 +        <!-- You can override this target in the ../build.xml file. -->
 132.457 +    </target>
 132.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
 132.459 +    <!--
 132.460 +    =======================
 132.461 +    JUNIT EXECUTION SECTION
 132.462 +    =======================
 132.463 +    -->
 132.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
 132.465 +        <mkdir dir="${build.test.results.dir}"/>
 132.466 +    </target>
 132.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
 132.468 +        <j2seproject3:junit/>
 132.469 +    </target>
 132.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
 132.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 132.472 +    </target>
 132.473 +    <target name="test-report" if="have.tests" depends="init"/>
 132.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
 132.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
 132.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
 132.477 +        <mkdir dir="${build.test.results.dir}"/>
 132.478 +    </target>
 132.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
 132.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 132.481 +        <j2seproject3:junit includes="${test.includes}"/>
 132.482 +    </target>
 132.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
 132.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 132.485 +    </target>
 132.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
 132.487 +    <!--
 132.488 +    =======================
 132.489 +    JUNIT DEBUGGING SECTION
 132.490 +    =======================
 132.491 +    -->
 132.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
 132.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 132.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
 132.495 +            <customize>
 132.496 +                <arg line="${test.class}"/>
 132.497 +            </customize>
 132.498 +        </j2seproject3:debug>
 132.499 +    </target>
 132.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
 132.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
 132.502 +    </target>
 132.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
 132.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
 132.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 132.506 +    </target>
 132.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
 132.508 +    <!--
 132.509 +    =========================
 132.510 +    APPLET EXECUTION SECTION
 132.511 +    =========================
 132.512 +    -->
 132.513 +    <target name="run-applet" depends="init,compile-single">
 132.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 132.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 132.516 +            <customize>
 132.517 +                <arg value="${applet.url}"/>
 132.518 +            </customize>
 132.519 +        </j2seproject1:java>
 132.520 +    </target>
 132.521 +    <!--
 132.522 +    =========================
 132.523 +    APPLET DEBUGGING  SECTION
 132.524 +    =========================
 132.525 +    -->
 132.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
 132.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 132.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 132.529 +            <customize>
 132.530 +                <arg value="${applet.url}"/>
 132.531 +            </customize>
 132.532 +        </j2seproject3:debug>
 132.533 +    </target>
 132.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
 132.535 +    <!--
 132.536 +    ===============
 132.537 +    CLEANUP SECTION
 132.538 +    ===============
 132.539 +    -->
 132.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
 132.541 +    <target name="-do-clean" depends="init">
 132.542 +        <delete dir="${build.dir}"/>
 132.543 +        <delete dir="${dist.dir}"/>
 132.544 +    </target>
 132.545 +    <target name="-post-clean">
 132.546 +        <!-- Empty placeholder for easier customization. -->
 132.547 +        <!-- You can override this target in the ../build.xml file. -->
 132.548 +    </target>
 132.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
 132.550 +</project>
   133.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   133.2 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
   133.3 @@ -0,0 +1,8 @@
   133.4 +build.xml.data.CRC32=2ab820eb
   133.5 +build.xml.script.CRC32=58a52595
   133.6 +build.xml.stylesheet.CRC32=a12b3d02
   133.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   133.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   133.9 +nbproject/build-impl.xml.data.CRC32=0f6dc18a
  133.10 +nbproject/build-impl.xml.script.CRC32=079f4b62
  133.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
   134.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   134.2 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
   134.3 @@ -0,0 +1,54 @@
   134.4 +build.classes.dir=${build.dir}/classes
   134.5 +build.classes.excludes=**/*.java,**/*.form
   134.6 +# This directory is removed when the project is cleaned:
   134.7 +build.dir=build
   134.8 +build.generated.dir=${build.dir}/generated
   134.9 +# Only compile against the classpath explicitly listed here:
  134.10 +build.sysclasspath=ignore
  134.11 +build.test.classes.dir=${build.dir}/test/classes
  134.12 +build.test.results.dir=${build.dir}/test/results
  134.13 +debug.classpath=\
  134.14 +    ${run.classpath}
  134.15 +debug.test.classpath=\
  134.16 +    ${run.test.classpath}
  134.17 +# This directory is removed when the project is cleaned:
  134.18 +dist.dir=dist
  134.19 +dist.jar=${dist.dir}/boolcircuit.jar
  134.20 +dist.javadoc.dir=${dist.dir}/javadoc
  134.21 +jar.compress=false
  134.22 +javac.classpath=
  134.23 +# Space-separated list of extra javac options
  134.24 +javac.compilerargs=
  134.25 +javac.deprecation=false
  134.26 +javac.source=1.5
  134.27 +javac.target=1.5
  134.28 +javac.test.classpath=\
  134.29 +    ${javac.classpath}:\
  134.30 +    ${build.classes.dir}:\
  134.31 +    ${libs.junit.classpath}
  134.32 +javadoc.additionalparam=
  134.33 +javadoc.author=false
  134.34 +javadoc.encoding=
  134.35 +javadoc.noindex=false
  134.36 +javadoc.nonavbar=false
  134.37 +javadoc.notree=false
  134.38 +javadoc.private=false
  134.39 +javadoc.splitindex=true
  134.40 +javadoc.use=true
  134.41 +javadoc.version=false
  134.42 +javadoc.windowtitle=
  134.43 +meta.inf.dir=${src.dir}/META-INF
  134.44 +platform.active=default_platform
  134.45 +run.classpath=\
  134.46 +    ${javac.classpath}:\
  134.47 +    ${build.classes.dir}
  134.48 +# Space-separated list of JVM arguments used when running the project
  134.49 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  134.50 +# or test-sys-prop.name=value to set system properties for unit tests):
  134.51 +run.jvmargs=
  134.52 +run.test.classpath=\
  134.53 +    ${javac.test.classpath}:\
  134.54 +    ${build.test.classes.dir}
  134.55 +src.dir=src
  134.56 +test.src.dir=test
  134.57 +libs.junit.classpath=../../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
   135.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   135.2 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   135.3 @@ -0,0 +1,16 @@
   135.4 +<?xml version="1.0" encoding="UTF-8"?>
   135.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   135.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   135.7 +    <configuration>
   135.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   135.9 +            <name>subclassingsolution</name>
  135.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  135.11 +            <source-roots>
  135.12 +                <root id="src.dir"/>
  135.13 +            </source-roots>
  135.14 +            <test-roots>
  135.15 +                <root id="test.src.dir"/>
  135.16 +            </test-roots>
  135.17 +        </data>
  135.18 +    </configuration>
  135.19 +</project>
   136.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   136.2 +++ b/samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
   136.3 @@ -0,0 +1,90 @@
   136.4 +/*
   136.5 + * The contents of this file are subject to the terms of the Common Development
   136.6 + * and Distribution License (the License). You may not use this file except in
   136.7 + * compliance with the License.
   136.8 + *
   136.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  136.10 + * or http://www.netbeans.org/cddl.txt.
  136.11 + *
  136.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  136.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  136.14 + * If applicable, add the following below the CDDL Header, with the fields
  136.15 + * enclosed by brackets [] replaced by your own identifying information:
  136.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  136.17 + *
  136.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  136.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  136.20 + * Microsystems, Inc. All Rights Reserved.
  136.21 + */
  136.22 +
  136.23 +package org.netbeans.apifest.boolcircuit;
  136.24 +
  136.25 +
  136.26 +/** Usefull class for building your own circuits. 
  136.27 + * </br>
  136.28 + *  Notice that this API nobly generously permits using operator overloading
  136.29 + *  </br>
  136.30 + *  :-) Sometimes when you find an unfixable bug. The best thing to do is to 
  136.31 + *  make it a fature.
  136.32 + * 
  136.33 + */
  136.34 +public abstract class Circuit extends Object {
  136.35 +    
  136.36 +    /** For your conveninece */   
  136.37 +    public static FuzzyCircuit AND = new FuzzyCircuit() {
  136.38 +
  136.39 +        @Override
  136.40 +        public boolean evaluate(boolean[] in) {
  136.41 +            checkParams( 2, in );
  136.42 +            return in[0] && in[1];
  136.43 +        }
  136.44 +
  136.45 +        public double evaluate(double[] in) {
  136.46 +            checkParams( 2, in );
  136.47 +            return in[0] * in[1];
  136.48 +        }
  136.49 +        
  136.50 +    };
  136.51 +    
  136.52 +    /** For your conveninece */
  136.53 +    public static FuzzyCircuit OR = new FuzzyCircuit() {
  136.54 +
  136.55 +        @Override
  136.56 +        public boolean evaluate(boolean[] in) {
  136.57 +            checkParams( 2, in );            
  136.58 +            return in[0] || in[1];
  136.59 +        }
  136.60 +
  136.61 +        @Override
  136.62 +        public double evaluate(double[] in) {
  136.63 +            checkParams( 2, in );            
  136.64 +            return 1 - (1 - in[0]) * (1 - in[1]);
  136.65 +        }
  136.66 +    };
  136.67 +    
  136.68 +    
  136.69 +    /** For your conveninece */
  136.70 +    public static FuzzyCircuit NOT = new FuzzyCircuit() {
  136.71 +
  136.72 +        @Override
  136.73 +        public boolean evaluate(boolean[] in) {
  136.74 +            checkParams( 1, in );            
  136.75 +            return !in[0];
  136.76 +        }
  136.77 +
  136.78 +        @Override
  136.79 +        public double evaluate(double[] in) {
  136.80 +            checkParams( 1, in );            
  136.81 +            return 1 - in[0];
  136.82 +        }
  136.83 +        
  136.84 +        
  136.85 +    };
  136.86 +            
  136.87 +    /** Feel free to implement and don't hesitate to throw IllegalArgumentEception 
  136.88 +     */
  136.89 +    public abstract boolean evaluate(boolean... in);
  136.90 +        
  136.91 +    
  136.92 +    
  136.93 +}
   137.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   137.2 +++ b/samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/FuzzyCircuit.java	Sat Jun 14 09:52:45 2008 +0200
   137.3 @@ -0,0 +1,58 @@
   137.4 +/*
   137.5 + * FuzzyCircuit.java
   137.6 + *
   137.7 + * Created on July 13, 2006, 2:31 PM
   137.8 + *
   137.9 + * To change this template, choose Tools | Template Manager
  137.10 + * and open the template in the editor.
  137.11 + */
  137.12 +
  137.13 +package org.netbeans.apifest.boolcircuit;
  137.14 +
  137.15 +/**
  137.16 + *
  137.17 + * @author phrebejk
  137.18 + */
  137.19 +public abstract class FuzzyCircuit extends Circuit {
  137.20 +    
  137.21 +    /** Feel free to implement and don't hesitate to throw IllegalArgumentEception 
  137.22 +     */
  137.23 +    public abstract double evaluate(double... in);
  137.24 +    
  137.25 +    public static final void checkParams( int expectedLenght, boolean... in  ) {
  137.26 +        
  137.27 +        // :-) in real world add a test for null too
  137.28 +        
  137.29 +        if (expectedLenght != in.length) {
  137.30 +            
  137.31 +            // :-) Probably unnecessary unless this is a competition 
  137.32 +            switch ( expectedLenght ) {
  137.33 +                case 1:
  137.34 +                    throw new IllegalArgumentException("Should have one parameter");
  137.35 +                case 2:
  137.36 +                    throw new IllegalArgumentException("Should have two parameters");
  137.37 +                default:
  137.38 +                    throw new IllegalArgumentException("Wrong number of parameters!");
  137.39 +            }                       
  137.40 +        }
  137.41 +    }
  137.42 +    
  137.43 +    public static final void checkParams( int expectedLenght, double ... in ) {
  137.44 +        if ( in == null ) {
  137.45 +            throw new IllegalArgumentException( "Parameter in must not be null!");
  137.46 +        }
  137.47 +        if (expectedLenght != in.length) {
  137.48 +            throw new IllegalArgumentException("Wrong number of parameters!");
  137.49 +        }
  137.50 +        
  137.51 +        for( int i = 0; i < in.length; i++ ) {
  137.52 +            if ( in[i] < 0.0 || in[i] > 1.0 ) {
  137.53 +                throw new IllegalArgumentException( 
  137.54 +                        "All params have to be in the range <0.0, 1.0>! " +
  137.55 +                        "param at index " + i + " is " + in[i]);
  137.56 +            }
  137.57 +        }
  137.58 +        
  137.59 +    }
  137.60 +          
  137.61 +}
   138.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   138.2 +++ b/samples/apifest1/day2/subclassingsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   138.3 @@ -0,0 +1,136 @@
   138.4 +/*
   138.5 + * The contents of this file are subject to the terms of the Common Development
   138.6 + * and Distribution License (the License). You may not use this file except in
   138.7 + * compliance with the License.
   138.8 + *
   138.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  138.10 + * or http://www.netbeans.org/cddl.txt.
  138.11 + *
  138.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  138.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  138.14 + * If applicable, add the following below the CDDL Header, with the fields
  138.15 + * enclosed by brackets [] replaced by your own identifying information:
  138.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  138.17 + *
  138.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  138.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  138.20 + * Microsystems, Inc. All Rights Reserved.
  138.21 + */
  138.22 +
  138.23 +package org.netbeans.apifest.boolcircuit;
  138.24 +
  138.25 +import java.security.CodeSource;
  138.26 +import java.security.Permission;
  138.27 +import java.security.PermissionCollection;
  138.28 +import java.security.Policy;
  138.29 +import java.util.Collection;
  138.30 +import java.util.Collections;
  138.31 +import java.util.Enumeration;
  138.32 +import junit.framework.TestCase;
  138.33 +import junit.framework.*;
  138.34 +
  138.35 +import static org.netbeans.apifest.boolcircuit.Circuit.*;
  138.36 +
  138.37 +/** The initial quest for this APIFest is to create an API for boolean 
  138.38 + * circuits. Such API shall be able to compose a boolean circuit from
  138.39 + * basic elements and evaluate the result given initial values for 
  138.40 + * input variables.
  138.41 + * <p>
  138.42 + * The basic elements include:
  138.43 + * <ul>
  138.44 + *   <li>negation - has one input and one output and changes 0 on input to 
  138.45 + *          on output 1 and 1 to 0
  138.46 + *   <li>and - has two inputs and one output. The output is 1 only if both 
  138.47 + *          inputs are 1, otherwise it is 0
  138.48 + *   <li>or - has two inputs and one output. The output is 1 always, except
  138.49 + *          in the case when both inputs are 0
  138.50 + * </ul>
  138.51 + *
  138.52 + * <p>
  138.53 + * The boolean circuit can be used to represent boolean formulas and compute
  138.54 + * the results for certain values of its inputs. The individual tasks described
  138.55 + * as tests bellow.
  138.56 + *
  138.57 + * <p>
  138.58 + * Links of interest:
  138.59 + * <ul>
  138.60 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
  138.61 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
  138.62 + * </ul>
  138.63 + */
  138.64 +public class CircuitTest extends TestCase {
  138.65 +    
  138.66 +    
  138.67 +    
  138.68 +    static {
  138.69 +        // your code shall run without any permissions
  138.70 +    }
  138.71 +    
  138.72 +    public CircuitTest(String testName) {
  138.73 +        super(testName);
  138.74 +    }
  138.75 +
  138.76 +    protected void setUp() throws Exception {
  138.77 +    }
  138.78 +
  138.79 +    protected void tearDown() throws Exception {
  138.80 +    }
  138.81 +    
  138.82 +    
  138.83 +    /** 
  138.84 +     * Create a circuit to evaluate x1 and x2 and then
  138.85 +     * verify that its result is false for input (false, true) and
  138.86 +     * it is true for input (true, true).
  138.87 +     */
  138.88 +    public void testX1andX2() {
  138.89 +                
  138.90 +        assertFalse( AND.evaluate( false, true ));
  138.91 +        assertTrue( AND.evaluate( true, true ));
  138.92 +    }
  138.93 +    
  138.94 +    /** 
  138.95 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  138.96 +     * verify that its result is false for input (false, true, false) and
  138.97 +     * it is true for input (false, false, true).
  138.98 +     */
  138.99 +    public void testX1andX2orX3() {
 138.100 +        
 138.101 +        Circuit c = new Circuit() {
 138.102 +
 138.103 +            @Override
 138.104 +            public boolean evaluate(boolean[] in) {
 138.105 +                if ( in.length != 3) {
 138.106 +                    throw new IllegalArgumentException( "Should have one parameter");
 138.107 +                }
 138.108 +                return OR.evaluate( AND.evaluate( in[0], in[1] ), in[2] );
 138.109 +            }
 138.110 +            
 138.111 +        };
 138.112 +        
 138.113 +        assertFalse( c.evaluate( false, true, false ) );
 138.114 +        assertTrue( c.evaluate(  false, false, true ) );
 138.115 +        
 138.116 +    }
 138.117 +    /** 
 138.118 +     * Create a circuit to evaluate (x1 or not(x1)) and then
 138.119 +     * verify that its result is true for all values of x1.
 138.120 +     */
 138.121 +    public void testAlwaysTrue() {    
 138.122 +        
 138.123 +        Circuit c = new Circuit() {
 138.124 +
 138.125 +            @Override
 138.126 +            public boolean evaluate(boolean[] in) {
 138.127 +                if ( in.length != 1) {
 138.128 +                    throw new IllegalArgumentException( "Should have three parameters");
 138.129 +                }
 138.130 +                return OR.evaluate( in[0], NOT.evaluate( in[0] ) );
 138.131 +            }
 138.132 +            
 138.133 +        };
 138.134 +                
 138.135 +        assertTrue( c.evaluate( true ) );
 138.136 +        assertTrue( c.evaluate( false ) );
 138.137 +    }
 138.138 +    
 138.139 +}
   139.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   139.2 +++ b/samples/apifest1/day2/subclassingsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
   139.3 @@ -0,0 +1,242 @@
   139.4 +/*
   139.5 + * The contents of this file are subject to the terms of the Common Development
   139.6 + * and Distribution License (the License). You may not use this file except in
   139.7 + * compliance with the License.
   139.8 + *
   139.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  139.10 + * or http://www.netbeans.org/cddl.txt.
  139.11 + *
  139.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  139.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  139.14 + * If applicable, add the following below the CDDL Header, with the fields
  139.15 + * enclosed by brackets [] replaced by your own identifying information:
  139.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  139.17 + *
  139.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  139.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  139.20 + * Microsystems, Inc. All Rights Reserved.
  139.21 + */
  139.22 +
  139.23 +package org.netbeans.apifest.boolcircuit;
  139.24 +
  139.25 +import java.security.CodeSource;
  139.26 +import java.security.Permission;
  139.27 +import java.security.PermissionCollection;
  139.28 +import java.security.Policy;
  139.29 +import java.util.Collection;
  139.30 +import java.util.Collections;
  139.31 +import java.util.Enumeration;
  139.32 +import junit.framework.TestCase;
  139.33 +import junit.framework.*;
  139.34 +
  139.35 +/** This file contains the APIFest quest for day 2. Simply, turn the 
  139.36 + * boolean circuit into circuit that can compute with double values from 0 to 1.
  139.37 + * <p>
  139.38 + * This means that where ever a boolean was used to represent input or 
  139.39 + * output values, one can now use any double number from >= 0 and <= 1.
  139.40 + * Still, to support backward compatibility, the operations with booleans
  139.41 + * has to be kept available and have to work. In fact False shall be 
  139.42 + * treated as 0 and True as 1.
  139.43 + * <p>
  139.44 + * The basic elements has to be modified to work on doubles in the following
  139.45 + * way:
  139.46 + * <ul>
  139.47 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
  139.48 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
  139.49 + *             and(false,true)=0*1=0=false
  139.50 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
  139.51 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
  139.52 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
  139.53 + * </ul>
  139.54 + * <p>
  139.55 + * However as the circuits with doubles are more rich than plain boolean circuits,
  139.56 + * there is additional requirement to allow any user of your API to write its 
  139.57 + * own "element" type. This is all going to be exercise in the tests bellow
  139.58 + * which you are supposed to implement.
  139.59 + */
  139.60 +public class RealTest extends TestCase {
  139.61 +    static {
  139.62 +        // your code shall run without any permissions
  139.63 +    }
  139.64 +    
  139.65 +    public RealTest(String testName) {
  139.66 +        super(testName);
  139.67 +    }
  139.68 +
  139.69 +    protected void setUp() throws Exception {
  139.70 +    }
  139.71 +
  139.72 +    protected void tearDown() throws Exception {
  139.73 +    }
  139.74 +    
  139.75 +    
  139.76 +    
  139.77 +    /** First of all create a circuit which will evaluate
  139.78 +     * expression (X1 and X2) or not(x1). Hold the circuit
  139.79 +     * in some variable.
  139.80 +     *
  139.81 +     * Feed this circuit with x1=true, x2=false, assert result is false
  139.82 +     *
  139.83 +     * Feed the same circuit with x1=false, x2=true, assert result is true
  139.84 +     *
  139.85 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
  139.86 +     *
  139.87 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
  139.88 +     *
  139.89 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
  139.90 +     */
  139.91 +    public void testX1andX2orNotX1() {
  139.92 +        FuzzyCircuit c = new CircuitSupport( 2 ) {
  139.93 +
  139.94 +            @Override
  139.95 +            public boolean ev(boolean[] in) {                
  139.96 +                return OR.evaluate( AND.evaluate( in[0], in[1] ), NOT.evaluate( in[0] ) );
  139.97 +            }
  139.98 +            
  139.99 +            @Override
 139.100 +            public double ev(double[] in) {
 139.101 +                return OR.evaluate( AND.evaluate( in[0], in[1] ), NOT.evaluate( in[0] ) );
 139.102 +            }
 139.103 +            
 139.104 +        };
 139.105 +        
 139.106 +        assertFalse( c.evaluate(true, false) );
 139.107 +        assertTrue( c.evaluate(false, true) );
 139.108 +        assertEquals(c.evaluate(0.0, 1.0), 1.0, 0.0001);
 139.109 +        assertEquals(c.evaluate(0.5, 0.5), 0.625, 0.0001);
 139.110 +        try {
 139.111 +            c.evaluate(0.0, 2.0);
 139.112 +        }
 139.113 +        catch ( IllegalArgumentException e ) {
 139.114 +            return;
 139.115 +        }
 139.116 +        fail();
 139.117 +    }
 139.118 +    
 139.119 +    /** Ensure that one variable cannot be filled with two different values.
 139.120 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
 139.121 +     * API that would not lead to x1 * x1 result, an exception is thrown.
 139.122 +     * For example if there was a way to feed the circuit with two different 
 139.123 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
 139.124 +     * improper use of the circuit.
 139.125 +     */
 139.126 +    public void testImproperUseOfTheCircuit() {
 139.127 +        FuzzyCircuit c = new CircuitSupport( 1 ) {
 139.128 +
 139.129 +            @Override
 139.130 +            public boolean ev(boolean[] in) {                
 139.131 +                return AND.evaluate( in[0], in[0] );
 139.132 +            }
 139.133 +            
 139.134 +            @Override
 139.135 +            public double ev(double[] in) {
 139.136 +                return AND.evaluate( in[0], in[0] );
 139.137 +            }
 139.138 +            
 139.139 +        };
 139.140 +        
 139.141 +        // Empty array        
 139.142 +        IllegalArgumentException ex = null;        
 139.143 +        try {
 139.144 +            c.evaluate(new boolean[]{} );
 139.145 +        } catch ( IllegalArgumentException e) {
 139.146 +            ex = e ;
 139.147 +        }
 139.148 +        if ( ex == null ) {
 139.149 +            fail();
 139.150 +        }
 139.151 +        
 139.152 +        // Other sizes
 139.153 +        int MAX = 4;    // :-) This test obviously requires a nonsese. 
 139.154 +                        // For testing nonsese Integer.MAX_VALUE
 139.155 +        for( int i = 2; i < MAX ; i++ ) {
 139.156 +            double a[] = new double[i];
 139.157 +            ex = null; 
 139.158 +            try {
 139.159 +                c.evaluate( a );
 139.160 +            }
 139.161 +            catch ( IllegalArgumentException e) {
 139.162 +                ex = e ;
 139.163 +            }
 139.164 +            if ( ex == null ) {
 139.165 +                fail();
 139.166 +            }
 139.167 +        }
 139.168 +        
 139.169 +    }
 139.170 +    
 139.171 +    /** Write your own element type called "gte" that will have two inputs and one output.
 139.172 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
 139.173 +     * 
 139.174 +     * Create 
 139.175 +     * circuit for following expression: (x1 and not(x1)) gte x1
 139.176 +     *
 139.177 +     * Feed the circuit with 0.5 and verify the result is 0
 139.178 +     *
 139.179 +     * Feed the same circuit with 1 and verify the result is 0
 139.180 +     *
 139.181 +     * Feed the same circuit with 0 and verify the result is 1
 139.182 +     */
 139.183 +    public void testGreaterThanEqualElement() {
 139.184 +        final FuzzyCircuit gte = new CircuitSupport( 2 ) {
 139.185 +
 139.186 +            // Assumes true > false
 139.187 +            @Override
 139.188 +            public boolean ev(boolean[] in) {                
 139.189 +                return in[0] || ( !in[0] && in[1] ); // May be
 139.190 +            }
 139.191 +            
 139.192 +            @Override
 139.193 +            public double ev(double[] in) {
 139.194 +                return in[0] >= in[1] ? 1.0 : 0.0;
 139.195 +            }
 139.196 +                                  
 139.197 +        };
 139.198 +        
 139.199 +        FuzzyCircuit c = new CircuitSupport( 1 ) {
 139.200 +
 139.201 +            // Assumes true > false
 139.202 +            @Override
 139.203 +            public boolean ev(boolean[] in) {                
 139.204 +                return gte.evaluate( AND.evaluate( in[0], NOT.evaluate( in[0] ) ), in[0]);
 139.205 +            }
 139.206 +            
 139.207 +            @Override
 139.208 +            public double ev(double[] in) {
 139.209 +                return gte.evaluate( AND.evaluate( in[0], NOT.evaluate( in[0] ) ), in[0]);
 139.210 +            }
 139.211 +                                  
 139.212 +        };
 139.213 +        
 139.214 +        
 139.215 +        assertEquals(c.evaluate(0.5), 0.0, 0.0001);
 139.216 +        assertEquals(c.evaluate(1.0), 0.0, 0.0001);
 139.217 +        assertEquals(c.evaluate(0.0), 1.0, 0.0001);
 139.218 +        
 139.219 +    }
 139.220 +    
 139.221 +       
 139.222 +    private abstract static class CircuitSupport extends FuzzyCircuit {
 139.223 +    
 139.224 +        private int paramCount;
 139.225 +        
 139.226 +        CircuitSupport( int paramCount ) {
 139.227 +            this.paramCount = paramCount;
 139.228 +        }
 139.229 +                
 139.230 +        abstract boolean ev( boolean in[] );
 139.231 +        abstract double ev( double in[] );
 139.232 +        
 139.233 +        public boolean evaluate(boolean[] in) {
 139.234 +            checkParams( paramCount, in );
 139.235 +            return ev( in );
 139.236 +        }
 139.237 +                        
 139.238 +        public double evaluate(double[] in) {
 139.239 +            checkParams( paramCount, in );
 139.240 +            return ev( in );
 139.241 +        }
 139.242 +        
 139.243 +    }
 139.244 +    
 139.245 +}
   140.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   140.2 +++ b/samples/apifest1/day2/welltestedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
   140.3 @@ -0,0 +1,69 @@
   140.4 +<?xml version="1.0" encoding="UTF-8"?>
   140.5 +<!-- You may freely edit this file. See commented blocks below for -->
   140.6 +<!-- some examples of how to customize the build. -->
   140.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
   140.8 +<project name="welltestedsolution" default="default" basedir=".">
   140.9 +    <description>Builds, tests, and runs the project welltestedsolution.</description>
  140.10 +    <import file="nbproject/build-impl.xml"/>
  140.11 +    <!--
  140.12 +
  140.13 +    There exist several targets which are by default empty and which can be 
  140.14 +    used for execution of your tasks. These targets are usually executed 
  140.15 +    before and after some main targets. They are: 
  140.16 +
  140.17 +      -pre-init:                 called before initialization of project properties
  140.18 +      -post-init:                called after initialization of project properties
  140.19 +      -pre-compile:              called before javac compilation
  140.20 +      -post-compile:             called after javac compilation
  140.21 +      -pre-compile-single:       called before javac compilation of single file
  140.22 +      -post-compile-single:      called after javac compilation of single file
  140.23 +      -pre-compile-test:         called before javac compilation of JUnit tests
  140.24 +      -post-compile-test:        called after javac compilation of JUnit tests
  140.25 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
  140.26 +      -post-compile-test-single: called after javac compilation of single JUunit test
  140.27 +      -pre-jar:                  called before JAR building
  140.28 +      -post-jar:                 called after JAR building
  140.29 +      -post-clean:               called after cleaning build products
  140.30 +
  140.31 +    (Targets beginning with '-' are not intended to be called on their own.)
  140.32 +
  140.33 +    Example of inserting an obfuscator after compilation could look like this:
  140.34 +
  140.35 +        <target name="-post-compile">
  140.36 +            <obfuscate>
  140.37 +                <fileset dir="${build.classes.dir}"/>
  140.38 +            </obfuscate>
  140.39 +        </target>
  140.40 +
  140.41 +    For list of available properties check the imported 
  140.42 +    nbproject/build-impl.xml file. 
  140.43 +
  140.44 +
  140.45 +    Another way to customize the build is by overriding existing main targets.
  140.46 +    The targets of interest are: 
  140.47 +
  140.48 +      -init-macrodef-javac:     defines macro for javac compilation
  140.49 +      -init-macrodef-junit:     defines macro for junit execution
  140.50 +      -init-macrodef-debug:     defines macro for class debugging
  140.51 +      -init-macrodef-java:      defines macro for class execution
  140.52 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
  140.53 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
  140.54 +      run:                      execution of project 
  140.55 +      -javadoc-build:           Javadoc generation
  140.56 +      test-report:              JUnit report generation
  140.57 +
  140.58 +    An example of overriding the target for project execution could look like this:
  140.59 +
  140.60 +        <target name="run" depends="welltestedsolution-impl.jar">
  140.61 +            <exec dir="bin" executable="launcher.exe">
  140.62 +                <arg file="${dist.jar}"/>
  140.63 +            </exec>
  140.64 +        </target>
  140.65 +
  140.66 +    Notice that the overridden target depends on the jar target and not only on 
  140.67 +    the compile target as the regular run target does. Again, for a list of available 
  140.68 +    properties which you can use, check the target you are overriding in the
  140.69 +    nbproject/build-impl.xml file. 
  140.70 +
  140.71 +    -->
  140.72 +</project>
   141.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   141.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
   141.3 @@ -0,0 +1,547 @@
   141.4 +<?xml version="1.0" encoding="UTF-8"?>
   141.5 +<!--
   141.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   141.7 +***         EDIT ../build.xml INSTEAD         ***
   141.8 +
   141.9 +For the purpose of easier reading the script
  141.10 +is divided into following sections:
  141.11 +
  141.12 +  - initialization
  141.13 +  - compilation
  141.14 +  - jar
  141.15 +  - execution
  141.16 +  - debugging
  141.17 +  - javadoc
  141.18 +  - junit compilation
  141.19 +  - junit execution
  141.20 +  - junit debugging
  141.21 +  - applet
  141.22 +  - cleanup
  141.23 +
  141.24 +-->
  141.25 +<project name="welltestedsolution-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1">
  141.26 +    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
  141.27 +    <!-- 
  141.28 +    ======================
  141.29 +    INITIALIZATION SECTION 
  141.30 +    ======================
  141.31 +    -->
  141.32 +    <target name="-pre-init">
  141.33 +        <!-- Empty placeholder for easier customization. -->
  141.34 +        <!-- You can override this target in the ../build.xml file. -->
  141.35 +    </target>
  141.36 +    <target name="-init-private" depends="-pre-init">
  141.37 +        <property file="nbproject/private/private.properties"/>
  141.38 +    </target>
  141.39 +    <target name="-init-user" depends="-pre-init,-init-private">
  141.40 +        <property file="${user.properties.file}"/>
  141.41 +        <!-- The two properties below are usually overridden -->
  141.42 +        <!-- by the active platform. Just a fallback. -->
  141.43 +        <property name="default.javac.source" value="1.4"/>
  141.44 +        <property name="default.javac.target" value="1.4"/>
  141.45 +    </target>
  141.46 +    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
  141.47 +        <property file="nbproject/project.properties"/>
  141.48 +    </target>
  141.49 +    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
  141.50 +        <available file="${manifest.file}" property="manifest.available"/>
  141.51 +        <condition property="manifest.available+main.class">
  141.52 +            <and>
  141.53 +                <isset property="manifest.available"/>
  141.54 +                <isset property="main.class"/>
  141.55 +                <not>
  141.56 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
  141.57 +                </not>
  141.58 +            </and>
  141.59 +        </condition>
  141.60 +        <condition property="manifest.available+main.class+mkdist.available">
  141.61 +            <and>
  141.62 +                <istrue value="${manifest.available+main.class}"/>
  141.63 +                <isset property="libs.CopyLibs.classpath"/>
  141.64 +            </and>
  141.65 +        </condition>
  141.66 +        <condition property="have.tests">
  141.67 +            <or>
  141.68 +                <available file="${test.src.dir}"/>
  141.69 +            </or>
  141.70 +        </condition>
  141.71 +        <condition property="have.sources">
  141.72 +            <or>
  141.73 +                <available file="${src.dir}"/>
  141.74 +            </or>
  141.75 +        </condition>
  141.76 +        <condition property="netbeans.home+have.tests">
  141.77 +            <and>
  141.78 +                <isset property="netbeans.home"/>
  141.79 +                <isset property="have.tests"/>
  141.80 +            </and>
  141.81 +        </condition>
  141.82 +        <condition property="no.javadoc.preview">
  141.83 +            <isfalse value="${javadoc.preview}"/>
  141.84 +        </condition>
  141.85 +        <property name="run.jvmargs" value=""/>
  141.86 +        <property name="javac.compilerargs" value=""/>
  141.87 +        <property name="work.dir" value="${basedir}"/>
  141.88 +        <condition property="no.deps">
  141.89 +            <and>
  141.90 +                <istrue value="${no.dependencies}"/>
  141.91 +            </and>
  141.92 +        </condition>
  141.93 +        <property name="javac.debug" value="true"/>
  141.94 +        <property name="javadoc.preview" value="true"/>
  141.95 +        <property name="application.args" value=""/>
  141.96 +    </target>
  141.97 +    <target name="-post-init">
  141.98 +        <!-- Empty placeholder for easier customization. -->
  141.99 +        <!-- You can override this target in the ../build.xml file. -->
 141.100 +    </target>
 141.101 +    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
 141.102 +        <fail unless="src.dir">Must set src.dir</fail>
 141.103 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
 141.104 +        <fail unless="build.dir">Must set build.dir</fail>
 141.105 +        <fail unless="dist.dir">Must set dist.dir</fail>
 141.106 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 141.107 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 141.108 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 141.109 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 141.110 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 141.111 +        <fail unless="dist.jar">Must set dist.jar</fail>
 141.112 +    </target>
 141.113 +    <target name="-init-macrodef-property">
 141.114 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
 141.115 +            <attribute name="name"/>
 141.116 +            <attribute name="value"/>
 141.117 +            <sequential>
 141.118 +                <property name="@{name}" value="${@{value}}"/>
 141.119 +            </sequential>
 141.120 +        </macrodef>
 141.121 +    </target>
 141.122 +    <target name="-init-macrodef-javac">
 141.123 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
 141.124 +            <attribute name="srcdir" default="${src.dir}"/>
 141.125 +            <attribute name="destdir" default="${build.classes.dir}"/>
 141.126 +            <attribute name="classpath" default="${javac.classpath}"/>
 141.127 +            <attribute name="debug" default="${javac.debug}"/>
 141.128 +            <element name="customize" optional="true"/>
 141.129 +            <sequential>
 141.130 +                <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache">
 141.131 +                    <classpath>
 141.132 +                        <path path="@{classpath}"/>
 141.133 +                    </classpath>
 141.134 +                </depend>
 141.135 +                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
 141.136 +                    <classpath>
 141.137 +                        <path path="@{classpath}"/>
 141.138 +                    </classpath>
 141.139 +                    <compilerarg line="${javac.compilerargs}"/>
 141.140 +                    <customize/>
 141.141 +                </javac>
 141.142 +            </sequential>
 141.143 +        </macrodef>
 141.144 +    </target>
 141.145 +    <target name="-init-macrodef-junit">
 141.146 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
 141.147 +            <attribute name="includes" default="**/*Test.java"/>
 141.148 +            <sequential>
 141.149 +                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
 141.150 +                    <batchtest todir="${build.test.results.dir}">
 141.151 +                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
 141.152 +                    </batchtest>
 141.153 +                    <classpath>
 141.154 +                        <path path="${run.test.classpath}"/>
 141.155 +                    </classpath>
 141.156 +                    <syspropertyset>
 141.157 +                        <propertyref prefix="test-sys-prop."/>
 141.158 +                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
 141.159 +                    </syspropertyset>
 141.160 +                    <formatter type="brief" usefile="false"/>
 141.161 +                    <formatter type="xml"/>
 141.162 +                    <jvmarg line="${run.jvmargs}"/>
 141.163 +                </junit>
 141.164 +            </sequential>
 141.165 +        </macrodef>
 141.166 +    </target>
 141.167 +    <target name="-init-macrodef-nbjpda">
 141.168 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
 141.169 +            <attribute name="name" default="${main.class}"/>
 141.170 +            <attribute name="classpath" default="${debug.classpath}"/>
 141.171 +            <attribute name="stopclassname" default=""/>
 141.172 +            <sequential>
 141.173 +                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
 141.174 +                    <classpath>
 141.175 +                        <path path="@{classpath}"/>
 141.176 +                    </classpath>
 141.177 +                </nbjpdastart>
 141.178 +            </sequential>
 141.179 +        </macrodef>
 141.180 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
 141.181 +            <attribute name="dir" default="${build.classes.dir}"/>
 141.182 +            <sequential>
 141.183 +                <nbjpdareload>
 141.184 +                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
 141.185 +                </nbjpdareload>
 141.186 +            </sequential>
 141.187 +        </macrodef>
 141.188 +    </target>
 141.189 +    <target name="-init-macrodef-debug">
 141.190 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
 141.191 +            <attribute name="classname" default="${main.class}"/>
 141.192 +            <attribute name="classpath" default="${debug.classpath}"/>
 141.193 +            <element name="customize" optional="true"/>
 141.194 +            <sequential>
 141.195 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 141.196 +                    <jvmarg value="-Xdebug"/>
 141.197 +                    <jvmarg value="-Xnoagent"/>
 141.198 +                    <jvmarg value="-Djava.compiler=none"/>
 141.199 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
 141.200 +                    <jvmarg line="${run.jvmargs}"/>
 141.201 +                    <classpath>
 141.202 +                        <path path="@{classpath}"/>
 141.203 +                    </classpath>
 141.204 +                    <syspropertyset>
 141.205 +                        <propertyref prefix="run-sys-prop."/>
 141.206 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 141.207 +                    </syspropertyset>
 141.208 +                    <customize/>
 141.209 +                </java>
 141.210 +            </sequential>
 141.211 +        </macrodef>
 141.212 +    </target>
 141.213 +    <target name="-init-macrodef-java">
 141.214 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
 141.215 +            <attribute name="classname" default="${main.class}"/>
 141.216 +            <element name="customize" optional="true"/>
 141.217 +            <sequential>
 141.218 +                <java fork="true" classname="@{classname}" dir="${work.dir}">
 141.219 +                    <jvmarg line="${run.jvmargs}"/>
 141.220 +                    <classpath>
 141.221 +                        <path path="${run.classpath}"/>
 141.222 +                    </classpath>
 141.223 +                    <syspropertyset>
 141.224 +                        <propertyref prefix="run-sys-prop."/>
 141.225 +                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
 141.226 +                    </syspropertyset>
 141.227 +                    <customize/>
 141.228 +                </java>
 141.229 +            </sequential>
 141.230 +        </macrodef>
 141.231 +    </target>
 141.232 +    <target name="-init-presetdef-jar">
 141.233 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
 141.234 +            <jar jarfile="${dist.jar}" compress="${jar.compress}">
 141.235 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
 141.236 +            </jar>
 141.237 +        </presetdef>
 141.238 +    </target>
 141.239 +    <target name="init" 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"/>
 141.240 +    <!--
 141.241 +    ===================
 141.242 +    COMPILATION SECTION
 141.243 +    ===================
 141.244 +    -->
 141.245 +    <target name="deps-jar" depends="init" unless="no.deps"/>
 141.246 +    <target name="-pre-pre-compile" depends="init,deps-jar">
 141.247 +        <mkdir dir="${build.classes.dir}"/>
 141.248 +    </target>
 141.249 +    <target name="-pre-compile">
 141.250 +        <!-- Empty placeholder for easier customization. -->
 141.251 +        <!-- You can override this target in the ../build.xml file. -->
 141.252 +    </target>
 141.253 +    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
 141.254 +        <j2seproject3:javac/>
 141.255 +        <copy todir="${build.classes.dir}">
 141.256 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
 141.257 +        </copy>
 141.258 +    </target>
 141.259 +    <target name="-post-compile">
 141.260 +        <!-- Empty placeholder for easier customization. -->
 141.261 +        <!-- You can override this target in the ../build.xml file. -->
 141.262 +    </target>
 141.263 +    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
 141.264 +    <target name="-pre-compile-single">
 141.265 +        <!-- Empty placeholder for easier customization. -->
 141.266 +        <!-- You can override this target in the ../build.xml file. -->
 141.267 +    </target>
 141.268 +    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
 141.269 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 141.270 +        <j2seproject3:javac>
 141.271 +            <customize>
 141.272 +                <patternset includes="${javac.includes}"/>
 141.273 +            </customize>
 141.274 +        </j2seproject3:javac>
 141.275 +    </target>
 141.276 +    <target name="-post-compile-single">
 141.277 +        <!-- Empty placeholder for easier customization. -->
 141.278 +        <!-- You can override this target in the ../build.xml file. -->
 141.279 +    </target>
 141.280 +    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
 141.281 +    <!--
 141.282 +    ====================
 141.283 +    JAR BUILDING SECTION
 141.284 +    ====================
 141.285 +    -->
 141.286 +    <target name="-pre-pre-jar" depends="init">
 141.287 +        <dirname property="dist.jar.dir" file="${dist.jar}"/>
 141.288 +        <mkdir dir="${dist.jar.dir}"/>
 141.289 +    </target>
 141.290 +    <target name="-pre-jar">
 141.291 +        <!-- Empty placeholder for easier customization. -->
 141.292 +        <!-- You can override this target in the ../build.xml file. -->
 141.293 +    </target>
 141.294 +    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
 141.295 +        <j2seproject1:jar/>
 141.296 +    </target>
 141.297 +    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
 141.298 +        <j2seproject1:jar manifest="${manifest.file}"/>
 141.299 +    </target>
 141.300 +    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
 141.301 +        <j2seproject1:jar manifest="${manifest.file}">
 141.302 +            <j2seproject1:manifest>
 141.303 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
 141.304 +            </j2seproject1:manifest>
 141.305 +        </j2seproject1:jar>
 141.306 +        <echo>To run this application from the command line without Ant, try:</echo>
 141.307 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 141.308 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 141.309 +        <pathconvert property="run.classpath.with.dist.jar">
 141.310 +            <path path="${run.classpath}"/>
 141.311 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 141.312 +        </pathconvert>
 141.313 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 141.314 +    </target>
 141.315 +    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
 141.316 +        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
 141.317 +        <pathconvert property="run.classpath.without.build.classes.dir">
 141.318 +            <path path="${run.classpath}"/>
 141.319 +            <map from="${build.classes.dir.resolved}" to=""/>
 141.320 +        </pathconvert>
 141.321 +        <pathconvert property="jar.classpath" pathsep=" ">
 141.322 +            <path path="${run.classpath.without.build.classes.dir}"/>
 141.323 +            <chainedmapper>
 141.324 +                <flattenmapper/>
 141.325 +                <globmapper from="*" to="lib/*"/>
 141.326 +            </chainedmapper>
 141.327 +        </pathconvert>
 141.328 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
 141.329 +        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
 141.330 +            <fileset dir="${build.classes.dir}"/>
 141.331 +            <manifest>
 141.332 +                <attribute name="Main-Class" value="${main.class}"/>
 141.333 +                <attribute name="Class-Path" value="${jar.classpath}"/>
 141.334 +            </manifest>
 141.335 +        </copylibs>
 141.336 +        <echo>To run this application from the command line without Ant, try:</echo>
 141.337 +        <property name="dist.jar.resolved" location="${dist.jar}"/>
 141.338 +        <echo>java -jar "${dist.jar.resolved}"</echo>
 141.339 +    </target>
 141.340 +    <target name="-post-jar">
 141.341 +        <!-- Empty placeholder for easier customization. -->
 141.342 +        <!-- You can override this target in the ../build.xml file. -->
 141.343 +    </target>
 141.344 +    <target name="jar" 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."/>
 141.345 +    <!--
 141.346 +    =================
 141.347 +    EXECUTION SECTION
 141.348 +    =================
 141.349 +    -->
 141.350 +    <target name="run" depends="init,compile" description="Run a main class.">
 141.351 +        <j2seproject1:java>
 141.352 +            <customize>
 141.353 +                <arg line="${application.args}"/>
 141.354 +            </customize>
 141.355 +        </j2seproject1:java>
 141.356 +    </target>
 141.357 +    <target name="run-single" depends="init,compile-single">
 141.358 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 141.359 +        <j2seproject1:java classname="${run.class}"/>
 141.360 +    </target>
 141.361 +    <!--
 141.362 +    =================
 141.363 +    DEBUGGING SECTION
 141.364 +    =================
 141.365 +    -->
 141.366 +    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
 141.367 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
 141.368 +    </target>
 141.369 +    <target name="-debug-start-debuggee" depends="init,compile">
 141.370 +        <j2seproject3:debug>
 141.371 +            <customize>
 141.372 +                <arg line="${application.args}"/>
 141.373 +            </customize>
 141.374 +        </j2seproject3:debug>
 141.375 +    </target>
 141.376 +    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
 141.377 +    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
 141.378 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 141.379 +    </target>
 141.380 +    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
 141.381 +    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
 141.382 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 141.383 +        <j2seproject3:debug classname="${debug.class}"/>
 141.384 +    </target>
 141.385 +    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
 141.386 +    <target name="-pre-debug-fix" depends="init">
 141.387 +        <fail unless="fix.includes">Must set fix.includes</fail>
 141.388 +        <property name="javac.includes" value="${fix.includes}.java"/>
 141.389 +    </target>
 141.390 +    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
 141.391 +        <j2seproject1:nbjpdareload/>
 141.392 +    </target>
 141.393 +    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
 141.394 +    <!--
 141.395 +    ===============
 141.396 +    JAVADOC SECTION
 141.397 +    ===============
 141.398 +    -->
 141.399 +    <target name="-javadoc-build" depends="init">
 141.400 +        <mkdir dir="${dist.javadoc.dir}"/>
 141.401 +        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
 141.402 +            <classpath>
 141.403 +                <path path="${javac.classpath}"/>
 141.404 +            </classpath>
 141.405 +            <sourcepath>
 141.406 +                <pathelement location="${src.dir}"/>
 141.407 +            </sourcepath>
 141.408 +            <packageset dir="${src.dir}" includes="*/**"/>
 141.409 +            <fileset dir="${src.dir}" includes="*.java"/>
 141.410 +        </javadoc>
 141.411 +    </target>
 141.412 +    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
 141.413 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 141.414 +    </target>
 141.415 +    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
 141.416 +    <!--
 141.417 +    =========================
 141.418 +    JUNIT COMPILATION SECTION
 141.419 +    =========================
 141.420 +    -->
 141.421 +    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
 141.422 +        <mkdir dir="${build.test.classes.dir}"/>
 141.423 +    </target>
 141.424 +    <target name="-pre-compile-test">
 141.425 +        <!-- Empty placeholder for easier customization. -->
 141.426 +        <!-- You can override this target in the ../build.xml file. -->
 141.427 +    </target>
 141.428 +    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
 141.429 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
 141.430 +        <copy todir="${build.test.classes.dir}">
 141.431 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 141.432 +        </copy>
 141.433 +    </target>
 141.434 +    <target name="-post-compile-test">
 141.435 +        <!-- Empty placeholder for easier customization. -->
 141.436 +        <!-- You can override this target in the ../build.xml file. -->
 141.437 +    </target>
 141.438 +    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
 141.439 +    <target name="-pre-compile-test-single">
 141.440 +        <!-- Empty placeholder for easier customization. -->
 141.441 +        <!-- You can override this target in the ../build.xml file. -->
 141.442 +    </target>
 141.443 +    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
 141.444 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 141.445 +        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
 141.446 +            <customize>
 141.447 +                <patternset includes="${javac.includes}"/>
 141.448 +            </customize>
 141.449 +        </j2seproject3:javac>
 141.450 +        <copy todir="${build.test.classes.dir}">
 141.451 +            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
 141.452 +        </copy>
 141.453 +    </target>
 141.454 +    <target name="-post-compile-test-single">
 141.455 +        <!-- Empty placeholder for easier customization. -->
 141.456 +        <!-- You can override this target in the ../build.xml file. -->
 141.457 +    </target>
 141.458 +    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
 141.459 +    <!--
 141.460 +    =======================
 141.461 +    JUNIT EXECUTION SECTION
 141.462 +    =======================
 141.463 +    -->
 141.464 +    <target name="-pre-test-run" if="have.tests" depends="init">
 141.465 +        <mkdir dir="${build.test.results.dir}"/>
 141.466 +    </target>
 141.467 +    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
 141.468 +        <j2seproject3:junit/>
 141.469 +    </target>
 141.470 +    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
 141.471 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 141.472 +    </target>
 141.473 +    <target name="test-report" if="have.tests" depends="init"/>
 141.474 +    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
 141.475 +    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
 141.476 +    <target name="-pre-test-run-single" if="have.tests" depends="init">
 141.477 +        <mkdir dir="${build.test.results.dir}"/>
 141.478 +    </target>
 141.479 +    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
 141.480 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 141.481 +        <j2seproject3:junit includes="${test.includes}"/>
 141.482 +    </target>
 141.483 +    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
 141.484 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
 141.485 +    </target>
 141.486 +    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
 141.487 +    <!--
 141.488 +    =======================
 141.489 +    JUNIT DEBUGGING SECTION
 141.490 +    =======================
 141.491 +    -->
 141.492 +    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
 141.493 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 141.494 +        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
 141.495 +            <customize>
 141.496 +                <arg line="${test.class}"/>
 141.497 +            </customize>
 141.498 +        </j2seproject3:debug>
 141.499 +    </target>
 141.500 +    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
 141.501 +        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
 141.502 +    </target>
 141.503 +    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
 141.504 +    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
 141.505 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 141.506 +    </target>
 141.507 +    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
 141.508 +    <!--
 141.509 +    =========================
 141.510 +    APPLET EXECUTION SECTION
 141.511 +    =========================
 141.512 +    -->
 141.513 +    <target name="run-applet" depends="init,compile-single">
 141.514 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 141.515 +        <j2seproject1:java classname="sun.applet.AppletViewer">
 141.516 +            <customize>
 141.517 +                <arg value="${applet.url}"/>
 141.518 +            </customize>
 141.519 +        </j2seproject1:java>
 141.520 +    </target>
 141.521 +    <!--
 141.522 +    =========================
 141.523 +    APPLET DEBUGGING  SECTION
 141.524 +    =========================
 141.525 +    -->
 141.526 +    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
 141.527 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 141.528 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
 141.529 +            <customize>
 141.530 +                <arg value="${applet.url}"/>
 141.531 +            </customize>
 141.532 +        </j2seproject3:debug>
 141.533 +    </target>
 141.534 +    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
 141.535 +    <!--
 141.536 +    ===============
 141.537 +    CLEANUP SECTION
 141.538 +    ===============
 141.539 +    -->
 141.540 +    <target name="deps-clean" depends="init" unless="no.deps"/>
 141.541 +    <target name="-do-clean" depends="init">
 141.542 +        <delete dir="${build.dir}"/>
 141.543 +        <delete dir="${dist.dir}"/>
 141.544 +    </target>
 141.545 +    <target name="-post-clean">
 141.546 +        <!-- Empty placeholder for easier customization. -->
 141.547 +        <!-- You can override this target in the ../build.xml file. -->
 141.548 +    </target>
 141.549 +    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
 141.550 +</project>
   142.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   142.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
   142.3 @@ -0,0 +1,8 @@
   142.4 +build.xml.data.CRC32=3022b908
   142.5 +build.xml.script.CRC32=fdb77cae
   142.6 +build.xml.stylesheet.CRC32=a12b3d02
   142.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   142.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   142.9 +nbproject/build-impl.xml.data.CRC32=3022b908
  142.10 +nbproject/build-impl.xml.script.CRC32=b9627854
  142.11 +nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac
   143.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   143.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/project.properties	Sat Jun 14 09:52:45 2008 +0200
   143.3 @@ -0,0 +1,56 @@
   143.4 +build.classes.dir=${build.dir}/classes
   143.5 +build.classes.excludes=**/*.java,**/*.form
   143.6 +# This directory is removed when the project is cleaned:
   143.7 +build.dir=build
   143.8 +build.generated.dir=${build.dir}/generated
   143.9 +# Only compile against the classpath explicitly listed here:
  143.10 +build.sysclasspath=ignore
  143.11 +build.test.classes.dir=${build.dir}/test/classes
  143.12 +build.test.results.dir=${build.dir}/test/results
  143.13 +debug.classpath=\
  143.14 +    ${run.classpath}
  143.15 +debug.test.classpath=\
  143.16 +    ${run.test.classpath}
  143.17 +# This directory is removed when the project is cleaned:
  143.18 +dist.dir=dist
  143.19 +dist.jar=${dist.dir}/boolcircuit.jar
  143.20 +dist.javadoc.dir=${dist.dir}/javadoc
  143.21 +jar.compress=false
  143.22 +javac.classpath=
  143.23 +# Space-separated list of extra javac options
  143.24 +javac.compilerargs=
  143.25 +javac.deprecation=false
  143.26 +javac.source=1.5
  143.27 +javac.target=1.5
  143.28 +javac.test.classpath=\
  143.29 +    ${javac.classpath}:\
  143.30 +    ${build.classes.dir}:\
  143.31 +    ${libs.junit.classpath}
  143.32 +javadoc.additionalparam=
  143.33 +javadoc.author=false
  143.34 +javadoc.encoding=
  143.35 +javadoc.noindex=false
  143.36 +javadoc.nonavbar=false
  143.37 +javadoc.notree=false
  143.38 +javadoc.private=false
  143.39 +javadoc.splitindex=true
  143.40 +javadoc.use=true
  143.41 +javadoc.version=false
  143.42 +javadoc.windowtitle=
  143.43 +# Property libs.junit.classpath is set here just to make sharing of project simpler.
  143.44 +# The library definition has always preference over this property.
  143.45 +libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
  143.46 +meta.inf.dir=${src.dir}/META-INF
  143.47 +platform.active=default_platform
  143.48 +run.classpath=\
  143.49 +    ${javac.classpath}:\
  143.50 +    ${build.classes.dir}
  143.51 +# Space-separated list of JVM arguments used when running the project
  143.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
  143.53 +# or test-sys-prop.name=value to set system properties for unit tests):
  143.54 +run.jvmargs=
  143.55 +run.test.classpath=\
  143.56 +    ${javac.test.classpath}:\
  143.57 +    ${build.test.classes.dir}
  143.58 +src.dir=src
  143.59 +test.src.dir=test
   144.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   144.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   144.3 @@ -0,0 +1,16 @@
   144.4 +<?xml version="1.0" encoding="UTF-8"?>
   144.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   144.6 +    <type>org.netbeans.modules.java.j2seproject</type>
   144.7 +    <configuration>
   144.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
   144.9 +            <name>welltestedsolution</name>
  144.10 +            <minimum-ant-version>1.6.5</minimum-ant-version>
  144.11 +            <source-roots>
  144.12 +                <root id="src.dir"/>
  144.13 +            </source-roots>
  144.14 +            <test-roots>
  144.15 +                <root id="test.src.dir"/>
  144.16 +            </test-roots>
  144.17 +        </data>
  144.18 +    </configuration>
  144.19 +</project>
   145.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   145.2 +++ b/samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:45 2008 +0200
   145.3 @@ -0,0 +1,177 @@
   145.4 +/*
   145.5 + * The contents of this file are subject to the terms of the Common Development
   145.6 + * and Distribution License (the License). You may not use this file except in
   145.7 + * compliance with the License.
   145.8 + *
   145.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  145.10 + * or http://www.netbeans.org/cddl.txt.
  145.11 + *
  145.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  145.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  145.14 + * If applicable, add the following below the CDDL Header, with the fields
  145.15 + * enclosed by brackets [] replaced by your own identifying information:
  145.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  145.17 + *
  145.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  145.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  145.20 + * Microsystems, Inc. All Rights Reserved.
  145.21 + */
  145.22 +
  145.23 +package org.netbeans.apifest.boolcircuit;
  145.24 +
  145.25 +/**
  145.26 + */
  145.27 +public abstract class Circuit {
  145.28 +    
  145.29 +    /** Creates a simple Circuit that is associated with given input pin.
  145.30 +     * @since day2
  145.31 +     */
  145.32 +    public static Circuit input(int pin) {
  145.33 +        return new Input(pin);
  145.34 +    }
  145.35 +    
  145.36 +    /** Create circuit that inverts results of input circuit.
  145.37 +     */
  145.38 +    public static Circuit createNotCircuit(Circuit in) {
  145.39 +        return new Not(in);
  145.40 +    }
  145.41 +    
  145.42 +    public static Circuit createOrCircuit(Circuit in1, Circuit in2) {
  145.43 +        return new Binary(in1, in2, true);
  145.44 +    }
  145.45 +    
  145.46 +    public static Circuit createAndCircuit(Circuit in1, Circuit in2) {
  145.47 +        return new Binary(in1, in2, false);
  145.48 +    }
  145.49 +    
  145.50 +    public Circuit() {
  145.51 +        
  145.52 +    }
  145.53 +    
  145.54 +    public final boolean evaluate(Boolean ... inputs) {
  145.55 +        if (inputs == null) 
  145.56 +            throw new IllegalArgumentException();
  145.57 +        double[] vals = new double [inputs.length];
  145.58 +        for (int i = 0; i < inputs.length; i++) 
  145.59 +            vals[i] = inputs[i]? 1.0: 0.0;
  145.60 +        return evaluateFuzzy(vals) == 1.0;
  145.61 +    }
  145.62 +    
  145.63 +    public final double evaluateFuzzy(double ... inputs) {
  145.64 +        if (inputs == null) 
  145.65 +            throw new IllegalArgumentException();
  145.66 +        return doEvaluate(inputs);
  145.67 +    }
  145.68 +    
  145.69 +    protected abstract double doEvaluate(double ... inputs);
  145.70 +    
  145.71 +    public abstract int maxInputs();
  145.72 +    
  145.73 +    private interface OldEval {
  145.74 +        
  145.75 +        double doEvaluate1(int offset, double ... inputs);
  145.76 +    }
  145.77 +    
  145.78 +    private static class Input extends Circuit {
  145.79 +        
  145.80 +        int pin;
  145.81 +        
  145.82 +        Input(int pin) {
  145.83 +            this.pin = pin;
  145.84 +        }
  145.85 +        
  145.86 +        protected double doEvaluate(double ... inputs) {
  145.87 +            if (inputs == null || inputs.length < maxInputs()) 
  145.88 +                throw new IllegalArgumentException();
  145.89 +            
  145.90 +            return inputs[pin];
  145.91 +        }
  145.92 +
  145.93 +        public  int maxInputs() {
  145.94 +            return pin + 1;
  145.95 +        }
  145.96 +        
  145.97 +    }
  145.98 +    
  145.99 +    private static class Not extends Circuit implements OldEval {
 145.100 +
 145.101 +        private Circuit in;
 145.102 +        
 145.103 +        Not (Circuit in) {
 145.104 +            this.in = in;
 145.105 +        }
 145.106 +        
 145.107 +        public double doEvaluate(double ... inputs) {
 145.108 +            return doEvaluate1(0, inputs);
 145.109 +        }
 145.110 +
 145.111 +        public double doEvaluate1(int i, double ... inputs) {
 145.112 +            if (in == null) {
 145.113 +                if (inputs == null || inputs.length < i + 1)
 145.114 +                    throw new IllegalArgumentException();
 145.115 +                return 1 - inputs[i];
 145.116 +            }
 145.117 +            
 145.118 +            if (in instanceof OldEval) {
 145.119 +                return 1 - ((OldEval)in).doEvaluate1(i, inputs[i]);
 145.120 +            }
 145.121 +            else {
 145.122 +                return 1 - in.evaluateFuzzy(inputs);
 145.123 +            }
 145.124 +        }
 145.125 +
 145.126 +        public  int maxInputs() {
 145.127 +            return in != null? in.maxInputs(): 1;
 145.128 +        }
 145.129 +    }
 145.130 +    
 145.131 +    private static class Binary extends Circuit implements OldEval {
 145.132 +
 145.133 +        private Circuit in1, in2;
 145.134 +        boolean or;
 145.135 +        
 145.136 +        Binary (Circuit in1, Circuit in2, boolean or) {
 145.137 +            this.in1 = in1;
 145.138 +            this.in2 = in2;
 145.139 +            this.or = or;
 145.140 +        }
 145.141 +        
 145.142 +        public double doEvaluate(double ... inputs) {
 145.143 +            return doEvaluate1(0, inputs);
 145.144 +        }
 145.145 +
 145.146 +        public double doEvaluate1(int i, double ... inputs) {
 145.147 +            double x1, x2;
 145.148 +            if (in1 == null) {
 145.149 +                if (inputs == null || inputs.length < i + 1)
 145.150 +                    throw new IllegalArgumentException();
 145.151 +                x1 = inputs[i];
 145.152 +            } else {
 145.153 +                if (in1 instanceof OldEval) {
 145.154 +                    x1 = ((OldEval)in1).doEvaluate1(i, inputs);
 145.155 +                }
 145.156 +                else {
 145.157 +                    x1 = in1.evaluateFuzzy(inputs);
 145.158 +                }
 145.159 +            }
 145.160 +            if (in2 == null) {
 145.161 +                if (inputs == null || inputs.length < i + (in1 != null? in1.maxInputs(): 1) + 1)
 145.162 +                    throw new IllegalArgumentException();
 145.163 +                x2 = inputs[i + (in1 != null? in1.maxInputs(): 1)];
 145.164 +            } else {
 145.165 +                if (in2 instanceof OldEval) {
 145.166 +                    x2 = ((OldEval)in2).doEvaluate1(i + (in1 != null? in1.maxInputs(): 1), inputs);
 145.167 +                }
 145.168 +                else {
 145.169 +                    x2 = in2.evaluateFuzzy(inputs);
 145.170 +                }
 145.171 +            }
 145.172 +            return or? 1 - (1 - x1) * (1 - x2) : x1 * x2;
 145.173 +        }
 145.174 +        
 145.175 +        public  int maxInputs() {
 145.176 +            return (in1 != null? in1.maxInputs(): 1) + 
 145.177 +                    (in2 != null? in2.maxInputs(): 1) ;
 145.178 +        }
 145.179 +    }
 145.180 +}
   146.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   146.2 +++ b/samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/custom/Gte.java	Sat Jun 14 09:52:45 2008 +0200
   146.3 @@ -0,0 +1,46 @@
   146.4 +/*
   146.5 + * The contents of this file are subject to the terms of the Common Development
   146.6 + * and Distribution License (the License). You may not use this file except in
   146.7 + * compliance with the License.
   146.8 + *
   146.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  146.10 + * or http://www.netbeans.org/cddl.txt.
  146.11 + *
  146.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  146.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  146.14 + * If applicable, add the following below the CDDL Header, with the fields
  146.15 + * enclosed by brackets [] replaced by your own identifying information:
  146.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  146.17 + *
  146.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  146.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  146.20 + * Microsystems, Inc. All Rights Reserved.
  146.21 + */
  146.22 +
  146.23 +package org.netbeans.apifest.custom;
  146.24 +
  146.25 +import org.netbeans.apifest.boolcircuit.Circuit;
  146.26 +
  146.27 +/**
  146.28 + */
  146.29 +public class Gte extends Circuit{
  146.30 +
  146.31 +    private Circuit in1;
  146.32 +    private Circuit in2;
  146.33 +    
  146.34 +    public Gte (Circuit in1, Circuit in2) {
  146.35 +        if (in1 == null || in2 == null)
  146.36 +            throw new IllegalArgumentException();
  146.37 +        this.in1 = in1;
  146.38 +        this.in2 = in2;
  146.39 +    }
  146.40 +    
  146.41 +    protected double doEvaluate(double... inputs) {
  146.42 +        return (in1.evaluateFuzzy(inputs) >= in2.evaluateFuzzy(inputs))? 1.0: 0.0;
  146.43 +    }
  146.44 +
  146.45 +    public int maxInputs() {
  146.46 +        return Math.max(in1.maxInputs(), in2.maxInputs());
  146.47 +    }
  146.48 +    
  146.49 +}
   147.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   147.2 +++ b/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   147.3 @@ -0,0 +1,221 @@
   147.4 +/*
   147.5 + * The contents of this file are subject to the terms of the Common Development
   147.6 + * and Distribution License (the License). You may not use this file except in
   147.7 + * compliance with the License.
   147.8 + *
   147.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  147.10 + * or http://www.netbeans.org/cddl.txt.
  147.11 + *
  147.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  147.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  147.14 + * If applicable, add the following below the CDDL Header, with the fields
  147.15 + * enclosed by brackets [] replaced by your own identifying information:
  147.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  147.17 + *
  147.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  147.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  147.20 + * Microsystems, Inc. All Rights Reserved.
  147.21 + */
  147.22 +
  147.23 +package org.netbeans.apifest.boolcircuit;
  147.24 +
  147.25 +import java.security.CodeSource;
  147.26 +import java.security.Permission;
  147.27 +import java.security.PermissionCollection;
  147.28 +import java.security.Policy;
  147.29 +import java.util.Collection;
  147.30 +import java.util.Collections;
  147.31 +import java.util.Enumeration;
  147.32 +import junit.framework.TestCase;
  147.33 +import junit.framework.*;
  147.34 +
  147.35 +/** The initial quest for this APIFest is to create an API for boolean 
  147.36 + * circuits. Such API shall be able to compose a boolean circuit from
  147.37 + * basic elements and evaluate the result given initial values for 
  147.38 + * input variables.
  147.39 + * <p>
  147.40 + * The basic elements include:
  147.41 + * <ul>
  147.42 + *   <li>negation - has one input and one output and changes 0 on input to 
  147.43 + *          on output 1 and 1 to 0
  147.44 + *   <li>and - has two inputs and one output. The output is 1 only if both 
  147.45 + *          inputs are 1, otherwise it is 0
  147.46 + *   <li>or - has two inputs and one output. The output is 1 always, except
  147.47 + *          in the case when both inputs are 0
  147.48 + * </ul>
  147.49 + *
  147.50 + * <p>
  147.51 + * The boolean circuit can be used to represent boolean formulas and compute
  147.52 + * the results for certain values of its inputs. The individual tasks described
  147.53 + * as tests bellow.
  147.54 + *
  147.55 + * <p>
  147.56 + * Links of interest:
  147.57 + * <ul>
  147.58 + *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
  147.59 + *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
  147.60 + * </ul>
  147.61 + */
  147.62 +public class CircuitTest extends TestCase {
  147.63 +    static {
  147.64 +        // your code shall run without any permissions
  147.65 +    }
  147.66 +    
  147.67 +    public CircuitTest(String testName) {
  147.68 +        super(testName);
  147.69 +    }
  147.70 +
  147.71 +    protected void setUp() throws Exception {
  147.72 +    }
  147.73 +
  147.74 +    protected void tearDown() throws Exception {
  147.75 +    }
  147.76 +    
  147.77 +    
  147.78 +    /** 
  147.79 +     * Create a circuit to evaluate x1 and x2 and then
  147.80 +     * verify that its result is false for input (false, true) and
  147.81 +     * it is true for input (true, true).
  147.82 +     */
  147.83 +    public void testX1andX2() {
  147.84 +        assertFalse("x1 and x2 for (false, true)", Circuit.createAndCircuit(null, null).evaluate(false, true));
  147.85 +        assertTrue("x1 and x2 for (true, true)", Circuit.createAndCircuit(null, null).evaluate(true, true));
  147.86 +    }
  147.87 +    
  147.88 +    /** 
  147.89 +     * Create a circuit to evaluate (x1 and x2) or x3 and then
  147.90 +     * verify that its result is false for input (false, true, false) and
  147.91 +     * it is true for input (false, false, true).
  147.92 +     */
  147.93 +    public void testX1andX2orX3() {
  147.94 +        Circuit c = Circuit.createOrCircuit(Circuit.createAndCircuit(null, null), null);
  147.95 +        assertFalse("(x1 and x2) or x3", c.evaluate(false, true, false));
  147.96 +        assertTrue("(x1 and x2) or x3", c.evaluate(false, false, true));
  147.97 +        
  147.98 +        assertTrue("(x1 and x2) or x3", c.evaluate(true, true, true));
  147.99 +        assertFalse("(x1 and x2) or x3", c.evaluate(true, false, false));
 147.100 +    }
 147.101 +    /** 
 147.102 +     * Create a circuit to evaluate (x1 or not(x1)) and then
 147.103 +     * verify that its result is true for all values of x1.
 147.104 +     */
 147.105 +    public void testAlwaysTrue() {
 147.106 +        Circuit c = Circuit.createOrCircuit(null, Circuit.createNotCircuit(null));
 147.107 +        assertTrue("(x1 or not(x1)) for false", c.evaluate(false, false));
 147.108 +        assertTrue("(x1 or not(x1)) for false", c.evaluate(true, true));
 147.109 +    }
 147.110 +    
 147.111 +    public void testOr() {
 147.112 +        Circuit c = Circuit.createOrCircuit(null, null);
 147.113 +        try {
 147.114 +            c.evaluate();
 147.115 +        } catch (IllegalArgumentException iae) { // expected
 147.116 +        }
 147.117 +        try {
 147.118 +            c.evaluate(true);
 147.119 +        } catch (IllegalArgumentException iae) { // expected
 147.120 +        }
 147.121 +        try {
 147.122 +            c.evaluate(true, true, true);
 147.123 +        } catch (IllegalArgumentException iae) { // expected
 147.124 +        }
 147.125 +        assertFalse("(x1 or x2)", c.evaluate(false, false));
 147.126 +        assertTrue("(x1 or x2)", c.evaluate(true, false));
 147.127 +        assertTrue("(x1 or x2)", c.evaluate(false, true));
 147.128 +        assertTrue("(x1 or x2)", c.evaluate(true, true));
 147.129 +        assertEquals("0.0, 0.0", 0.0, c.evaluateFuzzy(0.0, 0.0), 0.0);
 147.130 +        assertEquals("0.0, 1.0", 1.0, c.evaluateFuzzy(0.0, 1.0), 0.0);
 147.131 +        assertEquals("1.0, 1.0", 1.0, c.evaluateFuzzy(1.0, 1.0), 0.0);
 147.132 +        assertEquals("0.3, 0.5", 0.65, c.evaluateFuzzy(0.3, 0.5), 0.0);
 147.133 +        
 147.134 +    }
 147.135 +    
 147.136 +    public void testOrCorrectly() {
 147.137 +        Circuit c = Circuit.createOrCircuit(null, null);
 147.138 +        try {
 147.139 +            c.evaluate();
 147.140 +            fail("missing");
 147.141 +        } catch (IllegalArgumentException iae) { // expected
 147.142 +        }
 147.143 +        try {
 147.144 +            c.evaluate(true);
 147.145 +            fail("missing");
 147.146 +        } catch (IllegalArgumentException iae) { // expected
 147.147 +        }
 147.148 +    }
 147.149 +    
 147.150 +    public void testAnd() {
 147.151 +        Circuit c = Circuit.createAndCircuit(null, null);
 147.152 +        try {
 147.153 +            c.evaluate();
 147.154 +        } catch (IllegalArgumentException iae) { // expected
 147.155 +        }
 147.156 +        try {
 147.157 +            c.evaluate(true);
 147.158 +        } catch (IllegalArgumentException iae) { // expected
 147.159 +        }
 147.160 +        try {
 147.161 +            c.evaluate(true, true, true);
 147.162 +        } catch (IllegalArgumentException iae) { // expected
 147.163 +        }
 147.164 +        assertFalse("(x1 or x2)", c.evaluate(false, false));
 147.165 +        assertFalse("(x1 or x2)", c.evaluate(true, false));
 147.166 +        assertFalse("(x1 or x2)", c.evaluate(false, true));
 147.167 +        assertTrue("(x1 or x2)", c.evaluate(true, true));
 147.168 +        
 147.169 +        assertEquals("0.0, 0.0", 0.0, c.evaluateFuzzy(0.0, 0.0), 0.0);
 147.170 +        assertEquals("0.0, 1.0", 0.0, c.evaluateFuzzy(0.0, 1.0), 0.0);
 147.171 +        assertEquals("1.0, 1.0", 1.0, c.evaluateFuzzy(1.0, 1.0), 0.0);
 147.172 +        assertEquals("0.3, 0.5", 0.15, c.evaluateFuzzy(0.3, 0.5), 0.0);
 147.173 +    }
 147.174 +    
 147.175 +    public void testAndCorrectly() {
 147.176 +        Circuit c = Circuit.createAndCircuit(null, null);
 147.177 +        try {
 147.178 +            c.evaluate();
 147.179 +            fail("missing");
 147.180 +        } catch (IllegalArgumentException iae) { // expected
 147.181 +        }
 147.182 +        try {
 147.183 +            c.evaluate(true);
 147.184 +            fail("missing");
 147.185 +        } catch (IllegalArgumentException iae) { // expected
 147.186 +        }
 147.187 +        // actually if more values are passed they are ignored
 147.188 +        /*
 147.189 +        try {
 147.190 +            c.evaluate(true, true, true);
 147.191 +            fail("too much");
 147.192 +        } catch (IllegalArgumentException iae) { // expected
 147.193 +        }
 147.194 +         */
 147.195 +    }
 147.196 +    
 147.197 +    public void testNot() {
 147.198 +        Circuit c = Circuit.createNotCircuit(null);
 147.199 +        try {
 147.200 +            c.evaluate();
 147.201 +        } catch (IllegalArgumentException iae) { // expected
 147.202 +        }
 147.203 +        try {
 147.204 +            c.evaluate(true, true);
 147.205 +        } catch (IllegalArgumentException iae) { // expected
 147.206 +        }
 147.207 +        assertFalse("(x1 or x2)", c.evaluate(true));
 147.208 +        assertTrue("(x1 or x2)", c.evaluate(false));
 147.209 +        
 147.210 +        assertEquals("0.0", 1.0, c.evaluateFuzzy(0.0), 0.0);
 147.211 +        assertEquals("1.0", 0.0, c.evaluateFuzzy(1.0), 0.0);
 147.212 +        assertEquals("0.2", 0.8, c.evaluateFuzzy(0.2), 0.0);
 147.213 +    }
 147.214 +    
 147.215 +    public void testNotCorrectly() {
 147.216 +        Circuit c = Circuit.createNotCircuit(null);
 147.217 +        try {
 147.218 +            c.evaluate();
 147.219 +            fail("missing");
 147.220 +        } catch (IllegalArgumentException iae) { // expected
 147.221 +        }
 147.222 +    }
 147.223 +    
 147.224 +}
   148.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   148.2 +++ b/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java	Sat Jun 14 09:52:45 2008 +0200
   148.3 @@ -0,0 +1,173 @@
   148.4 +/*
   148.5 + * The contents of this file are subject to the terms of the Common Development
   148.6 + * and Distribution License (the License). You may not use this file except in
   148.7 + * compliance with the License.
   148.8 + *
   148.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  148.10 + * or http://www.netbeans.org/cddl.txt.
  148.11 + *
  148.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  148.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  148.14 + * If applicable, add the following below the CDDL Header, with the fields
  148.15 + * enclosed by brackets [] replaced by your own identifying information:
  148.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  148.17 + *
  148.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  148.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  148.20 + * Microsystems, Inc. All Rights Reserved.
  148.21 + */
  148.22 +
  148.23 +package org.netbeans.apifest.boolcircuit;
  148.24 +
  148.25 +import java.security.CodeSource;
  148.26 +import java.security.Permission;
  148.27 +import java.security.PermissionCollection;
  148.28 +import java.security.Policy;
  148.29 +import java.util.Collection;
  148.30 +import java.util.Collections;
  148.31 +import java.util.Enumeration;
  148.32 +import junit.framework.TestCase;
  148.33 +import junit.framework.*;
  148.34 +import org.netbeans.apifest.custom.Gte;
  148.35 +
  148.36 +/** This file contains the APIFest quest for day 2. Simply, turn the 
  148.37 + * boolean circuit into circuit that can compute with double values from 0 to 1.
  148.38 + * <p>
  148.39 + * This means that where ever a boolean was used to represent input or 
  148.40 + * output values, one can now use any double number from >= 0 and <= 1.
  148.41 + * Still, to support backward compatibility, the operations with booleans
  148.42 + * has to be kept available and have to work. In fact False shall be 
  148.43 + * treated as 0 and True as 1.
  148.44 + * <p>
  148.45 + * The basic elements has to be modified to work on doubles in the following
  148.46 + * way:
  148.47 + * <ul>
  148.48 + *   <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
  148.49 + *   <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
  148.50 + *             and(false,true)=0*1=0=false
  148.51 + *   <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
  148.52 + *             or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
  148.53 + *             or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
  148.54 + * </ul>
  148.55 + * <p>
  148.56 + * However as the circuits with doubles are more rich than plain boolean circuits,
  148.57 + * there is additional requirement to allow any user of your API to write its 
  148.58 + * own "element" type. This is all going to be exercise in the tests bellow
  148.59 + * which you are supposed to implement.
  148.60 + */
  148.61 +public class RealTest extends TestCase {
  148.62 +    static {
  148.63 +        // your code shall run without any permissions
  148.64 +    }
  148.65 +    
  148.66 +    public RealTest(String testName) {
  148.67 +        super(testName);
  148.68 +    }
  148.69 +
  148.70 +    protected void setUp() throws Exception {
  148.71 +    }
  148.72 +
  148.73 +    protected void tearDown() throws Exception {
  148.74 +    }
  148.75 +    
  148.76 +    
  148.77 +    /** First of all create a circuit which will evaluate
  148.78 +     * expression (X1 and X2) or not(x1). Hold the circuit
  148.79 +     * in some variable.
  148.80 +     *
  148.81 +     * Feed this circuit with x1=true, x2=false, assert result is false
  148.82 +     *
  148.83 +     * Feed the same circuit with x1=false, x2=true, assert result is true
  148.84 +     *
  148.85 +     * Feed the same circuit with x1=0.0, x2=1.0, assert result is 1.0
  148.86 +     *
  148.87 +     * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
  148.88 +     *
  148.89 +     * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
  148.90 +     */
  148.91 +    public void testX1andX2orNotX1() {
  148.92 +        Circuit c = Circuit.createOrCircuit(
  148.93 +                Circuit.createAndCircuit(Circuit.input(0), Circuit.input(1)),
  148.94 +                Circuit.createNotCircuit(Circuit.input(0))
  148.95 +                );
  148.96 +        assertFalse("true, false", c.evaluate(true, false));
  148.97 +        assertTrue("false, true", c.evaluate(false, true));
  148.98 +        assertEquals("0.0, 1.0", 1.0, c.evaluateFuzzy(0.0, 1.0), 0.0);
  148.99 +    }
 148.100 +    
 148.101 +    /** Ensure that one variable cannot be filled with two different values.
 148.102 +     * Create a circuit for x1 and x1. Make sure that for any usage of your
 148.103 +     * API that would not lead to x1 * x1 result, an exception is thrown.
 148.104 +     * For example if there was a way to feed the circuit with two different 
 148.105 +     * values 0.3 and 0.5 an exception is thrown indicating that this is 
 148.106 +     * improper use of the circuit.
 148.107 +     */
 148.108 +    public void testImproperUseOfTheCircuit() {
 148.109 +        // does not apply
 148.110 +        
 148.111 +        Circuit x1 = Circuit.input(0);
 148.112 +        Circuit c = Circuit.createOrCircuit(x1, x1);
 148.113 +        assertTrue("x1 or x1", c.evaluate(true));
 148.114 +        assertFalse("x1 or x1", c.evaluate(false));
 148.115 +        try {
 148.116 +            c.evaluate();
 148.117 +            fail("x1 or x1 with wrong params");
 148.118 +        } catch (IllegalArgumentException iea) {
 148.119 +            //expected
 148.120 +        }
 148.121 +        // the same with two instances of pin
 148.122 +        c = Circuit.createOrCircuit(Circuit.input(0), Circuit.input(0));
 148.123 +        assertTrue("x1 or x1", c.evaluate(true));
 148.124 +        assertTrue("x1 or x1", c.evaluate(true, false));
 148.125 +        assertTrue("x1 or x1", c.evaluate(true, true));
 148.126 +        assertFalse("x1 or x1", c.evaluate(false));
 148.127 +        try {
 148.128 +            c.evaluate();
 148.129 +            fail("x1 or x1 with wrong params");
 148.130 +        } catch (IllegalArgumentException iea) {
 148.131 +            //expected
 148.132 +        }
 148.133 +    }
 148.134 +    
 148.135 +    /** Write your own element type called "gte" that will have two inputs and one output.
 148.136 +     * The output value will be 1 if x1 >= x2 and 0 otherwise. 
 148.137 +     * 
 148.138 +     * Create 
 148.139 +     * circuit for following expression: (x1 and not(x1)) gte x1
 148.140 +     *
 148.141 +     * Feed the circuit with 0.5 and verify the result is 0
 148.142 +     *
 148.143 +     * Feed the same circuit with 1 and verify the result is 0
 148.144 +     *
 148.145 +     * Feed the same circuit with 0 and verify the result is 1
 148.146 +     */
 148.147 +    public void testGreaterThanEqualElement() {
 148.148 +        Circuit gte = new Gte(Circuit.createAndCircuit(
 148.149 +                                  Circuit.input(0),
 148.150 +                                  Circuit.createNotCircuit(Circuit.input(0))),
 148.151 +                              Circuit.input(0)
 148.152 +                          );
 148.153 +        assertEquals("0.5", 0.0, gte.evaluateFuzzy(0.5), 0.0);
 148.154 +        assertEquals("1.0", 0.0, gte.evaluateFuzzy(1.0), 0.0);
 148.155 +        assertEquals("0.0", 1.0, gte.evaluateFuzzy(0.0), 0.0);
 148.156 +        
 148.157 +    }
 148.158 +    
 148.159 +    public void testSilly() {
 148.160 +        // (x1 and not x2) or x3
 148.161 +        Circuit c = Circuit.createOrCircuit(
 148.162 +                              Circuit.createAndCircuit(
 148.163 +                                  null,
 148.164 +                                  Circuit.createNotCircuit(null)),
 148.165 +                              null
 148.166 +                          );
 148.167 +        assertEquals("1 1 1", 1.0, c.evaluateFuzzy(1.0, 1.0, 1.0), 0.0);
 148.168 +        assertEquals("1 1 0", 0.0, c.evaluateFuzzy(1.0, 1.0, 0.0), 0.0);
 148.169 +        assertEquals("1 0 1", 1.0, c.evaluateFuzzy(1.0, 0.0, 1.0), 0.0);
 148.170 +        assertEquals("1 0 0", 1.0, c.evaluateFuzzy(1.0, 0.0, 0.0), 0.0);
 148.171 +        assertEquals("0 1 1", 1.0, c.evaluateFuzzy(0.0, 1.0, 1.0), 0.0);
 148.172 +        assertEquals("0 1 0", 0.0, c.evaluateFuzzy(0.0, 1.0, 0.0), 0.0);
 148.173 +        assertEquals("0 0 1", 1.0, c.evaluateFuzzy(0.0, 0.0, 1.0), 0.0);
 148.174 +        assertEquals("0 0 0", 0.0, c.evaluateFuzzy(0.0, 0.0, 0.0), 0.0);
 148.175 +    }
 148.176 +}
   149.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   149.2 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/build.xml	Sat Jun 14 09:52:45 2008 +0200
   149.3 @@ -0,0 +1,97 @@
   149.4 +<?xml version="1.0" encoding="UTF-8"?>
   149.5 +<!-- this is a template file to test  -->
   149.6 +<project name="testing-template" default="run" basedir=".">
   149.7 +    <description>Builds the test against first version and runs them against two</description>
   149.8 +    
   149.9 +    <loadproperties srcfile="project.properties"/>
  149.10 +    
  149.11 +    <target name="make-sure-projects-are-compiled">
  149.12 +        <ant dir="${dayA}/${apitotest}" target="compile"/>
  149.13 +        <ant dir="${dayB}/${apitotest}" target="compile"/>
  149.14 +    </target>
  149.15 +    
  149.16 +    <target name="compile" depends="make-sure-projects-are-compiled">
  149.17 +        <mkdir dir="build/tests"/>
  149.18 +        <javac destdir="build/tests" srcdir="test">
  149.19 +            <classpath>
  149.20 +                <pathelement location="${apiA}"/>
  149.21 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  149.22 +            </classpath>
  149.23 +        </javac>
  149.24 +    </target>
  149.25 +    
  149.26 +    <target name="run" depends="-run-binary-check,-run-source-check">
  149.27 +        <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
  149.28 +            <condition>
  149.29 +                <not><or>
  149.30 +                    <isset property="execution.failed"/>
  149.31 +                    <isset property="compilation.failed"/>
  149.32 +                </or></not>
  149.33 +            </condition>
  149.34 +        </fail>
  149.35 +    </target>
  149.36 +        
  149.37 +    <target name="-run-binary-check" depends="compile">
  149.38 +        <mkdir dir="build/testresultA"/>
  149.39 +        <junit dir="build/tests" failureproperty="run.on.A.shall.succeed">
  149.40 +            <batchtest todir="build/testresultA">
  149.41 +                <fileset dir="test" includes="**/*.java"/>
  149.42 +            </batchtest>
  149.43 +            <formatter type="brief" usefile="false"/>
  149.44 +            <formatter type="xml"/>
  149.45 +            <classpath>
  149.46 +                <pathelement location="${apiA}"/>
  149.47 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  149.48 +                <pathelement location="build/tests"/>
  149.49 +            </classpath>
  149.50 +        </junit>
  149.51 +        
  149.52 +        <mkdir dir="build/testresultB"/>
  149.53 +        <junit dir="build/tests" failureproperty="run.on.B.shall.fail">
  149.54 +            <batchtest todir="build/testresultB">
  149.55 +                <fileset dir="test" includes="**/*.java"/>
  149.56 +            </batchtest>
  149.57 +            <formatter type="brief" usefile="false"/>
  149.58 +            <formatter type="xml"/>
  149.59 +            <classpath>
  149.60 +                <pathelement location="${apiB}"/>
  149.61 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  149.62 +                <pathelement location="build/tests"/>
  149.63 +            </classpath>
  149.64 +        </junit>
  149.65 +        
  149.66 +        <condition property="execution.failed">
  149.67 +            <and>
  149.68 +                <isset property="run.on.B.shall.fail"/>
  149.69 +                <not><isset property="run.on.A.shall.succeed"/></not>
  149.70 +            </and>
  149.71 +        </condition>
  149.72 +    </target>
  149.73 +    
  149.74 +    <target name="-run-source-check" depends="compile" unless="execution.failed">
  149.75 +        
  149.76 +        <property name="build.b" location="build/verifyitbuildsagainstB"/>
  149.77 +        <delete dir="${build.b}"/>
  149.78 +        <mkdir dir="${build.b}"/>
  149.79 +        <javac destdir="${build.b}" srcdir="test" failonerror="false">
  149.80 +            <classpath>
  149.81 +                <pathelement location="${apiB}"/>
  149.82 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  149.83 +            </classpath>
  149.84 +        </javac>
  149.85 +
  149.86 +        
  149.87 +        <uptodate property="compilation.failed">
  149.88 +            <srcfiles dir="${build.b}" includes="**/*.class"/>
  149.89 +            <mapper type="glob" from="*" to="build/tests/*"/>
  149.90 +        </uptodate>
  149.91 +        
  149.92 +
  149.93 +    </target>
  149.94 +    
  149.95 +    <target name="test" depends="run"/>
  149.96 +    
  149.97 +    <target name="clean">
  149.98 +        <delete dir="build"/>
  149.99 +    </target>
 149.100 +</project>    
   150.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   150.2 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   150.3 @@ -0,0 +1,77 @@
   150.4 +<?xml version="1.0" encoding="UTF-8"?>
   150.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   150.6 +    <type>org.netbeans.modules.ant.freeform</type>
   150.7 +    <configuration>
   150.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
   150.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
  150.10 +            <name>testing-template</name>
  150.11 +            <properties>
  150.12 +                <property name="ant.script">build.xml</property>
  150.13 +                <property-file>project.properties</property-file>
  150.14 +            </properties>
  150.15 +            <folders>
  150.16 +                <source-folder>
  150.17 +                    <label>test</label>
  150.18 +                    <type>java</type>
  150.19 +                    <location>test</location>
  150.20 +                </source-folder>
  150.21 +            </folders>
  150.22 +            <ide-actions>
  150.23 +                <action name="build">
  150.24 +                    <script>${ant.script}</script>
  150.25 +                    <target>compile</target>
  150.26 +                </action>
  150.27 +                <action name="clean">
  150.28 +                    <script>${ant.script}</script>
  150.29 +                    <target>clean</target>
  150.30 +                </action>
  150.31 +                <action name="run">
  150.32 +                    <script>${ant.script}</script>
  150.33 +                    <target>test</target>
  150.34 +                </action>
  150.35 +                <action name="test">
  150.36 +                    <script>${ant.script}</script>
  150.37 +                    <target>test</target>
  150.38 +                </action>
  150.39 +                <action name="rebuild">
  150.40 +                    <script>${ant.script}</script>
  150.41 +                    <target>clean</target>
  150.42 +                    <target>compile</target>
  150.43 +                </action>
  150.44 +            </ide-actions>
  150.45 +            <export>
  150.46 +                <type>folder</type>
  150.47 +                <location>build/tests</location>
  150.48 +                <script>${ant.script}</script>
  150.49 +                <build-target>compile</build-target>
  150.50 +            </export>
  150.51 +            <view>
  150.52 +                <items>
  150.53 +                    <source-folder style="packages">
  150.54 +                        <label>test</label>
  150.55 +                        <location>test</location>
  150.56 +                    </source-folder>
  150.57 +                    <source-file>
  150.58 +                        <location>${ant.script}</location>
  150.59 +                    </source-file>
  150.60 +                </items>
  150.61 +                <context-menu>
  150.62 +                    <ide-action name="build"/>
  150.63 +                    <ide-action name="clean"/>
  150.64 +                    <ide-action name="run"/>
  150.65 +                    <ide-action name="test"/>
  150.66 +                    <ide-action name="rebuild"/>
  150.67 +                </context-menu>
  150.68 +            </view>
  150.69 +            <subprojects/>
  150.70 +        </general-data>
  150.71 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
  150.72 +            <compilation-unit>
  150.73 +                <package-root>test</package-root>
  150.74 +                <classpath mode="compile">${apiA}:${apifest}/lib/junit-3.8.2.jar</classpath>
  150.75 +                <built-to>build/tests</built-to>
  150.76 +                <source-level>1.5</source-level>
  150.77 +            </compilation-unit>
  150.78 +        </java-data>
  150.79 +    </configuration>
  150.80 +</project>
   151.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   151.2 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/project.properties	Sat Jun 14 09:52:45 2008 +0200
   151.3 @@ -0,0 +1,17 @@
   151.4 +
   151.5 +# location to root of the repository with apifest projects
   151.6 +apifest=../../..
   151.7 +
   151.8 +# name of a project to test
   151.9 +apitotest=pinbasedsolution
  151.10 +
  151.11 +# the test shall expose a problem between two versions
  151.12 +# of one API. select the first version - dayA and a second 
  151.13 +# version of the of the API dayB
  151.14 +dayA=${apifest}/day1
  151.15 +dayB=${apifest}/day2
  151.16 +
  151.17 +# usual locations of API classes for each version
  151.18 +apiA=${dayA}/${apitotest}/build/classes/
  151.19 +apiB=${dayB}/${apitotest}/build/classes/
  151.20 +
   152.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   152.2 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-pinbasedsolution/test/apifest/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   152.3 @@ -0,0 +1,33 @@
   152.4 +/*
   152.5 + * The contents of this file are subject to the terms of the Common Development
   152.6 + * and Distribution License (the License). You may not use this file except in
   152.7 + * compliance with the License.
   152.8 + *
   152.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  152.10 + * or http://www.netbeans.org/cddl.txt.
  152.11 + *
  152.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  152.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  152.14 + * If applicable, add the following below the CDDL Header, with the fields
  152.15 + * enclosed by brackets [] replaced by your own identifying information:
  152.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  152.17 + *
  152.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  152.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  152.20 + * Microsystems, Inc. All Rights Reserved.
  152.21 + */
  152.22 +package apifest;
  152.23 +
  152.24 +import junit.framework.TestCase;
  152.25 +
  152.26 +
  152.27 +/** Write a test that works with version from day A and fails with version B.
  152.28 + */
  152.29 +public class CircuitTest extends TestCase {
  152.30 +    public CircuitTest(String n) {
  152.31 +        super(n);
  152.32 +    }
  152.33 +    
  152.34 +    public void testClass() throws Exception {
  152.35 +    }
  152.36 +}
   153.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   153.2 +++ b/samples/apifest1/infrastructure/testing-template/build.xml	Sat Jun 14 09:52:45 2008 +0200
   153.3 @@ -0,0 +1,16 @@
   153.4 +<?xml version="1.0" encoding="UTF-8"?>
   153.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
   153.6 +<!-- for some information on what you could do (e.g. targets to override). -->
   153.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
   153.8 +<project name="org.netbeans.apifest.testingtemplate" default="netbeans" basedir=".">
   153.9 +    <description>Builds, tests, and runs the project org.netbeans.apifest.testingtemplate.</description>
  153.10 +    <import file="nbproject/build-impl.xml"/>
  153.11 +    
  153.12 +    <target name="zip-project">
  153.13 +        <zip destfile="src/org/netbeans/apifest/testingtemplate/TestingTemplateProject.zip">
  153.14 +            <fileset dir="project"/>
  153.15 +        </zip>
  153.16 +    </target>
  153.17 +    
  153.18 +    <target name="files-init" depends="zip-project,projectized-common.files-init"/>
  153.19 +</project>
   154.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   154.2 +++ b/samples/apifest1/infrastructure/testing-template/manifest.mf	Sat Jun 14 09:52:45 2008 +0200
   154.3 @@ -0,0 +1,6 @@
   154.4 +Manifest-Version: 1.0
   154.5 +OpenIDE-Module: org.netbeans.apifest.testingtemplate
   154.6 +OpenIDE-Module-Layer: org/netbeans/apifest/testingtemplate/layer.xml
   154.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/apifest/testingtemplate/Bundle.properties
   154.8 +OpenIDE-Module-Specification-Version: 1.0
   154.9 +
   155.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   155.2 +++ b/samples/apifest1/infrastructure/testing-template/nbproject/build-impl.xml	Sat Jun 14 09:52:45 2008 +0200
   155.3 @@ -0,0 +1,27 @@
   155.4 +<?xml version="1.0" encoding="UTF-8"?>
   155.5 +<!--
   155.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
   155.7 +***         EDIT ../build.xml INSTEAD         ***
   155.8 +-->
   155.9 +<project name="org.netbeans.apifest.testingtemplate-impl" basedir=".." xmlns:nbmproject="http://www.netbeans.org/ns/nb-module-project/2">
  155.10 +    <property file="nbproject/private/platform-private.properties"/>
  155.11 +    <property file="nbproject/platform.properties"/>
  155.12 +    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
  155.13 +        <attribute name="name"/>
  155.14 +        <attribute name="value"/>
  155.15 +        <sequential>
  155.16 +            <property name="@{name}" value="${@{value}}"/>
  155.17 +        </sequential>
  155.18 +    </macrodef>
  155.19 +    <property file="${user.properties.file}"/>
  155.20 +    <nbmproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
  155.21 +    <nbmproject:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
  155.22 +    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
  155.23 +        <condition>
  155.24 +            <not>
  155.25 +                <available file="${harness.dir}" type="dir"/>
  155.26 +            </not>
  155.27 +        </condition>
  155.28 +    </fail>
  155.29 +    <import file="${harness.dir}/build.xml"/>
  155.30 +</project>
   156.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   156.2 +++ b/samples/apifest1/infrastructure/testing-template/nbproject/genfiles.properties	Sat Jun 14 09:52:45 2008 +0200
   156.3 @@ -0,0 +1,8 @@
   156.4 +build.xml.data.CRC32=d0464ec2
   156.5 +build.xml.script.CRC32=356df90d
   156.6 +build.xml.stylesheet.CRC32=77ef55dd
   156.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
   156.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
   156.9 +nbproject/build-impl.xml.data.CRC32=d0464ec2
  156.10 +nbproject/build-impl.xml.script.CRC32=46a2ac01
  156.11 +nbproject/build-impl.xml.stylesheet.CRC32=2607fe5f
   157.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   157.2 +++ b/samples/apifest1/infrastructure/testing-template/nbproject/platform.properties	Sat Jun 14 09:52:45 2008 +0200
   157.3 @@ -0,0 +1,1 @@
   157.4 +nbplatform.active=default
   158.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   158.2 +++ b/samples/apifest1/infrastructure/testing-template/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   158.3 @@ -0,0 +1,80 @@
   158.4 +<?xml version="1.0" encoding="UTF-8"?>
   158.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   158.6 +    <type>org.netbeans.modules.apisupport.project</type>
   158.7 +    <configuration>
   158.8 +        <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
   158.9 +            <code-name-base>org.netbeans.apifest.testingtemplate</code-name-base>
  158.10 +            <standalone/>
  158.11 +            <module-dependencies>
  158.12 +                <dependency>
  158.13 +                    <code-name-base>org.jdesktop.layout</code-name-base>
  158.14 +                    <build-prerequisite/>
  158.15 +                    <compile-dependency/>
  158.16 +                    <run-dependency>
  158.17 +                        <release-version>1</release-version>
  158.18 +                        <specification-version>1.4</specification-version>
  158.19 +                    </run-dependency>
  158.20 +                </dependency>
  158.21 +                <dependency>
  158.22 +                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
  158.23 +                    <build-prerequisite/>
  158.24 +                    <compile-dependency/>
  158.25 +                    <run-dependency>
  158.26 +                        <release-version>1</release-version>
  158.27 +                        <specification-version>1.10</specification-version>
  158.28 +                    </run-dependency>
  158.29 +                </dependency>
  158.30 +                <dependency>
  158.31 +                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
  158.32 +                    <build-prerequisite/>
  158.33 +                    <compile-dependency/>
  158.34 +                    <run-dependency>
  158.35 +                        <release-version>1</release-version>
  158.36 +                        <specification-version>1.15.0.5</specification-version>
  158.37 +                    </run-dependency>
  158.38 +                </dependency>
  158.39 +                <dependency>
  158.40 +                    <code-name-base>org.openide.awt</code-name-base>
  158.41 +                    <build-prerequisite/>
  158.42 +                    <compile-dependency/>
  158.43 +                    <run-dependency>
  158.44 +                        <specification-version>6.8.0.1</specification-version>
  158.45 +                    </run-dependency>
  158.46 +                </dependency>
  158.47 +                <dependency>
  158.48 +                    <code-name-base>org.openide.dialogs</code-name-base>
  158.49 +                    <build-prerequisite/>
  158.50 +                    <compile-dependency/>
  158.51 +                    <run-dependency>
  158.52 +                        <specification-version>7.0</specification-version>
  158.53 +                    </run-dependency>
  158.54 +                </dependency>
  158.55 +                <dependency>
  158.56 +                    <code-name-base>org.openide.filesystems</code-name-base>
  158.57 +                    <build-prerequisite/>
  158.58 +                    <compile-dependency/>
  158.59 +                    <run-dependency>
  158.60 +                        <specification-version>7.0</specification-version>
  158.61 +                    </run-dependency>
  158.62 +                </dependency>
  158.63 +                <dependency>
  158.64 +                    <code-name-base>org.openide.loaders</code-name-base>
  158.65 +                    <build-prerequisite/>
  158.66 +                    <compile-dependency/>
  158.67 +                    <run-dependency>
  158.68 +                        <specification-version>5.11</specification-version>
  158.69 +                    </run-dependency>
  158.70 +                </dependency>
  158.71 +                <dependency>
  158.72 +                    <code-name-base>org.openide.util</code-name-base>
  158.73 +                    <build-prerequisite/>
  158.74 +                    <compile-dependency/>
  158.75 +                    <run-dependency>
  158.76 +                        <specification-version>7.2.1</specification-version>
  158.77 +                    </run-dependency>
  158.78 +                </dependency>
  158.79 +            </module-dependencies>
  158.80 +            <public-packages/>
  158.81 +        </data>
  158.82 +    </configuration>
  158.83 +</project>
   159.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   159.2 +++ b/samples/apifest1/infrastructure/testing-template/project/build.xml	Sat Jun 14 09:52:45 2008 +0200
   159.3 @@ -0,0 +1,97 @@
   159.4 +<?xml version="1.0" encoding="UTF-8"?>
   159.5 +<!-- this is a template file to test  -->
   159.6 +<project name="testing-template" default="run" basedir=".">
   159.7 +    <description>Builds the test against first version and runs them against two</description>
   159.8 +    
   159.9 +    <loadproperties srcfile="project.properties"/>
  159.10 +    
  159.11 +    <target name="make-sure-projects-are-compiled">
  159.12 +        <ant dir="${dayA}/${apitotest}" target="compile"/>
  159.13 +        <ant dir="${dayB}/${apitotest}" target="compile"/>
  159.14 +    </target>
  159.15 +    
  159.16 +    <target name="compile" depends="make-sure-projects-are-compiled">
  159.17 +        <mkdir dir="build/tests"/>
  159.18 +        <javac destdir="build/tests" srcdir="test">
  159.19 +            <classpath>
  159.20 +                <pathelement location="${apiA}"/>
  159.21 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  159.22 +            </classpath>
  159.23 +        </javac>
  159.24 +    </target>
  159.25 +    
  159.26 +    <target name="run" depends="-run-binary-check,-run-source-check">
  159.27 +        <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
  159.28 +            <condition>
  159.29 +                <not><or>
  159.30 +                    <isset property="execution.failed"/>
  159.31 +                    <isset property="compilation.failed"/>
  159.32 +                </or></not>
  159.33 +            </condition>
  159.34 +        </fail>
  159.35 +    </target>
  159.36 +        
  159.37 +    <target name="-run-binary-check" depends="compile">
  159.38 +        <mkdir dir="build/testresultA"/>
  159.39 +        <junit dir="build/tests" failureproperty="run.on.A.shall.succeed">
  159.40 +            <batchtest todir="build/testresultA">
  159.41 +                <fileset dir="test" includes="**/*.java"/>
  159.42 +            </batchtest>
  159.43 +            <formatter type="brief" usefile="false"/>
  159.44 +            <formatter type="xml"/>
  159.45 +            <classpath>
  159.46 +                <pathelement location="${apiA}"/>
  159.47 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  159.48 +                <pathelement location="build/tests"/>
  159.49 +            </classpath>
  159.50 +        </junit>
  159.51 +        
  159.52 +        <mkdir dir="build/testresultB"/>
  159.53 +        <junit dir="build/tests" failureproperty="run.on.B.shall.fail">
  159.54 +            <batchtest todir="build/testresultB">
  159.55 +                <fileset dir="test" includes="**/*.java"/>
  159.56 +            </batchtest>
  159.57 +            <formatter type="brief" usefile="false"/>
  159.58 +            <formatter type="xml"/>
  159.59 +            <classpath>
  159.60 +                <pathelement location="${apiB}"/>
  159.61 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  159.62 +                <pathelement location="build/tests"/>
  159.63 +            </classpath>
  159.64 +        </junit>
  159.65 +        
  159.66 +        <condition property="execution.failed">
  159.67 +            <and>
  159.68 +                <isset property="run.on.B.shall.fail"/>
  159.69 +                <not><isset property="run.on.A.shall.succeed"/></not>
  159.70 +            </and>
  159.71 +        </condition>
  159.72 +    </target>
  159.73 +    
  159.74 +    <target name="-run-source-check" depends="compile" unless="execution.failed">
  159.75 +        
  159.76 +        <property name="build.b" location="build/verifyitbuildsagainstB"/>
  159.77 +        <delete dir="${build.b}"/>
  159.78 +        <mkdir dir="${build.b}"/>
  159.79 +        <javac destdir="${build.b}" srcdir="test" failonerror="false">
  159.80 +            <classpath>
  159.81 +                <pathelement location="${apiB}"/>
  159.82 +                <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
  159.83 +            </classpath>
  159.84 +        </javac>
  159.85 +
  159.86 +        
  159.87 +        <uptodate property="compilation.failed">
  159.88 +            <srcfiles dir="${build.b}" includes="**/*.class"/>
  159.89 +            <mapper type="glob" from="*" to="build/tests/*"/>
  159.90 +        </uptodate>
  159.91 +        
  159.92 +
  159.93 +    </target>
  159.94 +    
  159.95 +    <target name="test" depends="run"/>
  159.96 +    
  159.97 +    <target name="clean">
  159.98 +        <delete dir="build"/>
  159.99 +    </target>
 159.100 +</project>    
   160.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   160.2 +++ b/samples/apifest1/infrastructure/testing-template/project/nbproject/project.xml	Sat Jun 14 09:52:45 2008 +0200
   160.3 @@ -0,0 +1,77 @@
   160.4 +<?xml version="1.0" encoding="UTF-8"?>
   160.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
   160.6 +    <type>org.netbeans.modules.ant.freeform</type>
   160.7 +    <configuration>
   160.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
   160.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
  160.10 +            <name>testing-template</name>
  160.11 +            <properties>
  160.12 +                <property name="ant.script">build.xml</property>
  160.13 +                <property-file>project.properties</property-file>
  160.14 +            </properties>
  160.15 +            <folders>
  160.16 +                <source-folder>
  160.17 +                    <label>test</label>
  160.18 +                    <type>java</type>
  160.19 +                    <location>test</location>
  160.20 +                </source-folder>
  160.21 +            </folders>
  160.22 +            <ide-actions>
  160.23 +                <action name="build">
  160.24 +                    <script>${ant.script}</script>
  160.25 +                    <target>compile</target>
  160.26 +                </action>
  160.27 +                <action name="clean">
  160.28 +                    <script>${ant.script}</script>
  160.29 +                    <target>clean</target>
  160.30 +                </action>
  160.31 +                <action name="run">
  160.32 +                    <script>${ant.script}</script>
  160.33 +                    <target>test</target>
  160.34 +                </action>
  160.35 +                <action name="test">
  160.36 +                    <script>${ant.script}</script>
  160.37 +                    <target>test</target>
  160.38 +                </action>
  160.39 +                <action name="rebuild">
  160.40 +                    <script>${ant.script}</script>
  160.41 +                    <target>clean</target>
  160.42 +                    <target>compile</target>
  160.43 +                </action>
  160.44 +            </ide-actions>
  160.45 +            <export>
  160.46 +                <type>folder</type>
  160.47 +                <location>build/tests</location>
  160.48 +                <script>${ant.script}</script>
  160.49 +                <build-target>compile</build-target>
  160.50 +            </export>
  160.51 +            <view>
  160.52 +                <items>
  160.53 +                    <source-folder style="packages">
  160.54 +                        <label>test</label>
  160.55 +                        <location>test</location>
  160.56 +                    </source-folder>
  160.57 +                    <source-file>
  160.58 +                        <location>${ant.script}</location>
  160.59 +                    </source-file>
  160.60 +                </items>
  160.61 +                <context-menu>
  160.62 +                    <ide-action name="build"/>
  160.63 +                    <ide-action name="clean"/>
  160.64 +                    <ide-action name="run"/>
  160.65 +                    <ide-action name="test"/>
  160.66 +                    <ide-action name="rebuild"/>
  160.67 +                </context-menu>
  160.68 +            </view>
  160.69 +            <subprojects/>
  160.70 +        </general-data>
  160.71 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
  160.72 +            <compilation-unit>
  160.73 +                <package-root>test</package-root>
  160.74 +                <classpath mode="compile">${apiA}:${apifest}/lib/junit-3.8.2.jar</classpath>
  160.75 +                <built-to>build/tests</built-to>
  160.76 +                <source-level>1.5</source-level>
  160.77 +            </compilation-unit>
  160.78 +        </java-data>
  160.79 +    </configuration>
  160.80 +</project>
   161.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   161.2 +++ b/samples/apifest1/infrastructure/testing-template/project/project.properties	Sat Jun 14 09:52:45 2008 +0200
   161.3 @@ -0,0 +1,17 @@
   161.4 +
   161.5 +# location to root of the repository with apifest projects
   161.6 +apifest=../../..
   161.7 +
   161.8 +# name of a project to test
   161.9 +apitotest=alwayscreatenewcircuit
  161.10 +
  161.11 +# the test shall expose a problem between two versions
  161.12 +# of one API. select the first version - dayA and a second 
  161.13 +# version of the of the API dayB
  161.14 +dayA=${apifest}/day1
  161.15 +dayB=${apifest}/day2
  161.16 +
  161.17 +# usual locations of API classes for each version
  161.18 +apiA=${dayA}/${apitotest}/build/classes/
  161.19 +apiB=${dayB}/${apitotest}/build/classes/
  161.20 +
   162.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   162.2 +++ b/samples/apifest1/infrastructure/testing-template/project/test/apifest/CircuitTest.java	Sat Jun 14 09:52:45 2008 +0200
   162.3 @@ -0,0 +1,33 @@
   162.4 +/*
   162.5 + * The contents of this file are subject to the terms of the Common Development
   162.6 + * and Distribution License (the License). You may not use this file except in
   162.7 + * compliance with the License.
   162.8 + *
   162.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  162.10 + * or http://www.netbeans.org/cddl.txt.
  162.11 + *
  162.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
  162.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
  162.14 + * If applicable, add the following below the CDDL Header, with the fields
  162.15 + * enclosed by brackets [] replaced by your own identifying information:
  162.16 + * "Portions Copyrighted [year] [name of copyright owner]"
  162.17 + *
  162.18 + * The Original Software is NetBeans. The Initial Developer of the Original
  162.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  162.20 + * Microsystems, Inc. All Rights Reserved.
  162.21 + */
  162.22 +package apifest;
  162.23 +
  162.24 +import junit.framework.TestCase;
  162.25 +
  162.26 +
  162.27 +/** Write a test that works with version from day A and fails with version B.
  162.28 + */
  162.29 +public class CircuitTest extends TestCase {
  162.30 +    public CircuitTest(String n) {
  162.31 +        super(n);
  162.32 +    }
  162.33 +    
  162.34 +    public void testClass() throws Exception {
  162.35 +    }
  162.36 +}
   163.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   163.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/Bundle.properties	Sat Jun 14 09:52:45 2008 +0200
   163.3 @@ -0,0 +1,3 @@
   163.4 +LBL_CreateProjectStep=Name and Location
   163.5 +OpenIDE-Module-Name=Template to create testing project
   163.6 +Templates/Project/APIFest/TestingTemplateProject.zip=API Fest Testing Project
   164.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   164.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateDescription.html	Sat Jun 14 09:52:45 2008 +0200
   164.3 @@ -0,0 +1,5 @@
   164.4 +<html>
   164.5 +    <body>
   164.6 +        Sample API Fest Testing Project project
   164.7 +    </body>
   164.8 +</html>
   165.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   165.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplatePanelVisual.form	Sat Jun 14 09:52:45 2008 +0200
   165.3 @@ -0,0 +1,107 @@
   165.4 +<?xml version="1.0" encoding="UTF-8" ?>
   165.5 +
   165.6 +<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
   165.7 +  <AuxValues>
   165.8 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
   165.9 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
  165.10 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
  165.11 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
  165.12 +  </AuxValues>
  165.13 +
  165.14 +  <Layout>
  165.15 +    <DimensionLayout dim="0">
  165.16 +      <Group type="103" groupAlignment="0" attributes="0">
  165.17 +          <Group type="102" attributes="0">
  165.18 +              <EmptySpace min="-2" max="-2" attributes="0"/>
  165.19 +              <Group type="103" groupAlignment="0" attributes="0">
  165.20 +                  <Component id="projectNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
  165.21 +                  <Component id="projectLocationLabel" alignment="0" min="-2" max="-2" attributes="0"/>
  165.22 +                  <Component id="createdFolderLabel" alignment="0" min="-2" max="-2" attributes="0"/>
  165.23 +              </Group>
  165.24 +              <EmptySpace min="-2" max="-2" attributes="0"/>
  165.25 +              <Group type="103" groupAlignment="0" attributes="0">
  165.26 +                  <Component id="projectNameTextField" alignment="1" pref="191" max="32767" attributes="0"/>
  165.27 +                  <Component id="projectLocationTextField" alignment="1" pref="191" max="32767" attributes="0"/>
  165.28 +                  <Component id="createdFolderTextField" alignment="1" pref="191" max="32767" attributes="0"/>
  165.29 +              </Group>
  165.30 +              <EmptySpace min="-2" max="-2" attributes="0"/>
  165.31 +              <Component id="browseButton" min="-2" max="-2" attributes="0"/>
  165.32 +              <EmptySpace min="-2" max="-2" attributes="0"/>
  165.33 +          </Group>
  165.34 +      </Group>
  165.35 +    </DimensionLayout>
  165.36 +    <DimensionLayout dim="1">
  165.37 +      <Group type="103" groupAlignment="0" attributes="0">
  165.38 +          <Group type="102" attributes="0">
  165.39 +              <EmptySpace max="-2" attributes="0"/>
  165.40 +              <Group type="103" groupAlignment="3" attributes="0">
  165.41 +                  <Component id="projectNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
  165.42 +                  <Component id="projectNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
  165.43 +              </Group>
  165.44 +              <EmptySpace max="-2" attributes="0"/>
  165.45 +              <Group type="103" groupAlignment="3" attributes="0">
  165.46 +                  <Component id="projectLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
  165.47 +                  <Component id="projectLocationTextField" alignment="3" min="-2" max="-2" attributes="0"/>
  165.48 +                  <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
  165.49 +              </Group>
  165.50 +              <EmptySpace max="-2" attributes="0"/>
  165.51 +              <Group type="103" groupAlignment="3" attributes="0">
  165.52 +                  <Component id="createdFolderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
  165.53 +                  <Component id="createdFolderTextField" alignment="3" min="-2" max="-2" attributes="0"/>
  165.54 +              </Group>
  165.55 +              <EmptySpace pref="213" max="32767" attributes="0"/>
  165.56 +          </Group>
  165.57 +      </Group>
  165.58 +    </DimensionLayout>
  165.59 +  </Layout>
  165.60 +  <SubComponents>
  165.61 +    <Component class="javax.swing.JLabel" name="projectNameLabel">
  165.62 +      <Properties>
  165.63 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  165.64 +          <ComponentRef name="projectNameTextField"/>
  165.65 +        </Property>
  165.66 +        <Property name="text" type="java.lang.String" value="Project &amp;Name:"/>
  165.67 +      </Properties>
  165.68 +      <AuxValues>
  165.69 +        <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
  165.70 +      </AuxValues>
  165.71 +    </Component>
  165.72 +    <Component class="javax.swing.JTextField" name="projectNameTextField">
  165.73 +    </Component>
  165.74 +    <Component class="javax.swing.JLabel" name="projectLocationLabel">
  165.75 +      <Properties>
  165.76 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  165.77 +          <ComponentRef name="projectLocationTextField"/>
  165.78 +        </Property>
  165.79 +        <Property name="text" type="java.lang.String" value="Project &amp;Location:"/>
  165.80 +      </Properties>
  165.81 +      <AuxValues>
  165.82 +        <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
  165.83 +      </AuxValues>
  165.84 +    </Component>
  165.85 +    <Component class="javax.swing.JTextField" name="projectLocationTextField">
  165.86 +    </Component>
  165.87 +    <Component class="javax.swing.JButton" name="browseButton">
  165.88 +      <Properties>
  165.89 +        <Property name="text" type="java.lang.String" value="Br&amp;owse..."/>
  165.90 +        <Property name="actionCommand" type="java.lang.String" value="BROWSE"/>
  165.91 +      </Properties>
  165.92 +      <Events>
  165.93 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
  165.94 +      </Events>
  165.95 +    </Component>
  165.96 +    <Component class="javax.swing.JLabel" name="createdFolderLabel">
  165.97 +      <Properties>
  165.98 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  165.99 +          <ComponentRef name="createdFolderTextField"/>
 165.100 +        </Property>
 165.101 +        <Property name="text" type="java.lang.String" value="Project &amp;Folder:"/>
 165.102 +      </Properties>
 165.103 +    </Component>
 165.104 +    <Component class="javax.swing.JTextField" name="createdFolderTextField">
 165.105 +      <Properties>
 165.106 +        <Property name="editable" type="boolean" value="false"/>
 165.107 +      </Properties>
 165.108 +    </Component>
 165.109 +  </SubComponents>
 165.110 +</Form>
   166.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   166.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplatePanelVisual.java	Sat Jun 14 09:52:45 2008 +0200
   166.3 @@ -0,0 +1,260 @@
   166.4 +package org.netbeans.apifest.testingtemplate;
   166.5 +
   166.6 +import java.io.File;
   166.7 +import javax.swing.JFileChooser;
   166.8 +import javax.swing.JPanel;
   166.9 +import javax.swing.event.DocumentEvent;
  166.10 +import javax.swing.event.DocumentListener;
  166.11 +import javax.swing.text.Document;
  166.12 +import org.netbeans.spi.project.ui.support.ProjectChooser;
  166.13 +import org.openide.WizardDescriptor;
  166.14 +import org.openide.WizardValidationException;
  166.15 +import org.openide.filesystems.FileUtil;
  166.16 +
  166.17 +public class TestingTemplatePanelVisual extends JPanel implements DocumentListener {
  166.18 +    
  166.19 +    public static final String PROP_PROJECT_NAME = "projectName";
  166.20 +    
  166.21 +    private TestingTemplateWizardPanel panel;
  166.22 +    
  166.23 +    /** Creates new form PanelProjectLocationVisual */
  166.24 +    public TestingTemplatePanelVisual(TestingTemplateWizardPanel panel) {
  166.25 +        initComponents();
  166.26 +        this.panel = panel;
  166.27 +        // Register listener on the textFields to make the automatic updates
  166.28 +        projectNameTextField.getDocument().addDocumentListener(this);
  166.29 +        projectLocationTextField.getDocument().addDocumentListener(this);
  166.30 +    }
  166.31 +    
  166.32 +    
  166.33 +    public String getProjectName() {
  166.34 +        return this.projectNameTextField.getText();
  166.35 +    }
  166.36 +    
  166.37 +    /** This method is called from within the constructor to
  166.38 +     * initialize the form.
  166.39 +     * WARNING: Do NOT modify this code. The content of this method is
  166.40 +     * always regenerated by the Form Editor.
  166.41 +     */
  166.42 +    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  166.43 +    private void initComponents() {
  166.44 +        projectNameLabel = new javax.swing.JLabel();
  166.45 +        projectNameTextField = new javax.swing.JTextField();
  166.46 +        projectLocationLabel = new javax.swing.JLabel();
  166.47 +        projectLocationTextField = new javax.swing.JTextField();
  166.48 +        browseButton = new javax.swing.JButton();
  166.49 +        createdFolderLabel = new javax.swing.JLabel();
  166.50 +        createdFolderTextField = new javax.swing.JTextField();
  166.51 +
  166.52 +        projectNameLabel.setLabelFor(projectNameTextField);
  166.53 +        org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, "Project &Name:");
  166.54 +
  166.55 +        projectLocationLabel.setLabelFor(projectLocationTextField);
  166.56 +        org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, "Project &Location:");
  166.57 +
  166.58 +        org.openide.awt.Mnemonics.setLocalizedText(browseButton, "Br&owse...");
  166.59 +        browseButton.setActionCommand("BROWSE");
  166.60 +        browseButton.addActionListener(new java.awt.event.ActionListener() {
  166.61 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  166.62 +                browseButtonActionPerformed(evt);
  166.63 +            }
  166.64 +        });
  166.65 +
  166.66 +        createdFolderLabel.setLabelFor(createdFolderTextField);
  166.67 +        org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, "Project &Folder:");
  166.68 +
  166.69 +        createdFolderTextField.setEditable(false);
  166.70 +
  166.71 +        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
  166.72 +        this.setLayout(layout);
  166.73 +        layout.setHorizontalGroup(
  166.74 +            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  166.75 +            .add(layout.createSequentialGroup()
  166.76 +                .addContainerGap()
  166.77 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  166.78 +                    .add(projectNameLabel)
  166.79 +                    .add(projectLocationLabel)
  166.80 +                    .add(createdFolderLabel))
  166.81 +                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  166.82 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  166.83 +                    .add(org.jdesktop.layout.GroupLayout.TRAILING, projectNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
  166.84 +                    .add(org.jdesktop.layout.GroupLayout.TRAILING, projectLocationTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
  166.85 +                    .add(org.jdesktop.layout.GroupLayout.TRAILING, createdFolderTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
  166.86 +                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  166.87 +                .add(browseButton)
  166.88 +                .addContainerGap())
  166.89 +        );
  166.90 +        layout.setVerticalGroup(
  166.91 +            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  166.92 +            .add(layout.createSequentialGroup()
  166.93 +                .addContainerGap()
  166.94 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  166.95 +                    .add(projectNameLabel)
  166.96 +                    .add(projectNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  166.97 +                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  166.98 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  166.99 +                    .add(projectLocationLabel)
 166.100 +                    .add(projectLocationTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
 166.101 +                    .add(browseButton))
 166.102 +                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
 166.103 +                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
 166.104 +                    .add(createdFolderLabel)
 166.105 +                    .add(createdFolderTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
 166.106 +                .addContainerGap(213, Short.MAX_VALUE))
 166.107 +        );
 166.108 +    }// </editor-fold>//GEN-END:initComponents
 166.109 +    
 166.110 +    private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
 166.111 +        String command = evt.getActionCommand();
 166.112 +        if ("BROWSE".equals(command)) {
 166.113 +            JFileChooser chooser = new JFileChooser();
 166.114 +            FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
 166.115 +            chooser.setDialogTitle("Select Project Location");
 166.116 +            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
 166.117 +            String path = this.projectLocationTextField.getText();
 166.118 +            if (path.length() > 0) {
 166.119 +                File f = new File(path);
 166.120 +                if (f.exists()) {
 166.121 +                    chooser.setSelectedFile(f);
 166.122 +                }
 166.123 +            }
 166.124 +            if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
 166.125 +                File projectDir = chooser.getSelectedFile();
 166.126 +                projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
 166.127 +            }
 166.128 +            panel.fireChangeEvent();
 166.129 +        }
 166.130 +        
 166.131 +    }//GEN-LAST:event_browseButtonActionPerformed
 166.132 +    
 166.133 +    
 166.134 +    // Variables declaration - do not modify//GEN-BEGIN:variables
 166.135 +    private javax.swing.JButton browseButton;
 166.136 +    private javax.swing.JLabel createdFolderLabel;
 166.137 +    private javax.swing.JTextField createdFolderTextField;
 166.138 +    private javax.swing.JLabel projectLocationLabel;
 166.139 +    private javax.swing.JTextField projectLocationTextField;
 166.140 +    private javax.swing.JLabel projectNameLabel;
 166.141 +    private javax.swing.JTextField projectNameTextField;
 166.142 +    // End of variables declaration//GEN-END:variables
 166.143 +    
 166.144 +    public void addNotify() {
 166.145 +        super.addNotify();
 166.146 +        //same problem as in 31086, initial focus on Cancel button
 166.147 +        projectNameTextField.requestFocus();
 166.148 +    }
 166.149 +    
 166.150 +    boolean valid(WizardDescriptor wizardDescriptor) {
 166.151 +        
 166.152 +        if (projectNameTextField.getText().length() == 0) {
 166.153 +            wizardDescriptor.putProperty("WizardPanel_errorMessage",
 166.154 +                "Project Name is not a valid folder name.");
 166.155 +            return false; // Display name not specified
 166.156 +        }
 166.157 +        File f = FileUtil.normalizeFile(new File(projectLocationTextField.getText()).getAbsoluteFile());
 166.158 +        if (!f.isDirectory()) {
 166.159 +            String message = "Project Folder is not a valid path.";
 166.160 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
 166.161 +            return false;
 166.162 +        }
 166.163 +        final File destFolder = FileUtil.normalizeFile(new File(createdFolderTextField.getText()).getAbsoluteFile());
 166.164 +        
 166.165 +        File projLoc = destFolder;
 166.166 +        while (projLoc != null && !projLoc.exists()) {
 166.167 +            projLoc = projLoc.getParentFile();
 166.168 +        }
 166.169 +        if (projLoc == null || !projLoc.canWrite()) {
 166.170 +            wizardDescriptor.putProperty("WizardPanel_errorMessage",
 166.171 +                "Project Folder cannot be created.");
 166.172 +            return false;
 166.173 +        }
 166.174 +        
 166.175 +        if (FileUtil.toFileObject(projLoc) == null) {
 166.176 +            String message = "Project Folder is not a valid path.";
 166.177 +            wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
 166.178 +            return false;
 166.179 +        }
 166.180 +        
 166.181 +        File[] kids = destFolder.listFiles();
 166.182 +        if (destFolder.exists() && kids != null && kids.length > 0) {
 166.183 +            // Folder exists and is not empty
 166.184 +            wizardDescriptor.putProperty("WizardPanel_errorMessage",
 166.185 +                "Project Folder already exists and is not empty.");
 166.186 +            return false;
 166.187 +        }
 166.188 +        wizardDescriptor.putProperty("WizardPanel_errorMessage", "");
 166.189 +        return true;
 166.190 +    }
 166.191 +    
 166.192 +    void store(WizardDescriptor d) {
 166.193 +        String name = projectNameTextField.getText().trim();
 166.194 +        String folder = createdFolderTextField.getText().trim();
 166.195 +        
 166.196 +        d.putProperty("projdir", new File(folder));
 166.197 +        d.putProperty("name", name);
 166.198 +    }
 166.199 +    
 166.200 +    void read(WizardDescriptor settings) {
 166.201 +        File projectLocation = (File) settings.getProperty("projdir");
 166.202 +        if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
 166.203 +            projectLocation = ProjectChooser.getProjectsFolder();
 166.204 +        } else {
 166.205 +            projectLocation = projectLocation.getParentFile();
 166.206 +        }
 166.207 +        this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
 166.208 +        
 166.209 +        String projectName = (String) settings.getProperty("name");
 166.210 +        if(projectName == null) {
 166.211 +            projectName = "TestingTemplate";
 166.212 +        }
 166.213 +        this.projectNameTextField.setText(projectName);
 166.214 +        this.projectNameTextField.selectAll();
 166.215 +    }
 166.216 +    
 166.217 +    void validate(WizardDescriptor d) throws WizardValidationException {
 166.218 +        // nothing to validate
 166.219 +    }
 166.220 +    
 166.221 +    // Implementation of DocumentListener --------------------------------------
 166.222 +    
 166.223 +    public void changedUpdate(DocumentEvent e) {
 166.224 +        updateTexts(e);
 166.225 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
 166.226 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
 166.227 +        }
 166.228 +    }
 166.229 +    
 166.230 +    public void insertUpdate(DocumentEvent e) {
 166.231 +        updateTexts(e);
 166.232 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
 166.233 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
 166.234 +        }
 166.235 +    }
 166.236 +    
 166.237 +    public void removeUpdate(DocumentEvent e) {
 166.238 +        updateTexts(e);
 166.239 +        if (this.projectNameTextField.getDocument() == e.getDocument()) {
 166.240 +            firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
 166.241 +        }
 166.242 +    }
 166.243 +    
 166.244 +    /** Handles changes in the Project name and project directory, */
 166.245 +    private void updateTexts(DocumentEvent e) {
 166.246 +        
 166.247 +        Document doc = e.getDocument();
 166.248 +        
 166.249 +        if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) {
 166.250 +            // Change in the project name
 166.251 +            
 166.252 +            String projectName = projectNameTextField.getText();
 166.253 +            String projectFolder = projectLocationTextField.getText();
 166.254 +            
 166.255 +            //if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) {
 166.256 +            createdFolderTextField.setText(projectFolder + File.separatorChar + projectName);
 166.257 +            //}
 166.258 +            
 166.259 +        }
 166.260 +        panel.fireChangeEvent(); // Notify that the panel changed
 166.261 +    }
 166.262 +    
 166.263 +}
   167.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   167.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateWizardIterator.java	Sat Jun 14 09:52:45 2008 +0200
   167.3 @@ -0,0 +1,171 @@
   167.4 +package org.netbeans.apifest.testingtemplate;
   167.5 +
   167.6 +import java.awt.Component;
   167.7 +import java.io.File;
   167.8 +import java.io.IOException;
   167.9 +import java.io.InputStream;
  167.10 +import java.io.OutputStream;
  167.11 +import java.text.MessageFormat;
  167.12 +import java.util.Enumeration;
  167.13 +import java.util.LinkedHashSet;
  167.14 +import java.util.NoSuchElementException;
  167.15 +import java.util.Set;
  167.16 +import java.util.zip.ZipEntry;
  167.17 +import java.util.zip.ZipInputStream;
  167.18 +import javax.swing.JComponent;
  167.19 +import javax.swing.event.ChangeListener;
  167.20 +import org.netbeans.api.project.ProjectManager;
  167.21 +import org.netbeans.spi.project.ui.support.ProjectChooser;
  167.22 +import org.netbeans.spi.project.ui.templates.support.Templates;
  167.23 +import org.openide.WizardDescriptor;
  167.24 +import org.openide.filesystems.FileLock;
  167.25 +import org.openide.filesystems.FileObject;
  167.26 +import org.openide.filesystems.FileUtil;
  167.27 +import org.openide.util.NbBundle;
  167.28 +
  167.29 +public class TestingTemplateWizardIterator implements WizardDescriptor.InstantiatingIterator {
  167.30 +    
  167.31 +    private int index;
  167.32 +    private WizardDescriptor.Panel[] panels;
  167.33 +    private WizardDescriptor wiz;
  167.34 +    
  167.35 +    public TestingTemplateWizardIterator() {}
  167.36 +    
  167.37 +    public static TestingTemplateWizardIterator createIterator() {
  167.38 +        return new TestingTemplateWizardIterator();
  167.39 +    }
  167.40 +    
  167.41 +    private WizardDescriptor.Panel[] createPanels() {
  167.42 +        return new WizardDescriptor.Panel[] {
  167.43 +            new TestingTemplateWizardPanel(),
  167.44 +        };
  167.45 +    }
  167.46 +    
  167.47 +    private String[] createSteps() {
  167.48 +        return new String[] {
  167.49 +            NbBundle.getMessage(TestingTemplateWizardIterator.class, "LBL_CreateProjectStep")
  167.50 +        };
  167.51 +    }
  167.52 +    
  167.53 +    public Set/*<FileObject>*/ instantiate() throws IOException {
  167.54 +        Set resultSet = new LinkedHashSet();
  167.55 +        File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
  167.56 +        dirF.mkdirs();
  167.57 +        
  167.58 +        FileObject template = Templates.getTemplate(wiz);
  167.59 +        FileObject dir = FileUtil.toFileObject(dirF);
  167.60 +        unZipFile(template.getInputStream(), dir);
  167.61 +        
  167.62 +        // Always open top dir as a project:
  167.63 +        resultSet.add(dir);
  167.64 +        // Look for nested projects to open as well:
  167.65 +        Enumeration e = dir.getFolders(true);
  167.66 +        while (e.hasMoreElements()) {
  167.67 +            FileObject subfolder = (FileObject) e.nextElement();
  167.68 +            if (ProjectManager.getDefault().isProject(subfolder)) {
  167.69 +                resultSet.add(subfolder);
  167.70 +            }
  167.71 +        }
  167.72 +        
  167.73 +        File parent = dirF.getParentFile();
  167.74 +        if (parent != null && parent.exists()) {
  167.75 +            ProjectChooser.setProjectsFolder(parent);
  167.76 +        }
  167.77 +        
  167.78 +        return resultSet;
  167.79 +    }
  167.80 +    
  167.81 +    public void initialize(WizardDescriptor wiz) {
  167.82 +        this.wiz = wiz;
  167.83 +        index = 0;
  167.84 +        panels = createPanels();
  167.85 +        // Make sure list of steps is accurate.
  167.86 +        String[] steps = createSteps();
  167.87 +        for (int i = 0; i < panels.length; i++) {
  167.88 +            Component c = panels[i].getComponent();
  167.89 +            if (steps[i] == null) {
  167.90 +                // Default step name to component name of panel.
  167.91 +                // Mainly useful for getting the name of the target
  167.92 +                // chooser to appear in the list of steps.
  167.93 +                steps[i] = c.getName();
  167.94 +            }
  167.95 +            if (c instanceof JComponent) { // assume Swing components
  167.96 +                JComponent jc = (JComponent) c;
  167.97 +                // Step #.
  167.98 +                jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
  167.99 +                // Step name (actually the whole list for reference).
 167.100 +                jc.putClientProperty("WizardPanel_contentData", steps);
 167.101 +            }
 167.102 +        }
 167.103 +    }
 167.104 +    
 167.105 +    public void uninitialize(WizardDescriptor wiz) {
 167.106 +        this.wiz.putProperty("projdir",null);
 167.107 +        this.wiz.putProperty("name",null);
 167.108 +        this.wiz = null;
 167.109 +        panels = null;
 167.110 +    }
 167.111 +    
 167.112 +    public String name() {
 167.113 +        return MessageFormat.format("{0} of {1}",
 167.114 +            new Object[] {new Integer(index + 1), new Integer(panels.length)});
 167.115 +    }
 167.116 +    
 167.117 +    public boolean hasNext() {
 167.118 +        return index < panels.length - 1;
 167.119 +    }
 167.120 +    
 167.121 +    public boolean hasPrevious() {
 167.122 +        return index > 0;
 167.123 +    }
 167.124 +    
 167.125 +    public void nextPanel() {
 167.126 +        if (!hasNext()) {
 167.127 +            throw new NoSuchElementException();
 167.128 +        }
 167.129 +        index++;
 167.130 +    }
 167.131 +    
 167.132 +    public void previousPanel() {
 167.133 +        if (!hasPrevious()) {
 167.134 +            throw new NoSuchElementException();
 167.135 +        }
 167.136 +        index--;
 167.137 +    }
 167.138 +    
 167.139 +    public WizardDescriptor.Panel current() {
 167.140 +        return panels[index];
 167.141 +    }
 167.142 +    
 167.143 +    // If nothing unusual changes in the middle of the wizard, simply:
 167.144 +    public final void addChangeListener(ChangeListener l) {}
 167.145 +    public final void removeChangeListener(ChangeListener l) {}
 167.146 +    
 167.147 +    private static void unZipFile(InputStream source, FileObject projectRoot) throws IOException {
 167.148 +        try {
 167.149 +            ZipInputStream str = new ZipInputStream(source);
 167.150 +            ZipEntry entry;
 167.151 +            while ((entry = str.getNextEntry()) != null) {
 167.152 +                if (entry.isDirectory()) {
 167.153 +                    FileUtil.createFolder(projectRoot, entry.getName());
 167.154 +                } else {
 167.155 +                    FileObject fo = FileUtil.createData(projectRoot, entry.getName());
 167.156 +                    FileLock lock = fo.lock();
 167.157 +                    try {
 167.158 +                        OutputStream out = fo.getOutputStream(lock);
 167.159 +                        try {
 167.160 +                            FileUtil.copy(str, out);
 167.161 +                        } finally {
 167.162 +                            out.close();
 167.163 +                        }
 167.164 +                    } finally {
 167.165 +                        lock.releaseLock();
 167.166 +                    }
 167.167 +                }
 167.168 +            }
 167.169 +        } finally {
 167.170 +            source.close();
 167.171 +        }
 167.172 +    }
 167.173 +    
 167.174 +}
   168.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   168.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateWizardPanel.java	Sat Jun 14 09:52:45 2008 +0200
   168.3 @@ -0,0 +1,85 @@
   168.4 +package org.netbeans.apifest.testingtemplate;
   168.5 +
   168.6 +import java.awt.Component;
   168.7 +import java.util.HashSet;
   168.8 +import java.util.Iterator;
   168.9 +import java.util.Set;
  168.10 +import javax.swing.event.ChangeEvent;
  168.11 +import javax.swing.event.ChangeListener;
  168.12 +import org.openide.WizardDescriptor;
  168.13 +import org.openide.WizardValidationException;
  168.14 +import org.openide.util.HelpCtx;
  168.15 +import org.openide.util.NbBundle;
  168.16 +
  168.17 +/**
  168.18 + * Panel just asking for basic info.
  168.19 + */
  168.20 +public class TestingTemplateWizardPanel implements WizardDescriptor.Panel,
  168.21 +    WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel {
  168.22 +    
  168.23 +    private WizardDescriptor wizardDescriptor;
  168.24 +    private TestingTemplatePanelVisual component;
  168.25 +    
  168.26 +    /** Creates a new instance of templateWizardPanel */
  168.27 +    public TestingTemplateWizardPanel() {
  168.28 +    }
  168.29 +    
  168.30 +    public Component getComponent() {
  168.31 +        if (component == null) {
  168.32 +            component = new TestingTemplatePanelVisual(this);
  168.33 +            component.setName(NbBundle.getMessage(TestingTemplateWizardPanel.class, "LBL_CreateProjectStep"));
  168.34 +        }
  168.35 +        return component;
  168.36 +    }
  168.37 +    
  168.38 +    public HelpCtx getHelp() {
  168.39 +        return new HelpCtx(TestingTemplateWizardPanel.class);
  168.40 +    }
  168.41 +    
  168.42 +    public boolean isValid() {
  168.43 +        getComponent();
  168.44 +        return component.valid(wizardDescriptor);
  168.45 +    }
  168.46 +    
  168.47 +    private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
  168.48 +    public final void addChangeListener(ChangeListener l) {
  168.49 +        synchronized (listeners) {
  168.50 +            listeners.add(l);
  168.51 +        }
  168.52 +    }
  168.53 +    public final void removeChangeListener(ChangeListener l) {
  168.54 +        synchronized (listeners) {
  168.55 +            listeners.remove(l);
  168.56 +        }
  168.57 +    }
  168.58 +    protected final void fireChangeEvent() {
  168.59 +        Iterator it;
  168.60 +        synchronized (listeners) {
  168.61 +            it = new HashSet(listeners).iterator();
  168.62 +        }
  168.63 +        ChangeEvent ev = new ChangeEvent(this);
  168.64 +        while (it.hasNext()) {
  168.65 +            ((ChangeListener) it.next()).stateChanged(ev);
  168.66 +        }
  168.67 +    }
  168.68 +    
  168.69 +    public void readSettings(Object settings) {
  168.70 +        wizardDescriptor = (WizardDescriptor) settings;
  168.71 +        component.read(wizardDescriptor);
  168.72 +    }
  168.73 +    
  168.74 +    public void storeSettings(Object settings) {
  168.75 +        WizardDescriptor d = (WizardDescriptor) settings;
  168.76 +        component.store(d);
  168.77 +    }
  168.78 +    
  168.79 +    public boolean isFinishPanel() {
  168.80 +        return true;
  168.81 +    }
  168.82 +    
  168.83 +    public void validate() throws WizardValidationException {
  168.84 +        getComponent();
  168.85 +        component.validate(wizardDescriptor);
  168.86 +    }
  168.87 +    
  168.88 +}
   169.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   169.2 +++ b/samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/layer.xml	Sat Jun 14 09:52:45 2008 +0200
   169.3 @@ -0,0 +1,16 @@
   169.4 +<?xml version="1.0" encoding="UTF-8"?>
   169.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
   169.6 +<filesystem>
   169.7 +    <folder name="Templates">
   169.8 +        <folder name="Project">
   169.9 +            <folder name="APIFest">
  169.10 +                <file name="TestingTemplateProject.zip" url="TestingTemplateProject.zip">
  169.11 +                    <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.apifest.testingtemplate.Bundle"/>
  169.12 +                    <attr name="instantiatingIterator" methodvalue="org.netbeans.apifest.testingtemplate.TestingTemplateWizardIterator.createIterator"/>
  169.13 +                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/apifest/testingtemplate/TestingTemplateDescription.html"/>
  169.14 +                    <attr name="template" boolvalue="true"/>
  169.15 +                </file>
  169.16 +            </folder>
  169.17 +        </folder>
  169.18 +    </folder>
  169.19 +</filesystem>