Example demostrating how to use trait to provide effective implementation of linked list while keeping encapsulation
authorJaroslav Tulach <jtulach@netbeans.org>
Fri, 31 Aug 2012 20:16:57 +0200
changeset 402e25dbfce40e9
parent 401 a9097bdcf307
child 403 ebe08056c60c
Example demostrating how to use trait to provide effective implementation of linked list while keeping encapsulation
samples/effectivelist/build.xml
samples/effectivelist/nbproject/build-impl.xml
samples/effectivelist/nbproject/genfiles.properties
samples/effectivelist/nbproject/project.properties
samples/effectivelist/nbproject/project.xml
samples/effectivelist/src/org/apidesign/effectivelist/List.scala
samples/effectivelist/src/org/apidesign/effectivelist/Listable.scala
samples/effectivelist/test/org/apidesign/effectivelist/ListTest.scala
samples/libs/build.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/effectivelist/build.xml	Fri Aug 31 20:16:57 2012 +0200
     1.3 @@ -0,0 +1,74 @@
     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="Effective_List" default="default" basedir=".">
     1.9 +    <description>Builds, tests, and runs the project Effective List.</description>
    1.10 +    
    1.11 +    <ant dir="../libs" target="scala"/>
    1.12 +    <property name="scala.home" location="../libs/dist/scala-2.9.2"/>
    1.13 +    
    1.14 +    <import file="nbproject/build-impl.xml"/>
    1.15 +
    1.16 +    
    1.17 +    <!-- 
    1.18 +    There exist several targets which are by default empty and which can be 
    1.19 +    used for execution of your tasks. These targets are usually executed 
    1.20 +    before and after some main targets. They are: 
    1.21 +
    1.22 +      -pre-init:                 called before initialization of project properties
    1.23 +      -post-init:                called after initialization of project properties
    1.24 +      -pre-compile:              called before javac compilation
    1.25 +      -post-compile:             called after javac compilation
    1.26 +      -pre-compile-single:       called before javac compilation of single file
    1.27 +      -post-compile-single:      called after javac compilation of single file
    1.28 +      -pre-compile-test:         called before javac compilation of JUnit tests
    1.29 +      -post-compile-test:        called after javac compilation of JUnit tests
    1.30 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
    1.31 +      -post-compile-test-single: called after javac compilation of single JUunit test
    1.32 +      -pre-jar:                  called before JAR building
    1.33 +      -post-jar:                 called after JAR building
    1.34 +      -post-clean:               called after cleaning build products
    1.35 +
    1.36 +    (Targets beginning with '-' are not intended to be called on their own.)
    1.37 +
    1.38 +    Example of inserting an obfuscator after compilation could look like this:
    1.39 +
    1.40 +        <target name="-post-compile">
    1.41 +            <obfuscate>
    1.42 +                <fileset dir="${build.classes.dir}"/>
    1.43 +            </obfuscate>
    1.44 +        </target>
    1.45 +
    1.46 +    For list of available properties check the imported 
    1.47 +    nbproject/build-impl.xml file. 
    1.48 +
    1.49 +
    1.50 +    Another way to customize the build is by overriding existing main targets.
    1.51 +    The targets of interest are: 
    1.52 +
    1.53 +      -init-macrodef-javac:     defines macro for javac compilation
    1.54 +      -init-macrodef-junit:     defines macro for junit execution
    1.55 +      -init-macrodef-debug:     defines macro for class debugging
    1.56 +      -init-macrodef-java:      defines macro for class execution
    1.57 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    1.58 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    1.59 +      run:                      execution of project 
    1.60 +      -javadoc-build:           Javadoc generation
    1.61 +      test-report:              JUnit report generation
    1.62 +
    1.63 +    An example of overriding the target for project execution could look like this:
    1.64 +
    1.65 +        <target name="run" depends="Effective_List-impl.jar">
    1.66 +            <exec dir="bin" executable="launcher.exe">
    1.67 +                <arg file="${dist.jar}"/>
    1.68 +            </exec>
    1.69 +        </target>
    1.70 +
    1.71 +    Notice that the overridden target depends on the jar target and not only on 
    1.72 +    the compile target as the regular run target does. Again, for a list of available 
    1.73 +    properties which you can use, check the target you are overriding in the
    1.74 +    nbproject/build-impl.xml file. 
    1.75 +
    1.76 +    -->
    1.77 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/samples/effectivelist/nbproject/build-impl.xml	Fri Aug 31 20:16:57 2012 +0200
     2.3 @@ -0,0 +1,710 @@
     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 +        -->
    2.26 +<project xmlns:jaxrpc="http://www.netbeans.org/ns/scala-project/jax-rpc" xmlns:scalaProject1="http://www.netbeans.org/ns/scala-project/1" basedir=".." default="default" name="Effective_List-impl">
    2.27 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    2.28 +    <!--
    2.29 +                ======================
    2.30 +                INITIALIZATION SECTION
    2.31 +                ======================
    2.32 +            -->
    2.33 +    <target name="-pre-init">
    2.34 +        <!-- Empty placeholder for easier customization. -->
    2.35 +        <!-- You can override this target in the ../build.xml file. -->
    2.36 +    </target>
    2.37 +    <target depends="-pre-init" name="-init-private">
    2.38 +        <property file="nbproject/private/config.properties"/>
    2.39 +        <property file="nbproject/private/configs/${config}.properties"/>
    2.40 +        <property file="nbproject/private/private.properties"/>
    2.41 +        <property environment="env"/>
    2.42 +        <condition property="scala.home" value="${env.SCALA_HOME}">
    2.43 +            <isset property="env.SCALA_HOME"/>
    2.44 +        </condition>
    2.45 +        <fail unless="scala.home">
    2.46 +                    You must set SCALA_HOME or environment property and append "-J-Dscala.home=scalahomepath"
    2.47 +                    property to the end of "netbeans_default_options" in NetBeansInstallationPath/etc/netbeans.conf to point to
    2.48 +                    Scala installation directory.
    2.49 +                </fail>
    2.50 +        <property name="scala.compiler" value="${scala.home}/lib/scala-compiler.jar"/>
    2.51 +        <property name="scala.library" value="${scala.home}/lib/scala-library.jar"/>
    2.52 +        <property name="scala.lib" value="${scala.home}/lib"/>
    2.53 +        <taskdef resource="scala/tools/ant/antlib.xml">
    2.54 +            <classpath>
    2.55 +                <pathelement location="${scala.compiler}"/>
    2.56 +                <pathelement location="${scala.library}"/>
    2.57 +            </classpath>
    2.58 +        </taskdef>
    2.59 +    </target>
    2.60 +    <target depends="-pre-init,-init-private" name="-init-user">
    2.61 +        <property file="${user.properties.file}"/>
    2.62 +        <!-- The two properties below are usually overridden -->
    2.63 +        <!-- by the active platform. Just a fallback. -->
    2.64 +        <property name="default.javac.source" value="1.5"/>
    2.65 +        <property name="default.javac.target" value="1.5"/>
    2.66 +    </target>
    2.67 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    2.68 +        <property file="nbproject/configs/${config}.properties"/>
    2.69 +        <property file="nbproject/project.properties"/>
    2.70 +    </target>
    2.71 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    2.72 +        <available file="${manifest.file}" property="manifest.available"/>
    2.73 +        <condition property="manifest.available+main.class">
    2.74 +            <and>
    2.75 +                <isset property="manifest.available"/>
    2.76 +                <isset property="main.class"/>
    2.77 +                <not>
    2.78 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    2.79 +                </not>
    2.80 +            </and>
    2.81 +        </condition>
    2.82 +        <condition property="manifest.available+main.class+mkdist.available">
    2.83 +            <and>
    2.84 +                <istrue value="${manifest.available+main.class}"/>
    2.85 +                <isset property="libs.CopyLibs.classpath"/>
    2.86 +            </and>
    2.87 +        </condition>
    2.88 +        <condition property="have.tests">
    2.89 +            <or>
    2.90 +                <available file="${test.src.dir}"/>
    2.91 +            </or>
    2.92 +        </condition>
    2.93 +        <condition property="have.sources">
    2.94 +            <or>
    2.95 +                <available file="${src.dir}"/>
    2.96 +            </or>
    2.97 +        </condition>
    2.98 +        <condition property="netbeans.home+have.tests">
    2.99 +            <and>
   2.100 +                <isset property="netbeans.home"/>
   2.101 +                <isset property="have.tests"/>
   2.102 +            </and>
   2.103 +        </condition>
   2.104 +        <condition property="no.javadoc.preview">
   2.105 +            <and>
   2.106 +                <isset property="javadoc.preview"/>
   2.107 +                <isfalse value="${javadoc.preview}"/>
   2.108 +            </and>
   2.109 +        </condition>
   2.110 +        <property name="run.jvmargs" value=""/>
   2.111 +        <property name="javac.compilerargs" value=""/>
   2.112 +        <property name="work.dir" value="${basedir}"/>
   2.113 +        <condition property="no.deps">
   2.114 +            <and>
   2.115 +                <istrue value="${no.dependencies}"/>
   2.116 +            </and>
   2.117 +        </condition>
   2.118 +        <property name="javac.debug" value="true"/>
   2.119 +        <property name="javadoc.preview" value="true"/>
   2.120 +        <property name="application.args" value=""/>
   2.121 +        <property name="source.encoding" value="${file.encoding}"/>
   2.122 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   2.123 +            <and>
   2.124 +                <isset property="javadoc.encoding"/>
   2.125 +                <not>
   2.126 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   2.127 +                </not>
   2.128 +            </and>
   2.129 +        </condition>
   2.130 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   2.131 +        <property name="includes" value="**"/>
   2.132 +        <property name="excludes" value=""/>
   2.133 +        <property name="extdirs" value=" "/>
   2.134 +        <property name="do.depend" value="false"/>
   2.135 +        <condition property="do.depend.true">
   2.136 +            <istrue value="${do.depend}"/>
   2.137 +        </condition>
   2.138 +        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
   2.139 +            <and>
   2.140 +                <isset property="jaxws.endorsed.dir"/>
   2.141 +                <available file="nbproject/jaxws-build.xml"/>
   2.142 +            </and>
   2.143 +        </condition>
   2.144 +    </target>
   2.145 +    <target name="-post-init">
   2.146 +        <!-- Empty placeholder for easier customization. -->
   2.147 +        <!-- You can override this target in the ../build.xml file. -->
   2.148 +    </target>
   2.149 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   2.150 +        <fail unless="src.dir">Must set src.dir</fail>
   2.151 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   2.152 +        <fail unless="build.dir">Must set build.dir</fail>
   2.153 +        <fail unless="dist.dir">Must set dist.dir</fail>
   2.154 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   2.155 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   2.156 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   2.157 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   2.158 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   2.159 +        <fail unless="dist.jar">Must set dist.jar</fail>
   2.160 +    </target>
   2.161 +    <target name="-init-macrodef-property">
   2.162 +        <macrodef name="property" uri="http://www.netbeans.org/ns/scala-project/1">
   2.163 +            <attribute name="name"/>
   2.164 +            <attribute name="value"/>
   2.165 +            <sequential>
   2.166 +                <property name="@{name}" value="${@{value}}"/>
   2.167 +            </sequential>
   2.168 +        </macrodef>
   2.169 +    </target>
   2.170 +    <target name="-init-macrodef-javac">
   2.171 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/scala-project/1">
   2.172 +            <attribute default="${src.dir}" name="srcdir"/>
   2.173 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.174 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.175 +            <attribute default="${includes}" name="includes"/>
   2.176 +            <attribute default="${excludes}" name="excludes"/>
   2.177 +            <attribute default="${javac.debug}" name="debug"/>
   2.178 +            <attribute default="" name="sourcepath"/>
   2.179 +            <element name="customize" optional="true"/>
   2.180 +            <sequential>
   2.181 +                <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.182 +                    <classpath>
   2.183 +                        <path path="@{classpath}"/>
   2.184 +                        <fileset dir="${scala.lib}">
   2.185 +                            <include name="**/*.jar"/>
   2.186 +                        </fileset>
   2.187 +                    </classpath>
   2.188 +                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
   2.189 +                    <customize/>
   2.190 +                </javac>
   2.191 +            </sequential>
   2.192 +        </macrodef>
   2.193 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/scala-project/1">
   2.194 +            <attribute default="${src.dir}" name="srcdir"/>
   2.195 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.196 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.197 +            <sequential>
   2.198 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   2.199 +                    <classpath>
   2.200 +                        <path>
   2.201 +                            <pathelement path="@{classpath}"/>
   2.202 +                            <fileset dir="${scala.lib}">
   2.203 +                                <include name="**/*.jar"/>
   2.204 +                            </fileset>
   2.205 +                            <pathelement location="${build.classes.dir}"/>
   2.206 +                        </path>
   2.207 +                    </classpath>
   2.208 +                </depend>
   2.209 +            </sequential>
   2.210 +        </macrodef>
   2.211 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/scala-project/1">
   2.212 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.213 +            <sequential>
   2.214 +                <fail unless="javac.includes">Must set javac.includes</fail>
   2.215 +                <pathconvert pathsep="," property="javac.includes.binary">
   2.216 +                    <path>
   2.217 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   2.218 +                    </path>
   2.219 +                    <globmapper from="*.java" to="*.class"/>
   2.220 +                </pathconvert>
   2.221 +                <delete>
   2.222 +                    <files includes="${javac.includes.binary}"/>
   2.223 +                </delete>
   2.224 +            </sequential>
   2.225 +        </macrodef>
   2.226 +    </target>
   2.227 +    <target name="-init-macrodef-scalac">
   2.228 +        <macrodef name="scalac" uri="http://www.netbeans.org/ns/scala-project/1">
   2.229 +            <attribute default="${src.dir}" name="srcdir"/>
   2.230 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.231 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.232 +            <attribute default="${extdirs}" name="extdirs"/>
   2.233 +            <attribute default="${includes}" name="includes"/>
   2.234 +            <attribute default="${excludes}" name="excludes"/>
   2.235 +            <attribute default="${scalac.compilerargs}" name="addparams"/>
   2.236 +            <attribute default="" name="sourcepath"/>
   2.237 +            <element name="customize" optional="true"/>
   2.238 +            <sequential>
   2.239 +                <scalac addparams="-make:transitive -dependencyfile &quot;${basedir}/${build.dir}/.scala_dependencies&quot; @{addparams}" deprecation="${scalac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" extdirs="@{extdirs}" force="yes" fork="true" includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="jvm-${javac.target}" unchecked="${scalac.unchecked}">
   2.240 +                    <classpath>
   2.241 +                        <path>
   2.242 +                            <pathelement path="@{classpath}"/>
   2.243 +                            <fileset dir="${scala.lib}">
   2.244 +                                <include name="**/*.jar"/>
   2.245 +                            </fileset>
   2.246 +                            <pathelement location="${build.classes.dir}"/>
   2.247 +                        </path>
   2.248 +                    </classpath>
   2.249 +                    <customize/>
   2.250 +                </scalac>
   2.251 +            </sequential>
   2.252 +        </macrodef>
   2.253 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/scala-project/1">
   2.254 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.255 +            <sequential>
   2.256 +                <fail unless="javac.includes">Must set javac.includes</fail>
   2.257 +                <pathconvert pathsep="," property="javac.includes.binary">
   2.258 +                    <path>
   2.259 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   2.260 +                    </path>
   2.261 +                    <globmapper from="*.scala" to="*.class"/>
   2.262 +                </pathconvert>
   2.263 +                <delete>
   2.264 +                    <files includes="${javac.includes.binary}"/>
   2.265 +                </delete>
   2.266 +            </sequential>
   2.267 +        </macrodef>
   2.268 +    </target>
   2.269 +    <target name="-init-macrodef-junit">
   2.270 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/scala-project/1">
   2.271 +            <attribute default="${includes}" name="includes"/>
   2.272 +            <attribute default="${excludes}" name="excludes"/>
   2.273 +            <attribute default="**" name="testincludes"/>
   2.274 +            <sequential>
   2.275 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
   2.276 +                    <batchtest todir="${build.test.results.dir}">
   2.277 +                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   2.278 +                            <filename name="@{testincludes}"/>
   2.279 +                        </fileset>
   2.280 +                    </batchtest>
   2.281 +                    <classpath>
   2.282 +                        <path path="${run.test.classpath}"/>
   2.283 +                        <fileset dir="${scala.lib}">
   2.284 +                            <include name="**/*.jar"/>
   2.285 +                        </fileset>
   2.286 +                    </classpath>
   2.287 +                    <syspropertyset>
   2.288 +                        <propertyref prefix="test-sys-prop."/>
   2.289 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.290 +                    </syspropertyset>
   2.291 +                    <formatter type="brief" usefile="false"/>
   2.292 +                    <formatter type="xml"/>
   2.293 +                    <jvmarg line="${run.jvmargs}"/>
   2.294 +                </junit>
   2.295 +            </sequential>
   2.296 +        </macrodef>
   2.297 +    </target>
   2.298 +    <target name="-init-macrodef-nbjpda">
   2.299 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/scala-project/1">
   2.300 +            <attribute default="${main.class}" name="name"/>
   2.301 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.302 +            <attribute default="" name="stopclassname"/>
   2.303 +            <sequential>
   2.304 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
   2.305 +                    <classpath>
   2.306 +                        <path path="@{classpath}"/>
   2.307 +                    </classpath>
   2.308 +                </nbjpdastart>
   2.309 +            </sequential>
   2.310 +        </macrodef>
   2.311 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/scala-project/1">
   2.312 +            <attribute default="${build.classes.dir}" name="dir"/>
   2.313 +            <sequential>
   2.314 +                <nbjpdareload>
   2.315 +                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
   2.316 +                </nbjpdareload>
   2.317 +            </sequential>
   2.318 +        </macrodef>
   2.319 +    </target>
   2.320 +    <target name="-init-debug-args">
   2.321 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   2.322 +        <condition property="have-jdk-older-than-1.4">
   2.323 +            <or>
   2.324 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   2.325 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   2.326 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   2.327 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   2.328 +            </or>
   2.329 +        </condition>
   2.330 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   2.331 +            <istrue value="${have-jdk-older-than-1.4}"/>
   2.332 +        </condition>
   2.333 +    </target>
   2.334 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   2.335 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/scala-project/1">
   2.336 +            <attribute default="${main.class}" name="classname"/>
   2.337 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.338 +            <element name="customize" optional="true"/>
   2.339 +            <sequential>
   2.340 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.341 +                    <jvmarg line="${debug-args-line}"/>
   2.342 +                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
   2.343 +                    <jvmarg line="${run.jvmargs}"/>
   2.344 +                    <classpath>
   2.345 +                        <path path="@{classpath}"/>
   2.346 +                        <fileset dir="${scala.lib}">
   2.347 +                            <include name="**/*.jar"/>
   2.348 +                        </fileset>
   2.349 +                    </classpath>
   2.350 +                    <syspropertyset>
   2.351 +                        <propertyref prefix="run-sys-prop."/>
   2.352 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.353 +                    </syspropertyset>
   2.354 +                    <customize/>
   2.355 +                </java>
   2.356 +            </sequential>
   2.357 +        </macrodef>
   2.358 +    </target>
   2.359 +    <target name="-init-macrodef-java">
   2.360 +        <macrodef name="java" uri="http://www.netbeans.org/ns/scala-project/1">
   2.361 +            <attribute default="${main.class}" name="classname"/>
   2.362 +            <element name="customize" optional="true"/>
   2.363 +            <sequential>
   2.364 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.365 +                    <jvmarg line="${run.jvmargs}"/>
   2.366 +                    <classpath>
   2.367 +                        <path path="${run.classpath}"/>
   2.368 +                        <fileset dir="${scala.lib}">
   2.369 +                            <include name="**/*.jar"/>
   2.370 +                        </fileset>
   2.371 +                    </classpath>
   2.372 +                    <syspropertyset>
   2.373 +                        <propertyref prefix="run-sys-prop."/>
   2.374 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.375 +                    </syspropertyset>
   2.376 +                    <customize/>
   2.377 +                </java>
   2.378 +            </sequential>
   2.379 +        </macrodef>
   2.380 +    </target>
   2.381 +    <target name="-init-presetdef-jar">
   2.382 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/scala-project/1">
   2.383 +            <jar compress="${jar.compress}" jarfile="${dist.jar}">
   2.384 +                <scalaProject1:fileset dir="${build.classes.dir}"/>
   2.385 +            </jar>
   2.386 +        </presetdef>
   2.387 +    </target>
   2.388 +    <target depends="-pre-init,-init-private ,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-scalac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
   2.389 +    <!--
   2.390 +                ===================
   2.391 +                COMPILATION SECTION
   2.392 +                ===================
   2.393 +            -->
   2.394 +    <target depends="init" name="deps-jar" unless="no.deps"/>
   2.395 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   2.396 +        <mkdir dir="${build.classes.dir}"/>
   2.397 +    </target>
   2.398 +    <target name="-pre-compile">
   2.399 +        <!-- Empty placeholder for easier customization. -->
   2.400 +        <!-- You can override this target in the ../build.xml file. -->
   2.401 +    </target>
   2.402 +    <target if="do.depend.true" name="-compile-depend">
   2.403 +        <scalaProject1:depend/>
   2.404 +    </target>
   2.405 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
   2.406 +        <scalaProject1:scalac/>
   2.407 +        <scalaProject1:javac/>
   2.408 +        <copy todir="${build.classes.dir}">
   2.409 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}&#10;                        " includes="${includes}"/>
   2.410 +        </copy>
   2.411 +    </target>
   2.412 +    <target name="-post-compile">
   2.413 +        <!-- Empty placeholder for easier customization. -->
   2.414 +        <!-- You can override this target in the ../build.xml file. -->
   2.415 +    </target>
   2.416 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   2.417 +    <target name="-pre-compile-single">
   2.418 +        <!-- Empty placeholder for easier customization. -->
   2.419 +        <!-- You can override this target in the ../build.xml file. -->
   2.420 +    </target>
   2.421 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   2.422 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.423 +        <scalaProject1:force-recompile/>
   2.424 +        <scalaProject1:scalac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
   2.425 +    </target>
   2.426 +    <target name="-post-compile-single">
   2.427 +        <!-- Empty placeholder for easier customization. -->
   2.428 +        <!-- You can override this target in the ../build.xml file. -->
   2.429 +    </target>
   2.430 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   2.431 +    <!--
   2.432 +                ====================
   2.433 +                JAR BUILDING SECTION
   2.434 +                ====================
   2.435 +            -->
   2.436 +    <target depends="init" name="-pre-pre-jar">
   2.437 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   2.438 +        <mkdir dir="${dist.jar.dir}"/>
   2.439 +    </target>
   2.440 +    <target name="-pre-jar">
   2.441 +        <!-- Empty placeholder for easier customization. -->
   2.442 +        <!-- You can override this target in the ../build.xml file. -->
   2.443 +    </target>
   2.444 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
   2.445 +        <scalaProject1:jar/>
   2.446 +    </target>
   2.447 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   2.448 +        <scalaProject1:jar manifest="${manifest.file}"/>
   2.449 +    </target>
   2.450 +    <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.451 +        <scalaProject1:jar manifest="${manifest.file}">
   2.452 +            <scalaProject1:manifest>
   2.453 +                <scalaProject1:attribute name="Main-Class" value="${main.class}"/>
   2.454 +            </scalaProject1:manifest>
   2.455 +        </scalaProject1:jar>
   2.456 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.457 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.458 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.459 +        <pathconvert property="run.classpath.with.dist.jar">
   2.460 +            <path path="${run.classpath}"/>
   2.461 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   2.462 +        </pathconvert>
   2.463 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}
   2.464 +                </echo>
   2.465 +    </target>
   2.466 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
   2.467 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.468 +        <pathconvert property="run.classpath.without.build.classes.dir">
   2.469 +            <path path="${run.classpath}"/>
   2.470 +            <map from="${build.classes.dir.resolved}" to=""/>
   2.471 +        </pathconvert>
   2.472 +        <pathconvert pathsep=" " property="jar.classpath">
   2.473 +            <path path="${run.classpath.without.build.classes.dir}"/>
   2.474 +            <chainedmapper>
   2.475 +                <flattenmapper/>
   2.476 +                <globmapper from="*" to="lib/*"/>
   2.477 +            </chainedmapper>
   2.478 +        </pathconvert>
   2.479 +        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   2.480 +        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   2.481 +            <fileset dir="${build.classes.dir}"/>
   2.482 +            <manifest>
   2.483 +                <attribute name="Main-Class" value="${main.class}"/>
   2.484 +                <attribute name="Class-Path" value="${jar.classpath}"/>
   2.485 +            </manifest>
   2.486 +        </copylibs>
   2.487 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.488 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.489 +        <echo>java -jar "${dist.jar.resolved}"
   2.490 +                </echo>
   2.491 +    </target>
   2.492 +    <target name="-post-jar">
   2.493 +        <!-- Empty placeholder for easier customization. -->
   2.494 +        <!-- You can override this target in the ../build.xml file. -->
   2.495 +    </target>
   2.496 +    <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.497 +    <!--
   2.498 +                =================
   2.499 +                EXECUTION SECTION
   2.500 +                =================
   2.501 +            -->
   2.502 +    <target depends="init,compile" description="Run a main class." name="run">
   2.503 +        <scalaProject1:java>
   2.504 +            <customize>
   2.505 +                <arg line="${application.args}"/>
   2.506 +            </customize>
   2.507 +        </scalaProject1:java>
   2.508 +    </target>
   2.509 +    <target name="-do-not-recompile">
   2.510 +        <property name="javac.includes.binary" value=""/>
   2.511 +    </target>
   2.512 +    <target depends="init,-do-not-recompile,compile-single" name="run-single">
   2.513 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   2.514 +        <scalaProject1:java classname="${run.class}"/>
   2.515 +    </target>
   2.516 +    <!--
   2.517 +                =================
   2.518 +                DEBUGGING SECTION
   2.519 +                =================
   2.520 +            -->
   2.521 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   2.522 +        <scalaProject1:nbjpdastart name="${debug.class}"/>
   2.523 +    </target>
   2.524 +    <target depends="init,compile" name="-debug-start-debuggee">
   2.525 +        <scalaProject1:debug>
   2.526 +            <customize>
   2.527 +                <arg line="${application.args}"/>
   2.528 +            </customize>
   2.529 +        </scalaProject1:debug>
   2.530 +    </target>
   2.531 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   2.532 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   2.533 +        <scalaProject1:nbjpdastart stopclassname="${main.class}"/>
   2.534 +    </target>
   2.535 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   2.536 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   2.537 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   2.538 +        <scalaProject1:debug classname="${debug.class}"/>
   2.539 +    </target>
   2.540 +    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   2.541 +    <target depends="init" name="-pre-debug-fix">
   2.542 +        <fail unless="fix.includes">Must set fix.includes</fail>
   2.543 +        <property name="javac.includes" value="${fix.includes}.java"/>
   2.544 +    </target>
   2.545 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   2.546 +        <scalaProject1:nbjpdareload/>
   2.547 +    </target>
   2.548 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   2.549 +    <!--
   2.550 +                ===============
   2.551 +                JAVADOC SECTION
   2.552 +                ===============
   2.553 +            -->
   2.554 +    <target depends="init" name="-javadoc-build">
   2.555 +        <mkdir dir="${dist.javadoc.dir}"/>
   2.556 +        <scaladoc addparams="${javadoc.additionalparam}" deprecation="yes" destdir="${dist.javadoc.dir}" doctitle="${javadoc.windowtitle}" encoding="${javadoc.encoding.used}" srcdir="${src.dir}" unchecked="yes">
   2.557 +            <classpath>
   2.558 +                <path path="${javac.classpath}"/>
   2.559 +                <fileset dir="${scala.lib}">
   2.560 +                    <include name="**/*.jar"/>
   2.561 +                </fileset>
   2.562 +            </classpath>
   2.563 +        </scaladoc>
   2.564 +    </target>
   2.565 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   2.566 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   2.567 +    </target>
   2.568 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   2.569 +    <!--
   2.570 +                =========================
   2.571 +                JUNIT COMPILATION SECTION
   2.572 +                =========================
   2.573 +            -->
   2.574 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   2.575 +        <mkdir dir="${build.test.classes.dir}"/>
   2.576 +    </target>
   2.577 +    <target name="-pre-compile-test">
   2.578 +        <!-- Empty placeholder for easier customization. -->
   2.579 +        <!-- You can override this target in the ../build.xml file. -->
   2.580 +    </target>
   2.581 +    <target if="do.depend.true" name="-compile-test-depend">
   2.582 +        <scalaProject1:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.583 +    </target>
   2.584 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   2.585 +        <scalaProject1:scalac classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.586 +        <copy todir="${build.test.classes.dir}">
   2.587 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}&#10;                        " includes="${includes}"/>
   2.588 +        </copy>
   2.589 +    </target>
   2.590 +    <target name="-post-compile-test">
   2.591 +        <!-- Empty placeholder for easier customization. -->
   2.592 +        <!-- You can override this target in the ../build.xml file. -->
   2.593 +    </target>
   2.594 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   2.595 +    <target name="-pre-compile-test-single">
   2.596 +        <!-- Empty placeholder for easier customization. -->
   2.597 +        <!-- You can override this target in the ../build.xml file. -->
   2.598 +    </target>
   2.599 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   2.600 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.601 +        <scalaProject1:force-recompile destdir="${build.test.classes.dir}"/>
   2.602 +        <scalaProject1:scalac classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
   2.603 +        <copy todir="${build.test.classes.dir}">
   2.604 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}&#10;                        " includes="${includes}"/>
   2.605 +        </copy>
   2.606 +    </target>
   2.607 +    <target name="-post-compile-test-single">
   2.608 +        <!-- Empty placeholder for easier customization. -->
   2.609 +        <!-- You can override this target in the ../build.xml file. -->
   2.610 +    </target>
   2.611 +    <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.612 +    <!--
   2.613 +                =======================
   2.614 +                JUNIT EXECUTION SECTION
   2.615 +                =======================
   2.616 +            -->
   2.617 +    <target depends="init" if="have.tests" name="-pre-test-run">
   2.618 +        <mkdir dir="${build.test.results.dir}"/>
   2.619 +    </target>
   2.620 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   2.621 +        <scalaProject1:junit testincludes="**/*Test.class"/>
   2.622 +    </target>
   2.623 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   2.624 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.625 +    </target>
   2.626 +    <target depends="init" if="have.tests" name="test-report"/>
   2.627 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   2.628 +    <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.629 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   2.630 +        <mkdir dir="${build.test.results.dir}"/>
   2.631 +    </target>
   2.632 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   2.633 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   2.634 +        <scalaProject1:junit excludes="" includes="${test.includes}"/>
   2.635 +    </target>
   2.636 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   2.637 +        <fail if="tests.failed">Some tests failed; see details above.</fail>
   2.638 +    </target>
   2.639 +    <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.640 +    <!--
   2.641 +                =======================
   2.642 +                JUNIT DEBUGGING SECTION
   2.643 +                =======================
   2.644 +            -->
   2.645 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   2.646 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   2.647 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   2.648 +        <delete file="${test.report.file}"/>
   2.649 +        <mkdir dir="${build.test.results.dir}"/>
   2.650 +        <scalaProject1: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.651 +            <customize>
   2.652 +                <syspropertyset>
   2.653 +                    <propertyref prefix="test-sys-prop."/>
   2.654 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.655 +                </syspropertyset>
   2.656 +                <arg value="${test.class}"/>
   2.657 +                <arg value="showoutput=true"/>
   2.658 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   2.659 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   2.660 +            </customize>
   2.661 +        </scalaProject1:debug>
   2.662 +    </target>
   2.663 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   2.664 +        <scalaProject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   2.665 +    </target>
   2.666 +    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   2.667 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   2.668 +        <scalaProject1:nbjpdareload dir="${build.test.classes.dir}"/>
   2.669 +    </target>
   2.670 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   2.671 +    <!--
   2.672 +                =========================
   2.673 +                APPLET EXECUTION SECTION
   2.674 +                =========================
   2.675 +            -->
   2.676 +    <target depends="init,compile-single" name="run-applet">
   2.677 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.678 +        <scalaProject1:java classname="sun.applet.AppletViewer">
   2.679 +            <customize>
   2.680 +                <arg value="${applet.url}"/>
   2.681 +            </customize>
   2.682 +        </scalaProject1:java>
   2.683 +    </target>
   2.684 +    <!--
   2.685 +                =========================
   2.686 +                APPLET DEBUGGING  SECTION
   2.687 +                =========================
   2.688 +            -->
   2.689 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   2.690 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.691 +        <scalaProject1:debug classname="sun.applet.AppletViewer">
   2.692 +            <customize>
   2.693 +                <arg value="${applet.url}"/>
   2.694 +            </customize>
   2.695 +        </scalaProject1:debug>
   2.696 +    </target>
   2.697 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   2.698 +    <!--
   2.699 +                ===============
   2.700 +                CLEANUP SECTION
   2.701 +                ===============
   2.702 +            -->
   2.703 +    <target depends="init" name="deps-clean" unless="no.deps"/>
   2.704 +    <target depends="init" name="-do-clean">
   2.705 +        <delete dir="${build.dir}"/>
   2.706 +        <delete dir="${dist.dir}"/>
   2.707 +    </target>
   2.708 +    <target name="-post-clean">
   2.709 +        <!-- Empty placeholder for easier customization. -->
   2.710 +        <!-- You can override this target in the ../build.xml file. -->
   2.711 +    </target>
   2.712 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   2.713 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/samples/effectivelist/nbproject/genfiles.properties	Fri Aug 31 20:16:57 2012 +0200
     3.3 @@ -0,0 +1,8 @@
     3.4 +build.xml.data.CRC32=f1350d5d
     3.5 +build.xml.script.CRC32=037abbe8
     3.6 +build.xml.stylesheet.CRC32=ca9d572e@1.5
     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=f1350d5d
    3.10 +nbproject/build-impl.xml.script.CRC32=ff0a633f
    3.11 +nbproject/build-impl.xml.stylesheet.CRC32=5220179f@1.5
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/samples/effectivelist/nbproject/project.properties	Fri Aug 31 20:16:57 2012 +0200
     4.3 @@ -0,0 +1,62 @@
     4.4 +build.classes.dir=${build.dir}/classes
     4.5 +build.classes.excludes=**/*.java,**/*.form,**/*.scala
     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}/Effective_List.jar
    4.20 +dist.javadoc.dir=${dist.dir}/scaladoc
    4.21 +excludes=
    4.22 +includes=**
    4.23 +jar.compress=false
    4.24 +java.platform.active=java_default_platform
    4.25 +javac.classpath=
    4.26 +# Space-separated list of extra javac options
    4.27 +javac.compilerargs=
    4.28 +javac.deprecation=false
    4.29 +javac.source=1.5
    4.30 +javac.target=1.5
    4.31 +libs.junit_4.classpath=../libs/dist/junit-4.4.jar
    4.32 +javac.test.classpath=\
    4.33 +    ${javac.classpath}:\
    4.34 +    ${build.classes.dir}:\
    4.35 +    ${libs.junit_4.classpath}
    4.36 +javadoc.additionalparam=
    4.37 +javadoc.author=false
    4.38 +javadoc.encoding=${source.encoding}
    4.39 +javadoc.noindex=false
    4.40 +javadoc.nonavbar=false
    4.41 +javadoc.notree=false
    4.42 +javadoc.private=false
    4.43 +javadoc.splitindex=true
    4.44 +javadoc.use=true
    4.45 +javadoc.version=false
    4.46 +javadoc.windowtitle=
    4.47 +meta.inf.dir=${src.dir}/META-INF
    4.48 +platform.active=default_platform
    4.49 +run.classpath=\
    4.50 +    ${javac.classpath}:\
    4.51 +    ${build.classes.dir}
    4.52 +# Space-separated list of JVM arguments used when running the project
    4.53 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    4.54 +# or test-sys-prop.name=value to set system properties for unit tests):
    4.55 +run.jvmargs=
    4.56 +run.test.classpath=\
    4.57 +    ${javac.test.classpath}:\
    4.58 +    ${build.test.classes.dir}
    4.59 +# Space-separated list of extra scalac options
    4.60 +scalac.compilerargs=
    4.61 +scalac.deprecation=no
    4.62 +scalac.unchecked=no
    4.63 +source.encoding=UTF-8
    4.64 +src.dir=src
    4.65 +test.src.dir=test
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/samples/effectivelist/nbproject/project.xml	Fri Aug 31 20:16:57 2012 +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.scala.project</type>
     5.7 +    <configuration>
     5.8 +        <data xmlns="http://www.netbeans.org/ns/scala-project/1">
     5.9 +            <name>Effective List</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/effectivelist/src/org/apidesign/effectivelist/List.scala	Fri Aug 31 20:16:57 2012 +0200
     6.3 @@ -0,0 +1,74 @@
     6.4 +package org.apidesign.effectivelist
     6.5 +
     6.6 +/** 
     6.7 + * Implementation of add and remove efficient list. It has just one
     6.8 + * restriction - its items need to carry additional information to help
     6.9 + * the list to be effective. All items must extend trait {@link Listable}:
    6.10 + * <pre>
    6.11 + * <b>case class</b> Person(name : String) <b>extends</b> Listable[Person]
    6.12 + * </pre>
    6.13 + */
    6.14 +final class List[T <: Listable[T]] {
    6.15 +  private var item : T = _
    6.16 +  private final var EMPTY : T = _
    6.17 +  
    6.18 +  final def get(index : Int) : T = {
    6.19 +    var pos : T = item;
    6.20 +    for (i <- 1 to index) {
    6.21 +      pos = pos.next;
    6.22 +      if (pos == item) {
    6.23 +        throw new IndexOutOfBoundsException()
    6.24 +      }
    6.25 +    }
    6.26 +    return pos
    6.27 +  }
    6.28 +  
    6.29 +  final def size() : Int = {
    6.30 +    if (item == EMPTY) {
    6.31 +      return 0
    6.32 +    }
    6.33 +    var size = 0
    6.34 +    var pos : T = item
    6.35 +    do {
    6.36 +      size = size + 1
    6.37 +      pos = pos.next
    6.38 +    } while (pos != item)
    6.39 +    return size
    6.40 +  }
    6.41 +  
    6.42 +  final def add(toAdd : T) : Boolean = {
    6.43 +    if (toAdd.prev != EMPTY) {
    6.44 +      return false
    6.45 +    }
    6.46 +    
    6.47 +    if (item == null) {
    6.48 +      item = toAdd
    6.49 +      toAdd.next = toAdd
    6.50 +      toAdd.prev = toAdd
    6.51 +      return true
    6.52 +    } else {
    6.53 +      toAdd.prev = item.prev
    6.54 +      item.prev.next = toAdd
    6.55 +      item.prev = toAdd
    6.56 +      toAdd.next = item
    6.57 +      return true
    6.58 +    }
    6.59 +  }
    6.60 +  final def remove(toRemove : T) : Boolean = {
    6.61 +    if (toRemove.prev == EMPTY) {
    6.62 +      return false
    6.63 +    } else {
    6.64 +      toRemove.prev.next = toRemove.next
    6.65 +      toRemove.next.prev = toRemove.prev;
    6.66 +      if (item.next == item) {
    6.67 +        item = EMPTY
    6.68 +      }
    6.69 +      if (item == toRemove) {
    6.70 +        item = toRemove.next
    6.71 +      }
    6.72 +      toRemove.next = EMPTY
    6.73 +      toRemove.prev = EMPTY
    6.74 +      return true
    6.75 +    }
    6.76 +  }
    6.77 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/samples/effectivelist/src/org/apidesign/effectivelist/Listable.scala	Fri Aug 31 20:16:57 2012 +0200
     7.3 @@ -0,0 +1,9 @@
     7.4 +package org.apidesign.effectivelist
     7.5 +
     7.6 +/** A member of a {@link List} that makes keeping references
     7.7 + * to previous and next items in the list effective.
     7.8 + */
     7.9 +trait Listable[T <: Listable[T]] {
    7.10 +  private[effectivelist] var prev : T = _
    7.11 +  private[effectivelist] var next : T = _
    7.12 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/samples/effectivelist/test/org/apidesign/effectivelist/ListTest.scala	Fri Aug 31 20:16:57 2012 +0200
     8.3 @@ -0,0 +1,85 @@
     8.4 +package org.apidesign.effectivelist
     8.5 +
     8.6 +import org.junit._
     8.7 +import Assert._
     8.8 +
     8.9 +class ListTest {
    8.10 +  case class Person(name : String, age : Int) extends Listable[Person]
    8.11 +  
    8.12 +  var list : List[Person] = _
    8.13 +  var p1, p2, p3, p4 : Person = _
    8.14 +  
    8.15 +  @Before def initializeListAndValues: Unit = {
    8.16 +    list = new List[Person]
    8.17 +    p1 = new Person("Jarda", 39)
    8.18 +    p2 = new Person("Sona", 37)
    8.19 +    p3 = new Person("Anna", 7)
    8.20 +    p4 = new Person("Ondra", 6)
    8.21 +  }
    8.22 +
    8.23 +  @Test def tryFewAdditions = {
    8.24 +    assertTrue(list.add(p1))
    8.25 +    assertTrue(list.add(p2))
    8.26 +    assertTrue(list.add(p3))
    8.27 +    assertTrue(list.add(p4))
    8.28 +    
    8.29 +    assertEquals("Jarda was inserted first", "Jarda", list.get(0).name)
    8.30 +    assertEquals("Sona was inserted 2nd", 37, list.get(1).age)
    8.31 +    assertEquals("Anna was inserted 3rd", "Anna", list.get(2).name)
    8.32 +    assertEquals("Anna was inserted 4th", 6, list.get(3).age)
    8.33 +  }
    8.34 +
    8.35 +  @Test def addFewAndThenTryToRemoveHead() = {
    8.36 +    assertTrue(list.add(p1))
    8.37 +    assertTrue(list.add(p2))
    8.38 +    assertTrue(list.add(p3))
    8.39 +    
    8.40 +    assertEquals("Size it three", 3, list.size())
    8.41 +    assertEquals("Jarda was inserted first", "Jarda", list.get(0).name)
    8.42 +
    8.43 +    assertFalse("Can't remove not added element", list.remove(p4))
    8.44 +    assertTrue("OK to remove head", list.remove(p1))
    8.45 +    
    8.46 +    assertEquals("Sona is now first", "Sona", list.get(0).name)
    8.47 +    assertEquals("Anna is now 2nd", "Anna", list.get(1).name)
    8.48 +    
    8.49 +    try {
    8.50 +      list.get(2)
    8.51 +      fail("Previous call should throw exception")
    8.52 +    } catch {
    8.53 +      case e : IndexOutOfBoundsException => ; // OK
    8.54 +    }
    8.55 +  }
    8.56 +  
    8.57 +  @Test def addFewAndThenTryToRemoveSecond() = {
    8.58 +    assertEquals(0, list.size())
    8.59 +    assertTrue(list.add(p1))
    8.60 +    assertEquals(1, list.size())
    8.61 +    assertTrue(list.add(p2))
    8.62 +    assertEquals(2, list.size())
    8.63 +    assertTrue(list.add(p3))
    8.64 +    assertEquals(3, list.size())
    8.65 +    
    8.66 +    assertEquals("Size it three", 3, list.size())
    8.67 +    assertEquals("Jarda was inserted first", "Jarda", list.get(0).name)
    8.68 +
    8.69 +    assertFalse("Can't remove not added element", list.remove(p4))
    8.70 +    assertTrue("OK to remove head", list.remove(p2))
    8.71 +    
    8.72 +    assertEquals("Jarda is still first", "Jarda", list.get(0).name)
    8.73 +    assertEquals("Anna is now 2nd", "Anna", list.get(1).name)
    8.74 +    
    8.75 +    try {
    8.76 +      list.get(2);
    8.77 +      fail("Previous call should throw exception")
    8.78 +    } catch {
    8.79 +      case e : IndexOutOfBoundsException => ; // OK
    8.80 +    }
    8.81 +    assertEquals(2, list.size());
    8.82 +    
    8.83 +    list.remove(p1)
    8.84 +    list.remove(p3)
    8.85 +    
    8.86 +    assertEquals("Not it is empty", 0, list.size())
    8.87 +  }
    8.88 +}
     9.1 --- a/samples/libs/build.xml	Mon Aug 13 10:52:45 2012 +0200
     9.2 +++ b/samples/libs/build.xml	Fri Aug 31 20:16:57 2012 +0200
     9.3 @@ -1,6 +1,6 @@
     9.4  <?xml version="1.0" encoding="UTF-8"?>
     9.5 -<project name="Downloads necessary libraries" default="libraries" basedir=".">
     9.6 -       <target name="libraries" depends="autoupdate-task">
     9.7 +<project name="libraries" default="libraries" basedir=".">
     9.8 +       <target name="libraries" depends="scala,autoupdate-task">
     9.9          <antcall target="-library">
    9.10              <param name="library" value="junit-4.4"/>
    9.11              <param name="url" value="http://switch.dl.sourceforge.net/sourceforge/junit/junit-4.4.jar"/>
    9.12 @@ -42,6 +42,23 @@
    9.13              <param name="library.include" value="**/*commons*logg*.jar"/>
    9.14          </antcall>
    9.15      </target>
    9.16 +    
    9.17 +    <property name="scala.url" value="http://www.scala-lang.org/downloads/distrib/files/scala-2.9.2.tgz"/>
    9.18 +    <property name="scala.home" location="${ant.libraries.file}/../dist/scala-2.9.2"/>
    9.19 +    <available file="${scala.home}/bin/scalac" property="scala.available"/>
    9.20 +    <target name="scala" unless="scala.available">
    9.21 +        <mkdir dir="dist"/>
    9.22 +        <get dest="dist/scala.tgz" src="${scala.url}" skipexisting="true"/>
    9.23 +        <mkdir dir="${scala.home}"/>
    9.24 +        <untar compression="gzip" src="dist/scala.tgz" dest="${scala.home}/.."/>
    9.25 +        <fail message="Can't find ${scala.home}/bin/scalac">
    9.26 +            <condition>
    9.27 +                <not>
    9.28 +                    <available file="${scala.home}/bin/scalac"/>
    9.29 +                </not>
    9.30 +            </condition>
    9.31 +        </fail>
    9.32 +    </target>
    9.33  
    9.34      <available property="autoupdate.tasks.jar" file="dist/tasks.jar"/>
    9.35      <property name="bootstrap.url" value="http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar"/>