1.1 --- a/samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:55:24 2008 +0200
1.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:56:12 2008 +0200
1.3 @@ -19,7 +19,7 @@
1.4 - cleanup
1.5
1.6 -->
1.7 -<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">
1.8 +<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_-_day1-impl">
1.9 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
1.10 <!--
1.11 ======================
2.1 --- a/samples/apifest1/day1/inputandoperation/nbproject/genfiles.properties Sat Jun 14 09:55:24 2008 +0200
2.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/genfiles.properties Sat Jun 14 09:56:12 2008 +0200
2.3 @@ -1,5 +1,5 @@
2.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
2.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
2.6 -nbproject/build-impl.xml.data.CRC32=835ca895
2.7 -nbproject/build-impl.xml.script.CRC32=d896881b
2.8 +nbproject/build-impl.xml.data.CRC32=d3cc4b96
2.9 +nbproject/build-impl.xml.script.CRC32=4749e141
2.10 nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
3.1 --- a/samples/apifest1/day1/inputandoperation/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
3.2 +++ b/samples/apifest1/day1/inputandoperation/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
3.3 @@ -1,3 +1,5 @@
3.4 +application.title=inputandoperation - day1
3.5 +application.vendor=jarda
3.6 build.classes.dir=${build.dir}/classes
3.7 build.classes.excludes=**/*.java,**/*.form
3.8 # This directory is removed when the project is cleaned:
3.9 @@ -16,6 +18,7 @@
3.10 dist.jar=${dist.dir}/boolcircuit.jar
3.11 dist.javadoc.dir=${dist.dir}/javadoc
3.12 excludes=
3.13 +file.reference.junit-4.4.jar=../../../libs/dist/junit-4.4.jar
3.14 includes=**
3.15 jar.compress=false
3.16 javac.classpath=
3.17 @@ -27,7 +30,7 @@
3.18 javac.test.classpath=\
3.19 ${javac.classpath}:\
3.20 ${build.classes.dir}:\
3.21 - ${libs.junit.classpath}
3.22 + ${file.reference.junit-4.4.jar}
3.23 javadoc.additionalparam=
3.24 javadoc.author=false
3.25 javadoc.encoding=
3.26 @@ -39,9 +42,6 @@
3.27 javadoc.use=true
3.28 javadoc.version=false
3.29 javadoc.windowtitle=
3.30 -# Property libs.junit.classpath is set here just to make sharing of project simpler.
3.31 -# The library definition has always preference over this property.
3.32 -libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
3.33 meta.inf.dir=${src.dir}/META-INF
3.34 platform.active=default_platform
3.35 run.classpath=\
4.1 --- a/samples/apifest1/day1/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
4.2 +++ b/samples/apifest1/day1/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
4.3 @@ -19,13 +19,6 @@
4.4
4.5 package org.netbeans.apifest.boolcircuit;
4.6
4.7 -import java.security.CodeSource;
4.8 -import java.security.Permission;
4.9 -import java.security.PermissionCollection;
4.10 -import java.security.Policy;
4.11 -import java.util.Collection;
4.12 -import java.util.Collections;
4.13 -import java.util.Enumeration;
4.14 import junit.framework.TestCase;
4.15 import junit.framework.*;
4.16
4.17 @@ -91,11 +84,15 @@
4.18 inTrue = Factory.createSimpleBooleanInput(true);
4.19 inFalse = Factory.createSimpleBooleanInput(false);
4.20 Operation op1 = Factory.createAndOperation(inFalse, inTrue);
4.21 - Operation op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inFalse);
4.22 + Operation op2 = Factory.createOrOperation(
4.23 + Factory.createOperationBasedBooleanInput(op1), inFalse
4.24 + );
4.25 assertFalse(Circuit.evaluateBooleanOperation(op2));
4.26
4.27 op1 = Factory.createAndOperation(inFalse, inFalse);
4.28 - op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inTrue);
4.29 + op2 = Factory.createOrOperation(
4.30 + Factory.createOperationBasedBooleanInput(op1), inTrue
4.31 + );
4.32 assertTrue(Circuit.evaluateBooleanOperation(op2));
4.33 }
4.34 /**
4.35 @@ -106,10 +103,14 @@
4.36 inTrue = Factory.createSimpleBooleanInput(true);
4.37 inFalse = Factory.createSimpleBooleanInput(false);
4.38 Operation not = Factory.createNotOperation(inTrue);
4.39 - Operation or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inTrue);
4.40 + Operation or = Factory.createOrOperation(
4.41 + Factory.createOperationBasedBooleanInput(not), inTrue
4.42 + );
4.43 assertTrue(Circuit.evaluateBooleanOperation(or));
4.44 not = Factory.createNotOperation(inFalse);
4.45 - or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inFalse);
4.46 + or = Factory.createOrOperation(
4.47 + Factory.createOperationBasedBooleanInput(not), inFalse
4.48 + );
4.49 assertTrue(Circuit.evaluateBooleanOperation(or));
4.50 }
4.51 // END: apifest.day1.inputandoperation.CircuitTest
5.1 --- a/samples/apifest1/day1/parsingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:55:24 2008 +0200
5.2 +++ b/samples/apifest1/day1/parsingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:56:12 2008 +0200
5.3 @@ -36,19 +36,21 @@
5.4 * Input values are represented by x and number starting from 1 eg.: x1
5.5 * AND, NOT, OR and brackets '(',')' can be used.
5.6 * Example of valid expression: x1 AND x2
5.7 - * @return 0 when input expression is validated and parsed. Return nonzero value otherwise.
5.8 + * @return 0 when input expression is validated and parsed.
5.9 + * Return nonzero value otherwise.
5.10 */
5.11 public int parse(String expression) {
5.12 return 0;
5.13 }
5.14
5.15 /** Evaluate logical expression
5.16 - * @param array of boolean input values. Size of array must correspond to number
5.17 - * of variables used in expression
5.18 - * If size of array is bigger then only first N values are used to evaluate expression.
5.19 - * Remaining values are ignored.
5.20 + * @param array of boolean input values. Size of array must
5.21 + * correspond to number of variables used in expression
5.22 + * If size of array is bigger then only first N values are used
5.23 + * to evaluate expression. Remaining values are ignored.
5.24 * If size of array is smaller then IllegalArgumentException is thrown.
5.25 - * If no expression is set by method parse then IllegalStateException is thrown.
5.26 + * If no expression is set by method parse then
5.27 + * IllegalStateException is thrown.
5.28 */
5.29 public boolean evaluate(boolean [] x) {
5.30 return true;
6.1 --- a/samples/apifest1/day1/pinbasedsolution/build.xml Sat Jun 14 09:55:24 2008 +0200
6.2 +++ b/samples/apifest1/day1/pinbasedsolution/build.xml Sat Jun 14 09:56:12 2008 +0200
6.3 @@ -2,8 +2,8 @@
6.4 <!-- You may freely edit this file. See commented blocks below for -->
6.5 <!-- some examples of how to customize the build. -->
6.6 <!-- (If you delete it and reopen the project it will be recreated.) -->
6.7 -<project name="pinbasedsolution" default="default" basedir=".">
6.8 - <description>Builds, tests, and runs the project pinbasedsolution.</description>
6.9 +<project name="pinbasedsolution_-_day1" default="default" basedir=".">
6.10 + <description>Builds, tests, and runs the project pinbasedsolution - day1.</description>
6.11 <import file="nbproject/build-impl.xml"/>
6.12 <!--
6.13
6.14 @@ -54,7 +54,7 @@
6.15
6.16 An example of overriding the target for project execution could look like this:
6.17
6.18 - <target name="run" depends="pinbasedsolution-impl.jar">
6.19 + <target name="run" depends="pinbasedsolution_-_day1-impl.jar">
6.20 <exec dir="bin" executable="launcher.exe">
6.21 <arg file="${dist.jar}"/>
6.22 </exec>
7.1 --- a/samples/apifest1/day1/pinbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:55:24 2008 +0200
7.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:56:12 2008 +0200
7.3 @@ -19,7 +19,7 @@
7.4 - cleanup
7.5
7.6 -->
7.7 -<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">
7.8 +<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_-_day1-impl">
7.9 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
7.10 <!--
7.11 ======================
8.1 --- a/samples/apifest1/day1/pinbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:55:24 2008 +0200
8.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:56:12 2008 +0200
8.3 @@ -1,8 +1,8 @@
8.4 -build.xml.data.CRC32=c2d9be31
8.5 -build.xml.script.CRC32=09dc18c1
8.6 +build.xml.data.CRC32=ef095dd7
8.7 +build.xml.script.CRC32=5ff01653
8.8 build.xml.stylesheet.CRC32=be360661
8.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
8.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
8.11 -nbproject/build-impl.xml.data.CRC32=c2d9be31
8.12 -nbproject/build-impl.xml.script.CRC32=c591e2ef
8.13 +nbproject/build-impl.xml.data.CRC32=ef095dd7
8.14 +nbproject/build-impl.xml.script.CRC32=6e4480e5
8.15 nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
9.1 --- a/samples/apifest1/day1/pinbasedsolution/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
9.2 +++ b/samples/apifest1/day1/pinbasedsolution/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
9.3 @@ -1,3 +1,5 @@
9.4 +application.title=pinbasedsolution - day1
9.5 +application.vendor=jarda
9.6 build.classes.dir=${build.dir}/classes
9.7 build.classes.excludes=**/*.java,**/*.form
9.8 # This directory is removed when the project is cleaned:
9.9 @@ -16,6 +18,7 @@
9.10 dist.jar=${dist.dir}/boolcircuit.jar
9.11 dist.javadoc.dir=${dist.dir}/javadoc
9.12 excludes=
9.13 +file.reference.junit-4.4.jar=../../../libs/dist/junit-4.4.jar
9.14 includes=**
9.15 jar.compress=false
9.16 javac.classpath=
9.17 @@ -27,7 +30,7 @@
9.18 javac.test.classpath=\
9.19 ${javac.classpath}:\
9.20 ${build.classes.dir}:\
9.21 - ${libs.junit.classpath}
9.22 + ${file.reference.junit-4.4.jar}
9.23 javadoc.additionalparam=
9.24 javadoc.author=false
9.25 javadoc.encoding=
9.26 @@ -39,9 +42,6 @@
9.27 javadoc.use=true
9.28 javadoc.version=false
9.29 javadoc.windowtitle=
9.30 -# Property libs.junit.classpath is set here just to make sharing of project simpler.
9.31 -# The library definition has always preference over this property.
9.32 -libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
9.33 meta.inf.dir=${src.dir}/META-INF
9.34 platform.active=default_platform
9.35 run.classpath=\
10.1 --- a/samples/apifest1/day1/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
10.2 +++ b/samples/apifest1/day1/pinbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
10.3 @@ -19,13 +19,6 @@
10.4
10.5 package org.netbeans.apifest.boolcircuit;
10.6
10.7 -import java.security.CodeSource;
10.8 -import java.security.Permission;
10.9 -import java.security.PermissionCollection;
10.10 -import java.security.Policy;
10.11 -import java.util.Collection;
10.12 -import java.util.Collections;
10.13 -import java.util.Enumeration;
10.14 import junit.framework.TestCase;
10.15 import junit.framework.*;
10.16
10.17 @@ -65,13 +58,6 @@
10.18 super(testName);
10.19 }
10.20
10.21 - protected void setUp() throws Exception {
10.22 - }
10.23 -
10.24 - protected void tearDown() throws Exception {
10.25 - }
10.26 -
10.27 -
10.28 // BEGIN: apifest.day1.pinbasedsolution.CircuitTest
10.29 /**
10.30 * Create a circuit to evaluate x1 and x2 and then
10.31 @@ -106,8 +92,14 @@
10.32 )
10.33 );
10.34
10.35 - assertFalse ("(false AND true) OR false is false", c.evaluate(false, true, false));
10.36 - assertTrue ("(false AND false) OR true is true", c.evaluate(false, false, true));
10.37 + assertFalse (
10.38 + "(false AND true) OR false is false",
10.39 + c.evaluate(false, true, false)
10.40 + );
10.41 + assertTrue (
10.42 + "(false AND false) OR true is true",
10.43 + c.evaluate(false, false, true)
10.44 + );
10.45 }
10.46
10.47 /**
11.1 --- a/samples/apifest1/day1/stackbasedsolution/build.xml Sat Jun 14 09:55:24 2008 +0200
11.2 +++ b/samples/apifest1/day1/stackbasedsolution/build.xml Sat Jun 14 09:56:12 2008 +0200
11.3 @@ -2,8 +2,8 @@
11.4 <!-- You may freely edit this file. See commented blocks below for -->
11.5 <!-- some examples of how to customize the build. -->
11.6 <!-- (If you delete it and reopen the project it will be recreated.) -->
11.7 -<project name="stackbasedsolution" default="default" basedir=".">
11.8 - <description>Builds, tests, and runs the project stackbasedsolution.</description>
11.9 +<project name="stackbasedsolution_-_day1" default="default" basedir=".">
11.10 + <description>Builds, tests, and runs the project stackbasedsolution - day1.</description>
11.11 <import file="nbproject/build-impl.xml"/>
11.12 <!--
11.13
11.14 @@ -54,7 +54,7 @@
11.15
11.16 An example of overriding the target for project execution could look like this:
11.17
11.18 - <target name="run" depends="stackbasedsolution-impl.jar">
11.19 + <target name="run" depends="stackbasedsolution_-_day1-impl.jar">
11.20 <exec dir="bin" executable="launcher.exe">
11.21 <arg file="${dist.jar}"/>
11.22 </exec>
12.1 --- a/samples/apifest1/day1/stackbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:55:24 2008 +0200
12.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:56:12 2008 +0200
12.3 @@ -19,7 +19,7 @@
12.4 - cleanup
12.5
12.6 -->
12.7 -<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">
12.8 +<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_-_day1-impl">
12.9 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
12.10 <!--
12.11 ======================
13.1 --- a/samples/apifest1/day1/stackbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:55:24 2008 +0200
13.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:56:12 2008 +0200
13.3 @@ -1,8 +1,8 @@
13.4 -build.xml.data.CRC32=10562595
13.5 -build.xml.script.CRC32=8e100d5a
13.6 +build.xml.data.CRC32=94a71a7b
13.7 +build.xml.script.CRC32=91c577b8
13.8 build.xml.stylesheet.CRC32=be360661
13.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
13.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
13.11 -nbproject/build-impl.xml.data.CRC32=10562595
13.12 -nbproject/build-impl.xml.script.CRC32=4a74b13c
13.13 +nbproject/build-impl.xml.data.CRC32=94a71a7b
13.14 +nbproject/build-impl.xml.script.CRC32=2b7b0da6
13.15 nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
14.1 --- a/samples/apifest1/day1/stackbasedsolution/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
14.2 +++ b/samples/apifest1/day1/stackbasedsolution/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
14.3 @@ -1,3 +1,5 @@
14.4 +application.title=stackbasedsolution - day1
14.5 +application.vendor=jarda
14.6 build.classes.dir=${build.dir}/classes
14.7 build.classes.excludes=**/*.java,**/*.form
14.8 # This directory is removed when the project is cleaned:
14.9 @@ -16,6 +18,7 @@
14.10 dist.jar=${dist.dir}/boolcircuit.jar
14.11 dist.javadoc.dir=${dist.dir}/javadoc
14.12 excludes=
14.13 +file.reference.junit-4.4.jar=../../../libs/dist/junit-4.4.jar
14.14 includes=**
14.15 jar.compress=false
14.16 javac.classpath=
14.17 @@ -27,7 +30,7 @@
14.18 javac.test.classpath=\
14.19 ${javac.classpath}:\
14.20 ${build.classes.dir}:\
14.21 - ${libs.junit.classpath}
14.22 + ${file.reference.junit-4.4.jar}
14.23 javadoc.additionalparam=
14.24 javadoc.author=false
14.25 javadoc.encoding=
14.26 @@ -39,9 +42,6 @@
14.27 javadoc.use=true
14.28 javadoc.version=false
14.29 javadoc.windowtitle=
14.30 -# Property libs.junit.classpath is set here just to make sharing of project simpler.
14.31 -# The library definition has always preference over this property.
14.32 -libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
14.33 meta.inf.dir=${src.dir}/META-INF
14.34 platform.active=default_platform
14.35 run.classpath=\
15.1 --- a/samples/apifest1/day1/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
15.2 +++ b/samples/apifest1/day1/stackbasedsolution/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
15.3 @@ -74,9 +74,11 @@
15.4 public void testX1andX2() {
15.5 Stack<Character> s = new Stack<Character> ();
15.6 s.addAll(Arrays.asList('1', '1'));
15.7 - assertEquals("'1' for '11' input.", '1', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
15.8 + assertEquals("'1' for '11' input.", '1',
15.9 + CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
15.10 s.addAll(Arrays.asList('1', '0'));
15.11 - assertEquals("'0' for '10' input.", '0', CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
15.12 + assertEquals("'0' for '10' input.", '0',
15.13 + CircuitFactory.getBasicCircuit(Operation.AND).evaluate(s));
15.14 }
15.15
15.16 /**
15.17 @@ -87,16 +89,28 @@
15.18 public void testX1andX2orX3() {
15.19 Stack<Character> s = new Stack<Character> ();
15.20 s.addAll(Arrays.asList('0', '1', '0'));
15.21 - assertEquals("'0' for '010' input.", '0', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
15.22 + assertEquals("'0' for '010' input.", '0',
15.23 + CircuitFactory.join(CircuitFactory.getTrivialCircuit(),
15.24 + CircuitFactory.getBasicCircuit(Operation.OR),
15.25 + Operation.AND).evaluate(s)
15.26 + );
15.27 s.addAll(Arrays.asList('0', '0', '1'));
15.28 - assertEquals("'1' for '001' input.", '1', CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.OR), Operation.AND).evaluate(s));
15.29 + assertEquals("'1' for '001' input.", '1',
15.30 + CircuitFactory.join(CircuitFactory.getTrivialCircuit(),
15.31 + CircuitFactory.getBasicCircuit(Operation.OR),
15.32 + Operation.AND).evaluate(s)
15.33 + );
15.34 }
15.35 /**
15.36 * Create a circuit to evaluate (x1 or not(x1)) and then
15.37 * verify that its result is true for all values of x1.
15.38 */
15.39 public void testAlwaysTrue() {
15.40 - Circuit alwaysTrue = CircuitFactory.join(CircuitFactory.getTrivialCircuit(), CircuitFactory.getBasicCircuit(Operation.NEG), Operation.OR);
15.41 + Circuit alwaysTrue = CircuitFactory.join(
15.42 + CircuitFactory.getTrivialCircuit(),
15.43 + CircuitFactory.getBasicCircuit(Operation.NEG),
15.44 + Operation.OR
15.45 + );
15.46 Stack<Character> s = new Stack<Character> ();
15.47 s.addAll(Arrays.asList('0', '0'));
15.48 assertEquals ("'1' for '00'", '1', alwaysTrue.evaluate(s));
16.1 --- a/samples/apifest1/day1/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:55:24 2008 +0200
16.2 +++ b/samples/apifest1/day1/subclassingsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:56:12 2008 +0200
16.3 @@ -32,7 +32,9 @@
16.4 @Override
16.5 public boolean evaluate(boolean[] in) {
16.6 if ( in.length != 2) {
16.7 - throw new IllegalArgumentException( "Should have two parameters");
16.8 + throw new IllegalArgumentException(
16.9 + "Should have two parameters"
16.10 + );
16.11 }
16.12 return in[0] && in[1];
16.13 }
16.14 @@ -44,7 +46,9 @@
16.15 @Override
16.16 public boolean evaluate(boolean[] in) {
16.17 if ( in.length != 2) {
16.18 - throw new IllegalArgumentException( "Should have two parameters");
16.19 + throw new IllegalArgumentException(
16.20 + "Should have two parameters"
16.21 + );
16.22 }
16.23 return in[0] || in[1];
16.24 }
16.25 @@ -56,7 +60,9 @@
16.26 @Override
16.27 public boolean evaluate(boolean[] in) {
16.28 if ( in.length != 1) {
16.29 - throw new IllegalArgumentException( "Should have one parameter");
16.30 + throw new IllegalArgumentException(
16.31 + "Should have one parameter"
16.32 + );
16.33 }
16.34 return !in[0];
16.35 }
16.36 @@ -64,7 +70,8 @@
16.37 };
16.38
16.39
16.40 - /** Feel free to implement and don't hesitate to throw IllegalArgumentEception
16.41 + /** Feel free to implement and don't hesitate to throw
16.42 + * IllegalArgumentEception
16.43 */
16.44 public abstract boolean evaluate(boolean... in);
16.45
17.1 --- a/samples/apifest1/day2/RealTest.java Sat Jun 14 09:55:24 2008 +0200
17.2 +++ b/samples/apifest1/day2/RealTest.java Sat Jun 14 09:56:12 2008 +0200
17.3 @@ -1,37 +1,12 @@
17.4 -/*
17.5 - * The contents of this file are subject to the terms of the Common Development
17.6 - * and Distribution License (the License). You may not use this file except in
17.7 - * compliance with the License.
17.8 - *
17.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
17.10 - * or http://www.netbeans.org/cddl.txt.
17.11 - *
17.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
17.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
17.14 - * If applicable, add the following below the CDDL Header, with the fields
17.15 - * enclosed by brackets [] replaced by your own identifying information:
17.16 - * "Portions Copyrighted [year] [name of copyright owner]"
17.17 - *
17.18 - * The Original Software is NetBeans. The Initial Developer of the Original
17.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17.20 - * Microsystems, Inc. All Rights Reserved.
17.21 - */
17.22 -
17.23 package org.netbeans.apifest.boolcircuit;
17.24
17.25 -import java.security.CodeSource;
17.26 -import java.security.Permission;
17.27 -import java.security.PermissionCollection;
17.28 -import java.security.Policy;
17.29 -import java.util.Collection;
17.30 -import java.util.Collections;
17.31 -import java.util.Enumeration;
17.32 import junit.framework.TestCase;
17.33 import junit.framework.*;
17.34
17.35 // BEGIN: apitest.day2.RealTest
17.36 /** This file contains the APIFest quest for day 2. Simply, turn the
17.37 - * boolean circuit into circuit that can compute with double values from 0 to 1.
17.38 + * boolean circuit into circuit that can compute with double
17.39 + * values from 0 to 1.
17.40 * <p>
17.41 * This means that where ever a boolean was used to represent input or
17.42 * output values, one can now use any double number from >= 0 and <= 1.
17.43 @@ -39,21 +14,23 @@
17.44 * has to be kept available and have to work. In fact False shall be
17.45 * treated as 0 and True as 1.
17.46 * <p>
17.47 - * The basic elements has to be modified to work on doubles in the following
17.48 - * way:
17.49 + * The basic elements has to be modified to work on doubles
17.50 + * in the following way:
17.51 * <ul>
17.52 - * <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
17.53 - * <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
17.54 + * <li>negation - neg(x) = 1 - x, this is correct extension as
17.55 + * neg(false)=neg(0)=1-0=1=true
17.56 + * <li>and - and(x,y) = x * y, again this is fine as
17.57 + * and(true,true)=1*1=true and also
17.58 * and(false,true)=0*1=0=false
17.59 * <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
17.60 - * or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
17.61 - * or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
17.62 + * or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
17.63 + * or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
17.64 * </ul>
17.65 * <p>
17.66 - * However as the circuits with doubles are more rich than plain boolean circuits,
17.67 - * there is additional requirement to allow any user of your API to write its
17.68 - * own "element" type. This is all going to be exercise in the tests bellow
17.69 - * which you are supposed to implement.
17.70 + * However as the circuits with doubles are more rich than plain boolean
17.71 + * circuits, there is additional requirement to allow any user of your API
17.72 + * to write its own "element" type. This is all going to be exercise in
17.73 + * the tests bellow which you are supposed to implement.
17.74 */
17.75 public class RealTest extends TestCase {
17.76 static {
17.77 @@ -77,7 +54,8 @@
17.78 *
17.79 * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
17.80 *
17.81 - * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
17.82 + * Feed the same circuit with x1=0.0, x2=2.0, make sure it
17.83 + * throws an exception
17.84 */
17.85 public void testX1andX2orNotX1() {
17.86 fail("testX1andX2orNotX1");
17.87 @@ -94,7 +72,8 @@
17.88 fail("testImproperUseOfTheCircuit");
17.89 }
17.90
17.91 - /** Write your own element type called "gte" that will have two inputs and one output.
17.92 + /** Write your own element type called "gte" that will have two
17.93 + * inputs and one output.
17.94 * The output value will be 1 if x1 >= x2 and 0 otherwise.
17.95 *
17.96 * Create
18.1 --- a/samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:55:24 2008 +0200
18.2 +++ b/samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java Sat Jun 14 09:56:12 2008 +0200
18.3 @@ -1,22 +1,3 @@
18.4 -/*
18.5 - * The contents of this file are subject to the terms of the Common Development
18.6 - * and Distribution License (the License). You may not use this file except in
18.7 - * compliance with the License.
18.8 - *
18.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
18.10 - * or http://www.netbeans.org/cddl.txt.
18.11 - *
18.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
18.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
18.14 - * If applicable, add the following below the CDDL Header, with the fields
18.15 - * enclosed by brackets [] replaced by your own identifying information:
18.16 - * "Portions Copyrighted [year] [name of copyright owner]"
18.17 - *
18.18 - * The Original Software is NetBeans. The Initial Developer of the Original
18.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
18.20 - * Microsystems, Inc. All Rights Reserved.
18.21 - */
18.22 -
18.23 package org.netbeans.apifest.boolcircuit;
18.24
18.25 // BEGIN: apifest.day2.elementbasedsolution.Circuit
18.26 @@ -40,7 +21,8 @@
18.27 return e1.result() || e2.result();
18.28 }
18.29 public double doubleResult() {
18.30 - return 1.0 - (1.0 - e1.doubleResult()) * (1.0 - e2.doubleResult());
18.31 + return 1.0 -
18.32 + (1.0 - e1.doubleResult()) * (1.0 - e2.doubleResult());
18.33 }
18.34 };
18.35 }
18.36 @@ -56,7 +38,9 @@
18.37 };
18.38 }
18.39
18.40 - public static Element operation(final Operation op, final Element... elements) {
18.41 + public static Element operation(
18.42 + final Operation op, final Element... elements
18.43 + ) {
18.44 return new Element() {
18.45 public boolean result() {
18.46 return doubleResult() >= 1.0;
18.47 @@ -99,11 +83,13 @@
18.48 }
18.49
18.50 public boolean result() {
18.51 - return booleanValue != null ? booleanValue : doubleValue >= 1.0;
18.52 + return booleanValue != null ?
18.53 + booleanValue : doubleValue >= 1.0;
18.54 }
18.55
18.56 public double doubleResult() {
18.57 - return doubleValue != null ? doubleValue : (booleanValue ? 1.0 : 0.0);
18.58 + return doubleValue != null ?
18.59 + doubleValue : (booleanValue ? 1.0 : 0.0);
18.60 }
18.61
18.62 }
19.1 --- a/samples/apifest1/day2/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:55:24 2008 +0200
19.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:56:12 2008 +0200
19.3 @@ -19,7 +19,7 @@
19.4 - cleanup
19.5
19.6 -->
19.7 -<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">
19.8 +<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_-_day2-impl">
19.9 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
19.10 <!--
19.11 ======================
20.1 --- a/samples/apifest1/day2/inputandoperation/nbproject/genfiles.properties Sat Jun 14 09:55:24 2008 +0200
20.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/genfiles.properties Sat Jun 14 09:56:12 2008 +0200
20.3 @@ -1,5 +1,5 @@
20.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
20.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
20.6 -nbproject/build-impl.xml.data.CRC32=835ca895
20.7 -nbproject/build-impl.xml.script.CRC32=d896881b
20.8 +nbproject/build-impl.xml.data.CRC32=6bec2ae2
20.9 +nbproject/build-impl.xml.script.CRC32=8728834f
20.10 nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
21.1 --- a/samples/apifest1/day2/inputandoperation/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
21.2 +++ b/samples/apifest1/day2/inputandoperation/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
21.3 @@ -1,3 +1,5 @@
21.4 +application.title=inputandoperation - day2
21.5 +application.vendor=jarda
21.6 build.classes.dir=${build.dir}/classes
21.7 build.classes.excludes=**/*.java,**/*.form
21.8 # This directory is removed when the project is cleaned:
21.9 @@ -16,6 +18,7 @@
21.10 dist.jar=${dist.dir}/boolcircuit.jar
21.11 dist.javadoc.dir=${dist.dir}/javadoc
21.12 excludes=
21.13 +file.reference.junit-4.4.jar=../../../libs/dist/junit-4.4.jar
21.14 includes=**
21.15 jar.compress=false
21.16 javac.classpath=
21.17 @@ -27,7 +30,7 @@
21.18 javac.test.classpath=\
21.19 ${javac.classpath}:\
21.20 ${build.classes.dir}:\
21.21 - ${libs.junit.classpath}
21.22 + ${file.reference.junit-4.4.jar}
21.23 javadoc.additionalparam=
21.24 javadoc.author=false
21.25 javadoc.encoding=
21.26 @@ -39,9 +42,6 @@
21.27 javadoc.use=true
21.28 javadoc.version=false
21.29 javadoc.windowtitle=
21.30 -# Property libs.junit.classpath is set here just to make sharing of project simpler.
21.31 -# The library definition has always preference over this property.
21.32 -libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
21.33 meta.inf.dir=${src.dir}/META-INF
21.34 platform.active=default_platform
21.35 run.classpath=\
22.1 --- a/samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
22.2 +++ b/samples/apifest1/day2/inputandoperation/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
22.3 @@ -19,13 +19,6 @@
22.4
22.5 package org.netbeans.apifest.boolcircuit;
22.6
22.7 -import java.security.CodeSource;
22.8 -import java.security.Permission;
22.9 -import java.security.PermissionCollection;
22.10 -import java.security.Policy;
22.11 -import java.util.Collection;
22.12 -import java.util.Collections;
22.13 -import java.util.Enumeration;
22.14 import junit.framework.TestCase;
22.15 import junit.framework.*;
22.16
22.17 @@ -91,11 +84,15 @@
22.18 inTrue = Factory.createSimpleBooleanInput(true);
22.19 inFalse = Factory.createSimpleBooleanInput(false);
22.20 Operation op1 = Factory.createAndOperation(inFalse, inTrue);
22.21 - Operation op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inFalse);
22.22 + Operation op2 = Factory.createOrOperation(
22.23 + Factory.createOperationBasedBooleanInput(op1), inFalse
22.24 + );
22.25 assertFalse(Circuit.evaluateBooleanOperation(op2));
22.26
22.27 op1 = Factory.createAndOperation(inFalse, inFalse);
22.28 - op2 = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(op1), inTrue);
22.29 + op2 = Factory.createOrOperation(
22.30 + Factory.createOperationBasedBooleanInput(op1), inTrue
22.31 + );
22.32 assertTrue(Circuit.evaluateBooleanOperation(op2));
22.33 }
22.34 /**
22.35 @@ -106,10 +103,14 @@
22.36 inTrue = Factory.createSimpleBooleanInput(true);
22.37 inFalse = Factory.createSimpleBooleanInput(false);
22.38 Operation not = Factory.createNotOperation(inTrue);
22.39 - Operation or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inTrue);
22.40 + Operation or = Factory.createOrOperation(
22.41 + Factory.createOperationBasedBooleanInput(not), inTrue
22.42 + );
22.43 assertTrue(Circuit.evaluateBooleanOperation(or));
22.44 not = Factory.createNotOperation(inFalse);
22.45 - or = Factory.createOrOperation(Factory.createOperationBasedBooleanInput(not), inFalse);
22.46 + or = Factory.createOrOperation(
22.47 + Factory.createOperationBasedBooleanInput(not), inFalse
22.48 + );
22.49 assertTrue(Circuit.evaluateBooleanOperation(or));
22.50 }
22.51
23.1 --- a/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java Sat Jun 14 09:55:24 2008 +0200
23.2 +++ b/samples/apifest1/day2/pinbasedsolution/src/org/netbeans/apifest/boolcircuit/Element.java Sat Jun 14 09:56:12 2008 +0200
23.3 @@ -1,22 +1,14 @@
23.4 -/*
23.5 - * Element.java
23.6 - *
23.7 - * Created on 12. červenec 2006, 14:14
23.8 - *
23.9 - * To change this template, choose Tools | Template Manager
23.10 - * and open the template in the editor.
23.11 - */
23.12 -
23.13 package org.netbeans.apifest.boolcircuit;
23.14
23.15 /**
23.16 * Representation of an element in the circuit.
23.17 - * The internal behaviour of the element is opaque to the API user, it can only
23.18 - * be used as a building block for logical equations, using primitive operation
23.19 - * factories and a factory for input pin representation.
23.20 - * Elements are chained to create the logical net. The inputs to the net are
23.21 - * represented by the elements created by {@link #createInput(boolean[])}
23.22 - * factory method.
23.23 + * The internal behaviour of the element is opaque to the API user,
23.24 + * it can only be used as a building block for logical equations,
23.25 + * using primitive operation factories and a factory for input
23.26 + * pin representation.
23.27 + * Elements are chained to create the logical net.
23.28 + * The inputs to the net are represented by the elements created
23.29 + * by {@link #createInput(boolean[])} factory method.
23.30 */
23.31 public abstract class Element {
23.32
23.33 @@ -34,7 +26,9 @@
23.34 * Creates an Element representing 2-input AND function.
23.35 *
23.36 */
23.37 - public static Element createAnd(final Element source1, final Element source2) {
23.38 + public static Element createAnd(
23.39 + final Element source1, final Element source2
23.40 + ) {
23.41 return new Element() {
23.42 double evaluate(double[] inputs) {
23.43 return source1.evaluate(inputs) * source2.evaluate(inputs);
23.44 @@ -50,7 +44,9 @@
23.45 * Creates an Element representing 2-input OR function.
23.46 *
23.47 */
23.48 - public static Element createOr(final Element source1, final Element source2) {
23.49 + public static Element createOr(
23.50 + final Element source1, final Element source2
23.51 + ) {
23.52 return new Element() {
23.53 double evaluate(double[] inputs) {
23.54 double x = source1.evaluate(inputs);
23.55 @@ -100,13 +96,17 @@
23.56 /**
23.57 * Creates an Element with user-defined transfer function.
23.58 */
23.59 - public static Element createGate(final Element source1, final Element source2, final Function function) {
23.60 + public static Element createGate(
23.61 + final Element source1, final Element source2, final Function function
23.62 + ) {
23.63 return new Element() {
23.64 double evaluate(double[] inputs) {
23.65 double x = source1.evaluate(inputs);
23.66 double y = source2.evaluate(inputs);
23.67 double result = function.evaluate(x, y);
23.68 - if (result < 0.0 || result > 1.0) throw new InternalError("Illegal gate function");
23.69 + if (result < 0.0 || result > 1.0) {
23.70 + throw new InternalError("Illegal gate function");
23.71 + }
23.72 return result;
23.73 }
23.74
24.1 --- a/samples/apifest1/day2/welltestedsolution/build.xml Sat Jun 14 09:55:24 2008 +0200
24.2 +++ b/samples/apifest1/day2/welltestedsolution/build.xml Sat Jun 14 09:56:12 2008 +0200
24.3 @@ -2,8 +2,8 @@
24.4 <!-- You may freely edit this file. See commented blocks below for -->
24.5 <!-- some examples of how to customize the build. -->
24.6 <!-- (If you delete it and reopen the project it will be recreated.) -->
24.7 -<project name="welltestedsolution" default="default" basedir=".">
24.8 - <description>Builds, tests, and runs the project welltestedsolution.</description>
24.9 +<project name="welltestedsolution_-_day2" default="default" basedir=".">
24.10 + <description>Builds, tests, and runs the project welltestedsolution - day2.</description>
24.11 <import file="nbproject/build-impl.xml"/>
24.12 <!--
24.13
24.14 @@ -54,7 +54,7 @@
24.15
24.16 An example of overriding the target for project execution could look like this:
24.17
24.18 - <target name="run" depends="welltestedsolution-impl.jar">
24.19 + <target name="run" depends="welltestedsolution_-_day2-impl.jar">
24.20 <exec dir="bin" executable="launcher.exe">
24.21 <arg file="${dist.jar}"/>
24.22 </exec>
25.1 --- a/samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml Sat Jun 14 09:55:24 2008 +0200
25.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml Sat Jun 14 09:56:12 2008 +0200
25.3 @@ -19,7 +19,7 @@
25.4 - cleanup
25.5
25.6 -->
25.7 -<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="welltestedsolution-impl">
25.8 +<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="welltestedsolution_-_day2-impl">
25.9 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
25.10 <!--
25.11 ======================
26.1 --- a/samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties Sat Jun 14 09:55:24 2008 +0200
26.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties Sat Jun 14 09:56:12 2008 +0200
26.3 @@ -1,8 +1,8 @@
26.4 -build.xml.data.CRC32=3022b908
26.5 -build.xml.script.CRC32=fdb77cae
26.6 +build.xml.data.CRC32=645c53fa
26.7 +build.xml.script.CRC32=747792f9
26.8 build.xml.stylesheet.CRC32=be360661
26.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
26.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
26.11 -nbproject/build-impl.xml.data.CRC32=3022b908
26.12 -nbproject/build-impl.xml.script.CRC32=8c67cdf0
26.13 +nbproject/build-impl.xml.data.CRC32=645c53fa
26.14 +nbproject/build-impl.xml.script.CRC32=e8210b65
26.15 nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08
27.1 --- a/samples/apifest1/day2/welltestedsolution/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
27.2 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
27.3 @@ -1,3 +1,5 @@
27.4 +application.title=welltestedsolution - day2
27.5 +application.vendor=jarda
27.6 build.classes.dir=${build.dir}/classes
27.7 build.classes.excludes=**/*.java,**/*.form
27.8 # This directory is removed when the project is cleaned:
27.9 @@ -16,6 +18,7 @@
27.10 dist.jar=${dist.dir}/boolcircuit.jar
27.11 dist.javadoc.dir=${dist.dir}/javadoc
27.12 excludes=
27.13 +file.reference.junit-4.4.jar=../../../libs/dist/junit-4.4.jar
27.14 includes=**
27.15 jar.compress=false
27.16 javac.classpath=
27.17 @@ -27,7 +30,7 @@
27.18 javac.test.classpath=\
27.19 ${javac.classpath}:\
27.20 ${build.classes.dir}:\
27.21 - ${libs.junit.classpath}
27.22 + ${file.reference.junit-4.4.jar}
27.23 javadoc.additionalparam=
27.24 javadoc.author=false
27.25 javadoc.encoding=
27.26 @@ -39,9 +42,6 @@
27.27 javadoc.use=true
27.28 javadoc.version=false
27.29 javadoc.windowtitle=
27.30 -# Property libs.junit.classpath is set here just to make sharing of project simpler.
27.31 -# The library definition has always preference over this property.
27.32 -libs.junit.classpath=../../../../../usr/local/lib/netbeans/ide8/modules/ext/junit-3.8.2.jar
27.33 meta.inf.dir=${src.dir}/META-INF
27.34 platform.active=default_platform
27.35 run.classpath=\
28.1 --- a/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java Sat Jun 14 09:55:24 2008 +0200
28.2 +++ b/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java Sat Jun 14 09:56:12 2008 +0200
28.3 @@ -1,37 +1,12 @@
28.4 -/*
28.5 - * The contents of this file are subject to the terms of the Common Development
28.6 - * and Distribution License (the License). You may not use this file except in
28.7 - * compliance with the License.
28.8 - *
28.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
28.10 - * or http://www.netbeans.org/cddl.txt.
28.11 - *
28.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
28.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
28.14 - * If applicable, add the following below the CDDL Header, with the fields
28.15 - * enclosed by brackets [] replaced by your own identifying information:
28.16 - * "Portions Copyrighted [year] [name of copyright owner]"
28.17 - *
28.18 - * The Original Software is NetBeans. The Initial Developer of the Original
28.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28.20 - * Microsystems, Inc. All Rights Reserved.
28.21 - */
28.22 -
28.23 package org.netbeans.apifest.boolcircuit;
28.24
28.25 -import java.security.CodeSource;
28.26 -import java.security.Permission;
28.27 -import java.security.PermissionCollection;
28.28 -import java.security.Policy;
28.29 -import java.util.Collection;
28.30 -import java.util.Collections;
28.31 -import java.util.Enumeration;
28.32 import junit.framework.TestCase;
28.33 import junit.framework.*;
28.34 import org.netbeans.apifest.custom.Gte;
28.35
28.36 /** This file contains the APIFest quest for day 2. Simply, turn the
28.37 - * boolean circuit into circuit that can compute with double values from 0 to 1.
28.38 + * boolean circuit into circuit that can compute with double
28.39 + * values from 0 to 1.
28.40 * <p>
28.41 * This means that where ever a boolean was used to represent input or
28.42 * output values, one can now use any double number from >= 0 and <= 1.
28.43 @@ -42,17 +17,15 @@
28.44 * The basic elements has to be modified to work on doubles in the following
28.45 * way:
28.46 * <ul>
28.47 - * <li>negation - neg(x) = 1 - x, this is correct extension as neg(false)=neg(0)=1-0=1=true
28.48 - * <li>and - and(x,y) = x * y, again this is fine as and(true,true)=1*1=true and also
28.49 - * and(false,true)=0*1=0=false
28.50 - * <li>or - or(x,y) = 1 - (1 - x) * (1 - y) and this is also ok as
28.51 - * or(false,false) = 1 - (1 - 0) * (1 - 0) = 1 - 1 = 0 = false
28.52 - * or(true,false) = 1 - (1 - 1) * (1 - 0) = 1 - 0 * 1 = 1 = true
28.53 + * <li>negation - neg(x) = 1 - x
28.54 + * <li>and - and(x,y) = x * y
28.55 + * <li>or - or(x,y) = 1 - (1 - x) * (1 - y)
28.56 * </ul>
28.57 * <p>
28.58 - * However as the circuits with doubles are more rich than plain boolean circuits,
28.59 - * there is additional requirement to allow any user of your API to write its
28.60 - * own "element" type. This is all going to be exercise in the tests bellow
28.61 + * However as the circuits with doubles are more rich than plain
28.62 + * boolean circuits, there is additional requirement to allow any user
28.63 + * of your API to write its own "element" type. This is all going to
28.64 + * be exercise in the tests bellow
28.65 * which you are supposed to implement.
28.66 */
28.67 // BEGIN: apifest.day2.welltestedsolution.RealTest
28.68 @@ -84,13 +57,15 @@
28.69 *
28.70 * Feed the same circuit with x1=0.5, x2=0.5, assert result is 0.625
28.71 *
28.72 - * Feed the same circuit with x1=0.0, x2=2.0, make sure it throws an exception
28.73 + * Feed the same circuit with x1=0.0, x2=2.0
28.74 + * , make sure it throws an exception
28.75 */
28.76 public void testX1andX2orNotX1() {
28.77 Circuit c = Circuit.createOrCircuit(
28.78 - Circuit.createAndCircuit(Circuit.input(0), Circuit.input(1)),
28.79 - Circuit.createNotCircuit(Circuit.input(0))
28.80 - );
28.81 + Circuit.createAndCircuit(Circuit.input(0),
28.82 + Circuit.input(1)),
28.83 + Circuit.createNotCircuit(Circuit.input(0))
28.84 + );
28.85 assertFalse("true, false", c.evaluate(true, false));
28.86 assertTrue("false, true", c.evaluate(false, true));
28.87 assertEquals("0.0, 1.0", 1.0, c.evaluateFuzzy(0.0, 1.0), 0.0);
28.88 @@ -130,7 +105,8 @@
28.89 }
28.90 }
28.91
28.92 - /** Write your own element type called "gte" that will have two inputs and one output.
28.93 + /** Write your own element type called "gte" that
28.94 + * will have two inputs and one output.
28.95 * The output value will be 1 if x1 >= x2 and 0 otherwise.
28.96 *
28.97 * Create
28.98 @@ -144,10 +120,10 @@
28.99 */
28.100 public void testGreaterThanEqualElement() {
28.101 Circuit gte = new Gte(Circuit.createAndCircuit(
28.102 - Circuit.input(0),
28.103 - Circuit.createNotCircuit(Circuit.input(0))),
28.104 - Circuit.input(0)
28.105 - );
28.106 + Circuit.input(0),
28.107 + Circuit.createNotCircuit(Circuit.input(0))),
28.108 + Circuit.input(0)
28.109 + );
28.110 assertEquals("0.5", 0.0, gte.evaluateFuzzy(0.5), 0.0);
28.111 assertEquals("1.0", 0.0, gte.evaluateFuzzy(1.0), 0.0);
28.112 assertEquals("0.0", 1.0, gte.evaluateFuzzy(0.0), 0.0);
28.113 @@ -157,11 +133,11 @@
28.114 public void testSilly() {
28.115 // (x1 and not x2) or x3
28.116 Circuit c = Circuit.createOrCircuit(
28.117 - Circuit.createAndCircuit(
28.118 - null,
28.119 - Circuit.createNotCircuit(null)),
28.120 - null
28.121 - );
28.122 + Circuit.createAndCircuit(
28.123 + null,
28.124 + Circuit.createNotCircuit(null)),
28.125 + null
28.126 + );
28.127 assertEquals("1 1 1", 1.0, c.evaluateFuzzy(1.0, 1.0, 1.0), 0.0);
28.128 assertEquals("1 1 0", 0.0, c.evaluateFuzzy(1.0, 1.0, 0.0), 0.0);
28.129 assertEquals("1 0 1", 1.0, c.evaluateFuzzy(1.0, 0.0, 1.0), 0.0);
29.1 --- a/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/test/apifest/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
29.2 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/test/apifest/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
29.3 @@ -14,7 +14,8 @@
29.4
29.5 public void testReallyUnrealistic() throws Exception {
29.6 // OK, this is not fair, right?
29.7 - assertEquals(null, Circuit.or(false, false).getClass().getSuperclass().getSuperclass().getSuperclass());
29.8 + assertEquals(null, Circuit.or(false, false).getClass().
29.9 + getSuperclass().getSuperclass().getSuperclass());
29.10 }
29.11 }
29.12 // END: apifest.day3.against-alwayscreatenewcircuit
30.1 --- a/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:55:24 2008 +0200
30.2 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:56:12 2008 +0200
30.3 @@ -14,8 +14,12 @@
30.4
30.5 public void testClass() throws Exception {
30.6 // OK, this is not fair as well.
30.7 - assertEquals("Created AND circuit", "AndCircuit", getName(Circuit.createAndCircuit(null, null)));
30.8 - assertEquals("Created OR circuit", "OrCircuit", getName(Circuit.createOrCircuit(null, null)));
30.9 + assertEquals("Created AND circuit", "AndCircuit",
30.10 + getName(Circuit.createAndCircuit(null, null))
30.11 + );
30.12 + assertEquals("Created OR circuit", "OrCircuit",
30.13 + getName(Circuit.createOrCircuit(null, null))
30.14 + );
30.15 }
30.16
30.17 private String getName(Object obj) {
31.1 --- a/samples/aserverinfo/src/org/apidesign/aserverinfo/AServerInfo.java Sat Jun 14 09:55:24 2008 +0200
31.2 +++ b/samples/aserverinfo/src/org/apidesign/aserverinfo/AServerInfo.java Sat Jun 14 09:56:12 2008 +0200
31.3 @@ -9,7 +9,10 @@
31.4 private final ResetHandler reset;
31.5 private final ShutdownHandler shutdown;
31.6
31.7 - private AServerInfo(NameProvider name, URLProvider url, ResetHandler reset, ShutdownHandler shutdown) {
31.8 + private AServerInfo(
31.9 + NameProvider name, URLProvider url,
31.10 + ResetHandler reset, ShutdownHandler shutdown
31.11 + ) {
31.12 this.name = name;
31.13 this.url = url;
31.14 this.reset = reset;
31.15 @@ -84,7 +87,11 @@
31.16 }
31.17
31.18 // BEGIN: aserverinfo.regularcreate
31.19 - public static AServerInfo create(NameProvider nameProvider, URLProvider urlProvider, ResetHandler reset)
31.20 + public static AServerInfo create(
31.21 + NameProvider nameProvider,
31.22 + URLProvider urlProvider,
31.23 + ResetHandler reset
31.24 + )
31.25 // END: aserverinfo.regularcreate
31.26 {
31.27 return new AServerInfo(nameProvider, urlProvider, reset, null);
31.28 @@ -97,7 +104,12 @@
31.29 }
31.30
31.31 /** @since 2.0 */
31.32 - public static AServerInfo create(NameProvider nameProvider, URLProvider urlProvider, ResetHandler reset, ShutdownHandler shutdown)
31.33 + public static AServerInfo create(
31.34 + NameProvider nameProvider,
31.35 + URLProvider urlProvider,
31.36 + ResetHandler reset,
31.37 + ShutdownHandler shutdown
31.38 + )
31.39 // END: aserverinfo.regularcreate.withshutdown
31.40 {
31.41 return new AServerInfo(nameProvider, urlProvider, reset, shutdown);
32.1 --- a/samples/componentinjection/src/org/apidesign/component/property/ToolkitFactory.java Sat Jun 14 09:55:24 2008 +0200
32.2 +++ b/samples/componentinjection/src/org/apidesign/component/property/ToolkitFactory.java Sat Jun 14 09:56:12 2008 +0200
32.3 @@ -85,7 +85,10 @@
32.4 Class c = Class.forName (classname);
32.5 t = (java.awt.Toolkit)c.newInstance ();
32.6 } catch (Exception ex) {
32.7 - LOG.log(Level.WARNING, "Cannot initialize toolkit: " + classname, ex);
32.8 + LOG.log(
32.9 + Level.WARNING,
32.10 + "Cannot initialize toolkit: " + classname, ex
32.11 + );
32.12 }
32.13 }
32.14 // fallback
33.1 --- a/samples/componentinjection/test/org/apidesign/component/InjectionSlotChangesTest.java Sat Jun 14 09:55:24 2008 +0200
33.2 +++ b/samples/componentinjection/test/org/apidesign/component/InjectionSlotChangesTest.java Sat Jun 14 09:56:12 2008 +0200
33.3 @@ -41,7 +41,8 @@
33.4 }
33.5 }
33.6 Listener listener = new Listener();
33.7 - Lookup.Result<InjectionSlot> res = Lookup.getDefault().lookupResult(InjectionSlot.class);
33.8 + Lookup.Result<InjectionSlot> res =
33.9 + Lookup.getDefault().lookupResult(InjectionSlot.class);
33.10 res.addLookupListener(listener);
33.11 assertEquals("Two services now", 2, res.allInstances().size());
33.12
33.13 @@ -49,7 +50,11 @@
33.14
33.15 assertEquals("One service only", 1, res.allInstances().size());
33.16 assertEquals("One change in listener", 1, listener.cnt);
33.17 - assertEquals("The second is ImplTwo", ImplTwo.class, res.allInstances().iterator().next().getClass());
33.18 + assertEquals(
33.19 + "The second is ImplTwo",
33.20 + ImplTwo.class,
33.21 + res.allInstances().iterator().next().getClass()
33.22 + );
33.23 // END: lookup.listener
33.24 }
33.25
34.1 --- a/samples/componentinjection/test/org/apidesign/component/InjectionSlotTest.java Sat Jun 14 09:55:24 2008 +0200
34.2 +++ b/samples/componentinjection/test/org/apidesign/component/InjectionSlotTest.java Sat Jun 14 09:56:12 2008 +0200
34.3 @@ -14,7 +14,8 @@
34.4 @BeforeClass
34.5 public static void setUpClass() throws Exception {
34.6 // this is a support for "dynamic" registration of any class
34.7 - // into the global pool of Lookup.getDefault() and java.util.ServiceLoader
34.8 + // into the global pool of Lookup.getDefault() and
34.9 + // java.util.ServiceLoader
34.10 // either in @BeforeClass or @Before register
34.11 // classes of the mock instances that you want your code
34.12 // to find
34.13 @@ -25,16 +26,23 @@
34.14 public void singleSlot() {
34.15 InjectionSlot result = InjectionSlot.singleSlot();
34.16 assertNotNull("Some result found", result);
34.17 - assertEquals("The first is ImplOne", ImplOne.class, result.getClass());
34.18 + assertEquals(
34.19 + "The first is ImplOne", ImplOne.class, result.getClass()
34.20 + );
34.21 }
34.22
34.23 @Test
34.24 public void multiSlot() {
34.25 - Iterator<? extends InjectionSlot> it = InjectionSlot.multiSlot().iterator();
34.26 + Iterator<? extends InjectionSlot> it =
34.27 + InjectionSlot.multiSlot().iterator();
34.28 assertTrue("Has at least one", it.hasNext());
34.29 - assertEquals("The first is ImplOne", ImplOne.class, it.next().getClass());
34.30 + assertEquals(
34.31 + "The first is ImplOne", ImplOne.class, it.next().getClass()
34.32 + );
34.33 assertTrue("Has two", it.hasNext());
34.34 - assertEquals("The second is ImplTwo", ImplTwo.class, it.next().getClass());
34.35 + assertEquals(
34.36 + "The second is ImplTwo", ImplTwo.class, it.next().getClass()
34.37 + );
34.38 assertFalse("No other instance registered", it.hasNext());
34.39 }
34.40
35.1 --- a/samples/componentinjection/test/org/apidesign/component/InjectionViaServiceLoaderTest.java Sat Jun 14 09:55:24 2008 +0200
35.2 +++ b/samples/componentinjection/test/org/apidesign/component/InjectionViaServiceLoaderTest.java Sat Jun 14 09:56:12 2008 +0200
35.3 @@ -14,7 +14,8 @@
35.4 @BeforeClass
35.5 public static void setUpClass() throws Exception {
35.6 // this is a support for "dynamic" registration of any class
35.7 - // into the global pool of Lookup.getDefault() and java.util.ServiceLoader
35.8 + // into the global pool of Lookup.getDefault() and
35.9 + // java.util.ServiceLoader
35.10 // either in @BeforeClass or @Before register
35.11 // classes of the mock instances that you want your code
35.12 // to find
35.13 @@ -25,16 +26,23 @@
35.14 public void singleSlot() {
35.15 InjectionSlot result = InjectionViaServiceLoader.singleSlot();
35.16 assertNotNull("Some result found", result);
35.17 - assertEquals("The first is ImplOne", ImplOne.class, result.getClass());
35.18 + assertEquals(
35.19 + "The first is ImplOne", ImplOne.class, result.getClass()
35.20 + );
35.21 }
35.22
35.23 @Test
35.24 public void multiSlot() {
35.25 - Iterator<? extends InjectionSlot> it = InjectionViaServiceLoader.multiSlot().iterator();
35.26 + Iterator<? extends InjectionSlot> it =
35.27 + InjectionViaServiceLoader.multiSlot().iterator();
35.28 assertTrue("Has at least one", it.hasNext());
35.29 - assertEquals("The first is ImplOne", ImplOne.class, it.next().getClass());
35.30 + assertEquals(
35.31 + "The first is ImplOne", ImplOne.class, it.next().getClass()
35.32 + );
35.33 assertTrue("Has two", it.hasNext());
35.34 - assertEquals("The second is ImplTwo", ImplTwo.class, it.next().getClass());
35.35 + assertEquals(
35.36 + "The second is ImplTwo", ImplTwo.class, it.next().getClass()
35.37 + );
35.38 assertFalse("No other instance registered", it.hasNext());
35.39 }
35.40
36.1 --- a/samples/conditionaluseofapi/src/conditionaluseofapi/Main.java Sat Jun 14 09:55:24 2008 +0200
36.2 +++ b/samples/conditionaluseofapi/src/conditionaluseofapi/Main.java Sat Jun 14 09:56:12 2008 +0200
36.3 @@ -24,7 +24,10 @@
36.4
36.5 try {
36.6 Class onlyOn15 = Class.forName("java.lang.StringBuilder");
36.7 - add = (AddString)Class.forName("conditionaluseofapi.StringBuilderAdd15").newInstance();
36.8 + Class codeOn15 = Class.forName(
36.9 + "conditionaluseofapi.StringBuilderAdd15"
36.10 + );
36.11 + add = (AddString)codeOn15.newInstance();
36.12 } catch (ClassNotFoundException ex) {
36.13 add = new StringBufferAdd();
36.14 }
37.1 --- a/samples/consistency/src-api1.0/api/Lookup.java Sat Jun 14 09:55:24 2008 +0200
37.2 +++ b/samples/consistency/src-api1.0/api/Lookup.java Sat Jun 14 09:56:12 2008 +0200
37.3 @@ -20,7 +20,9 @@
37.4 // END: design.consistency.lookupAll.1.0
37.5
37.6 // BEGIN: design.consistency.lookupAllClasses.1.0
37.7 - public abstract <T> Set<Class<? extends T>> lookupAllClasses(Class<T> clazz);
37.8 + public abstract <T> Set<Class<? extends T>> lookupAllClasses(
37.9 + Class<T> clazz
37.10 + );
37.11 // END: design.consistency.lookupAllClasses.1.0
37.12 }
37.13 // END: design.consistency.1.0
38.1 --- a/samples/deadlock/src/org/apidesign/deadlock/logs/OverrideMePlease.java Sat Jun 14 09:55:24 2008 +0200
38.2 +++ b/samples/deadlock/src/org/apidesign/deadlock/logs/OverrideMePlease.java Sat Jun 14 09:56:12 2008 +0200
38.3 @@ -11,7 +11,9 @@
38.4 }
38.5 // BEGIN: logs.override
38.6 protected boolean overideMePlease() {
38.7 - Logger.getLogger(OverrideMePlease.class.getName()).warning("subclasses are supposed to override overideMePlease() method!");
38.8 + Logger.getLogger(OverrideMePlease.class.getName()).warning(
38.9 + "subclasses are supposed to override overideMePlease() method!"
38.10 + );
38.11 // some default
38.12 return true;
38.13 }
39.1 --- a/samples/deadlock/test/org/apidesign/deadlock/DeadlockTest.java Sat Jun 14 09:55:24 2008 +0200
39.2 +++ b/samples/deadlock/test/org/apidesign/deadlock/DeadlockTest.java Sat Jun 14 09:56:12 2008 +0200
39.3 @@ -14,7 +14,9 @@
39.4
39.5 // BEGIN: deadlock.test
39.6 public class DeadlockTest extends NbTestCase {
39.7 - static final Logger LOG = Logger.getLogger(DeadlockTest.class.getName());
39.8 + static final Logger LOG = Logger.getLogger(
39.9 + DeadlockTest.class.getName()
39.10 + );
39.11
39.12 public DeadlockTest(String n) {
39.13 super(n);
39.14 @@ -34,7 +36,9 @@
39.15 JLabel sampleLabel = createLabel();
39.16 return sampleLabel.getPreferredSize();
39.17 } catch (InterruptedException ex) {
39.18 - Logger.getLogger(DeadlockTest.class.getName()).log(Level.SEVERE, null, ex);
39.19 + Logger.getLogger(
39.20 + DeadlockTest.class.getName()).log(Level.SEVERE, null, ex
39.21 + );
39.22 return super.getPreferredSize();
39.23 }
39.24 }
40.1 --- a/samples/deadlock/test/org/apidesign/deadlock/LabelProviderTest.java Sat Jun 14 09:55:24 2008 +0200
40.2 +++ b/samples/deadlock/test/org/apidesign/deadlock/LabelProviderTest.java Sat Jun 14 09:56:12 2008 +0200
40.3 @@ -13,7 +13,9 @@
40.4
40.5 // BEGIN: deadlock.test.controlflow
40.6 public class LabelProviderTest extends NbTestCase {
40.7 - static final Logger LOG = Logger.getLogger(LabelProviderTest.class.getName());
40.8 + static final Logger LOG = Logger.getLogger(
40.9 + LabelProviderTest.class.getName()
40.10 + );
40.11
40.12 public LabelProviderTest(String n) {
40.13 super(n);
41.1 --- a/samples/delegatingwriter/nbproject/project.properties Sat Jun 14 09:55:24 2008 +0200
41.2 +++ b/samples/delegatingwriter/nbproject/project.properties Sat Jun 14 09:56:12 2008 +0200
41.3 @@ -1,3 +1,5 @@
41.4 +application.title=delegatingwriter
41.5 +application.vendor=jarda
41.6 build.classes.dir=${build.dir}/classes
41.7 build.classes.excludes=**/*.java,**/*.form
41.8 # This directory is removed when the project is cleaned:
41.9 @@ -16,6 +18,7 @@
41.10 dist.jar=${dist.dir}/delegatingwriter.jar
41.11 dist.javadoc.dir=${dist.dir}/javadoc
41.12 excludes=
41.13 +file.reference.junit-4.4.jar=../libs/dist/junit-4.4.jar
41.14 includes=**
41.15 jar.compress=false
41.16 javac.classpath=
41.17 @@ -27,8 +30,7 @@
41.18 javac.test.classpath=\
41.19 ${javac.classpath}:\
41.20 ${build.classes.dir}:\
41.21 - ${libs.junit.classpath}:\
41.22 - ${libs.junit_4.classpath}
41.23 + ${file.reference.junit-4.4.jar}
41.24 javadoc.additionalparam=
41.25 javadoc.author=false
41.26 javadoc.encoding=${source.encoding}
42.1 --- a/samples/delegatingwriter/src/org/apidesign/delegatingwriter/AltBufferedWriter.java Sat Jun 14 09:55:24 2008 +0200
42.2 +++ b/samples/delegatingwriter/src/org/apidesign/delegatingwriter/AltBufferedWriter.java Sat Jun 14 09:56:12 2008 +0200
42.3 @@ -1,8 +1,3 @@
42.4 -/*
42.5 - * To change this template, choose Tools | Templates
42.6 - * and open the template in the editor.
42.7 - */
42.8 -
42.9 package org.apidesign.delegatingwriter;
42.10
42.11 import java.io.BufferedWriter;
42.12 @@ -33,18 +28,25 @@
42.13 @Override
42.14 public Writer append(CharSequence csq) throws IOException {
42.15 switch (behaviour) {
42.16 - case THROW_EXCEPTION: return appendThrowException(csq);
42.17 - case DELEGATE_TO_SUPER: return appendDelegateToSuper(csq);
42.18 - case DELEGATE_TO_OUT: return appendDelegateToUnderlaying(csq);
42.19 - case DELEGATE_CONDITIONALLY: return appendDelegateConditionally(csq);
42.20 - default: throw new IllegalStateException("Unknown" + behaviour);
42.21 + case THROW_EXCEPTION:
42.22 + return appendThrowException(csq);
42.23 + case DELEGATE_TO_SUPER:
42.24 + return appendDelegateToSuper(csq);
42.25 + case DELEGATE_TO_OUT:
42.26 + return appendDelegateToUnderlaying(csq);
42.27 + case DELEGATE_CONDITIONALLY:
42.28 + return appendDelegateConditionally(csq);
42.29 + default:
42.30 + throw new IllegalStateException("Unknown" + behaviour);
42.31 }
42.32 }
42.33
42.34 public Writer appendThrowException(CharSequence csq) throws IOException {
42.35 - /* in case of real code, this would be part of the regular append method BEGIN: writer.throw
42.36 + /* in case of real code, this would be part of
42.37 + the regular append method. BEGIN: writer.throw
42.38 public Writer append(CharSequence csq) throws IOException {
42.39 - /* thrown an exception as this method is new and subclasses need to override it */
42.40 + /* thrown an exception as this method is new and
42.41 + subclasses need to override it */
42.42 throw new UnsupportedOperationException();
42.43 }
42.44 // END: writer.throw
42.45 @@ -76,14 +78,27 @@
42.46 // END: writer.delegateout
42.47 }
42.48
42.49 - private Writer appendDelegateConditionally(CharSequence csq) throws IOException {
42.50 + private Writer appendDelegateConditionally(CharSequence csq)
42.51 + throws IOException {
42.52 // BEGIN: writer.conditionally
42.53 boolean isOverriden = false;
42.54 try {
42.55 isOverriden =
42.56 - (getClass().getMethod("write", String.class).getDeclaringClass() != Writer.class) ||
42.57 - (getClass().getMethod("write", Integer.TYPE).getDeclaringClass() != BufferedWriter.class) ||
42.58 - (getClass().getMethod("write", String.class, Integer.TYPE, Integer.TYPE).getDeclaringClass() != BufferedWriter.class);
42.59 + (
42.60 + getClass().getMethod(
42.61 + "write", String.class
42.62 + ).getDeclaringClass() != Writer.class
42.63 + ) ||
42.64 + (
42.65 + getClass().getMethod(
42.66 + "write", Integer.TYPE
42.67 + ).getDeclaringClass() != BufferedWriter.class
42.68 + ) ||
42.69 + (
42.70 + getClass().getMethod(
42.71 + "write", String.class, Integer.TYPE, Integer.TYPE
42.72 + ).getDeclaringClass() != BufferedWriter.class
42.73 + );
42.74 } catch (Exception ex) {
42.75 throw new IOException(ex);
42.76 }
42.77 @@ -99,6 +114,9 @@
42.78 }
42.79
42.80 public enum Behaviour {
42.81 - THROW_EXCEPTION, DELEGATE_TO_SUPER, DELEGATE_TO_OUT, DELEGATE_CONDITIONALLY
42.82 + THROW_EXCEPTION,
42.83 + DELEGATE_TO_SUPER,
42.84 + DELEGATE_TO_OUT,
42.85 + DELEGATE_CONDITIONALLY
42.86 }
42.87 }
43.1 --- a/samples/delegatingwriter/test/org/apidesign/delegatingwriter/BufferedWriterOnCDImageTest.java Sat Jun 14 09:55:24 2008 +0200
43.2 +++ b/samples/delegatingwriter/test/org/apidesign/delegatingwriter/BufferedWriterOnCDImageTest.java Sat Jun 14 09:56:12 2008 +0200
43.3 @@ -23,7 +23,10 @@
43.4 CDSequence cdImage = new CDSequence();
43.5 BufferedWriter bufferedWriter = new BufferedWriter(writer);
43.6 bufferedWriter.append(cdImage);
43.7 - assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount());
43.8 + assertEquals(
43.9 + "Correct number of writes delegated",
43.10 + cdImage.length(), writer.getCharacterCount()
43.11 + );
43.12 // END: writer.countcd
43.13 }
43.14
43.15 @@ -31,18 +34,30 @@
43.16 public void testBehaviourOfBufferThatDelegatesToAppend() throws IOException {
43.17 CountingWriter writer = new CountingWriter();
43.18 CDSequence cdImage = new CDSequence();
43.19 - BufferedWriter bufferedWriter = new AltBufferedWriter(writer, AltBufferedWriter.Behaviour.DELEGATE_TO_OUT);
43.20 + BufferedWriter bufferedWriter = new AltBufferedWriter(
43.21 + writer, AltBufferedWriter.Behaviour.DELEGATE_TO_OUT
43.22 + );
43.23 bufferedWriter.append(cdImage);
43.24 - assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount());
43.25 + assertEquals(
43.26 + "Correct number of writes delegated",
43.27 + cdImage.length(),
43.28 + writer.getCharacterCount()
43.29 + );
43.30 }
43.31
43.32 @Test
43.33 public void testBehaviourWhenDelegatingConditionallyIsOK() throws IOException {
43.34 CountingWriter writer = new CountingWriter();
43.35 CDSequence cdImage = new CDSequence();
43.36 - BufferedWriter bufferedWriter = new AltBufferedWriter(writer, AltBufferedWriter.Behaviour.DELEGATE_CONDITIONALLY);
43.37 + BufferedWriter bufferedWriter = new AltBufferedWriter(
43.38 + writer, AltBufferedWriter.Behaviour.DELEGATE_CONDITIONALLY
43.39 + );
43.40 bufferedWriter.append(cdImage);
43.41 - assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount());
43.42 + assertEquals(
43.43 + "Correct number of writes delegated",
43.44 + cdImage.length(),
43.45 + writer.getCharacterCount()
43.46 + );
43.47 }
43.48
43.49
44.1 --- a/samples/delegatingwriterfinal/src-api2.0/api/Writer.java Sat Jun 14 09:55:24 2008 +0200
44.2 +++ b/samples/delegatingwriterfinal/src-api2.0/api/Writer.java Sat Jun 14 09:56:12 2008 +0200
44.3 @@ -32,7 +32,8 @@
44.4 seq.write(new CharSeq(cbuf, 0, cbuf.length));
44.5 }
44.6 }
44.7 - public final void write(char cbuf[], int off, int len) throws IOException {
44.8 + public final void write(char cbuf[], int off, int len)
44.9 + throws IOException {
44.10 if (impl != null) {
44.11 impl.write(cbuf, off, len);
44.12 } else {
44.13 @@ -46,7 +47,8 @@
44.14 seq.write(str);
44.15 }
44.16 }
44.17 - public final void write(String str, int off, int len) throws IOException {
44.18 + public final void write(String str, int off, int len)
44.19 + throws IOException {
44.20 if (impl != null) {
44.21 impl.write(str, off, len);
44.22 } else {
44.23 @@ -81,7 +83,8 @@
44.24 return this;
44.25 }
44.26
44.27 - public final Writer append(CharSequence csq, int start, int end) throws IOException {
44.28 + public final Writer append(CharSequence csq, int start, int end)
44.29 + throws IOException {
44.30 return append(csq.subSequence(start, end));
44.31 }
44.32
45.1 --- a/samples/differentreturntype/build.xml Sat Jun 14 09:55:24 2008 +0200
45.2 +++ b/samples/differentreturntype/build.xml Sat Jun 14 09:56:12 2008 +0200
45.3 @@ -6,18 +6,26 @@
45.4
45.5 <!-- BEGIN: theory.binary.differentreturntype.ant -->
45.6 <!-- This is the target that does the whole trick - e,g. it compiles
45.7 - the Java source and then replaces tokens inside of the .class file
45.8 + the Java source and then replaces tokens
45.9 + inside of the .class file
45.10 -->
45.11 <target name="-build-and-rename">
45.12 <mkdir dir="build/apimerge/classes"/>
45.13 - <javac srcdir="src-apimerge" destdir="build/apimerge/classes" source="1.4" target="1.4" classpath="${cp}"/>
45.14 + <javac
45.15 + srcdir="src-apimerge" destdir="build/apimerge/classes"
45.16 + source="1.4" target="1.4" classpath="${cp}"
45.17 + />
45.18
45.19 <!-- this is the replace. As the replace is done textually,
45.20 - we need to use some reasonable encoding that treats all byte values
45.21 - as characters. E.g. it is not possible to use UTF-8 as it does not
45.22 - like the standard Java header 0xCAFEBABE. Western Europe encoding is fine
45.23 + we need to use some reasonable encoding that treats all
45.24 + byte values as characters. E.g. it is not possible to
45.25 + use UTF-8 as it does not like the standard Java header
45.26 + 0xCAFEBABE. Western Europe encoding is fine
45.27 -->
45.28 - <replace dir="build/apimerge/classes" casesensitive="true" encoding="iso-8859-1" summary="true">
45.29 + <replace
45.30 + dir="build/apimerge/classes" casesensitive="true"
45.31 + encoding="iso-8859-1" summary="true"
45.32 + >
45.33 <include name="**/*.class"/>
45.34 <replacetoken>g3tIcon</replacetoken>
45.35 <replacevalue>getIcon</replacevalue>
46.1 --- a/samples/extensibleicon/src/org/apidesign/extensibleicon/CatQuery.java Sat Jun 14 09:55:24 2008 +0200
46.2 +++ b/samples/extensibleicon/src/org/apidesign/extensibleicon/CatQuery.java Sat Jun 14 09:56:12 2008 +0200
46.3 @@ -7,14 +7,18 @@
46.4 private CatQuery() { }
46.5
46.6 public static boolean isCat(ExtIcon icon) {
46.7 - for (CatQueryImplementation impl : Lookup.getDefault().lookupAll(CatQueryImplementation.class)) {
46.8 + for (CatQueryImplementation impl :
46.9 + Lookup.getDefault().lookupAll(CatQueryImplementation.class)
46.10 + ) {
46.11 Boolean res = impl.isCat(icon);
46.12 if (res != null) {
46.13 return res;
46.14 }
46.15 }
46.16
46.17 - for (CatQueryImplementation impl : icon.getLookup().lookupAll(CatQueryImplementation.class)) {
46.18 + for (CatQueryImplementation impl :
46.19 + icon.getLookup().lookupAll(CatQueryImplementation.class)
46.20 + ) {
46.21 Boolean res = impl.isCat(icon);
46.22 if (res != null) {
46.23 return res;
47.1 --- a/samples/extensibleicon/src/org/apidesign/extensibleicon/Icon2Image.java Sat Jun 14 09:55:24 2008 +0200
47.2 +++ b/samples/extensibleicon/src/org/apidesign/extensibleicon/Icon2Image.java Sat Jun 14 09:56:12 2008 +0200
47.3 @@ -12,7 +12,11 @@
47.4 if (img != null) {
47.5 return img;
47.6 }
47.7 - BufferedImage buf = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
47.8 + BufferedImage buf = new BufferedImage(
47.9 + icon.getIconWidth(),
47.10 + icon.getIconHeight(),
47.11 + BufferedImage.TYPE_INT_RGB
47.12 + );
47.13 icon.paintIcon(null, buf.getGraphics(), 0, 0);
47.14 return buf;
47.15 }
48.1 --- a/samples/extensionpoint/src-api/org/apidesign/extensionpoint/Main.java Sat Jun 14 09:55:24 2008 +0200
48.2 +++ b/samples/extensionpoint/src-api/org/apidesign/extensionpoint/Main.java Sat Jun 14 09:56:12 2008 +0200
48.3 @@ -12,7 +12,8 @@
48.4 public static void main(String[] args) {
48.5 for (;;) {
48.6 // BEGIN: extension.point.Query
48.7 - Collection<? extends TipOfTheDay> all = Lookup.getDefault().lookupAll(TipOfTheDay.class);
48.8 + Collection<? extends TipOfTheDay> all =
48.9 + Lookup.getDefault().lookupAll(TipOfTheDay.class);
48.10 List<TipOfTheDay> arr = new ArrayList<TipOfTheDay>(all);
48.11 Collections.shuffle(arr);
48.12
48.13 @@ -33,7 +34,9 @@
48.14 String again = "Once Again";
48.15 String exit = "Exit";
48.16 String[] options = new String[] { again, exit };
48.17 - int ret = JOptionPane.showOptionDialog(null, msg, title, 0, type, null, options, exit);
48.18 + int ret = JOptionPane.showOptionDialog(
48.19 + null, msg, title, 0, type, null, options, exit
48.20 + );
48.21
48.22 if (ret != 0) {
48.23 break;
49.1 --- a/samples/forjoe/src-api1.0/api/InterfaceThatJustJoeCanImplement.java Sat Jun 14 09:55:24 2008 +0200
49.2 +++ b/samples/forjoe/src-api1.0/api/InterfaceThatJustJoeCanImplement.java Sat Jun 14 09:56:12 2008 +0200
49.3 @@ -4,7 +4,9 @@
49.4 public abstract class InterfaceThatJustJoeCanImplement {
49.5 protected InterfaceThatJustJoeCanImplement() {
49.6 if (!"impl.joe.JoesImpl".equals(getClass().getName())) {
49.7 - throw new IllegalStateException("Sorry, you are not allowed to implement this class");
49.8 + throw new IllegalStateException(
49.9 + "Sorry, you are not allowed to implement this class"
49.10 + );
49.11 }
49.12 }
49.13
50.1 --- a/samples/friendpackage/src/implpkg/Accessor.java Sat Jun 14 09:55:24 2008 +0200
50.2 +++ b/samples/friendpackage/src/implpkg/Accessor.java Sat Jun 14 09:56:12 2008 +0200
50.3 @@ -30,7 +30,9 @@
50.4 }
50.5
50.6 try {
50.7 - Class.forName(Item.class.getName(), true, Item.class.getClassLoader());
50.8 + Class.forName(
50.9 + Item.class.getName(), true, Item.class.getClassLoader()
50.10 + );
50.11 } catch (Exception ex) {
50.12 ex.printStackTrace();
50.13 }
51.1 --- a/samples/gc/src/org/apidesign/gc/WeakListeners.java Sat Jun 14 09:55:24 2008 +0200
51.2 +++ b/samples/gc/src/org/apidesign/gc/WeakListeners.java Sat Jun 14 09:56:12 2008 +0200
51.3 @@ -6,8 +6,12 @@
51.4 private WeakListeners() { }
51.5
51.6 // BEGIN: gc.weaklistener.create
51.7 - public static <T extends EventListener> T create(Class<T> type, T listener, Object source) {
51.8 - return org.openide.util.WeakListeners.create(type, listener, source);
51.9 + public static <T extends EventListener> T create(
51.10 + Class<T> type, T listener, Object source
51.11 + ) {
51.12 + return org.openide.util.WeakListeners.create(
51.13 + type, listener, source
51.14 + );
51.15 }
51.16 // END: gc.weaklistener.create
51.17 }
52.1 --- a/samples/growingparameters/src-api2.0/api/classes/Compute.java Sat Jun 14 09:55:24 2008 +0200
52.2 +++ b/samples/growingparameters/src-api2.0/api/classes/Compute.java Sat Jun 14 09:56:12 2008 +0200
52.3 @@ -10,14 +10,17 @@
52.4 * @return list of strings to work with
52.5 * @since 1.0 */
52.6 public abstract List<String> getData();
52.7 - /** Computes the strings to work with together with their associated descriptions.
52.8 - * Shall be overriden in subclasses. By default delegates to {@link #getData}
52.9 - * and uses the provided strings as both, the string and its description.
52.10 + /** Computes the strings to work with together with their
52.11 + * associated descriptions. Shall be overriden in subclasses.
52.12 + * By default delegates to {@link #getData}
52.13 + * and uses the provided strings as both, the string
52.14 + * and its description.
52.15 *
52.16 * @return name to description pairs to work with
52.17 * @since 2.0 */
52.18 public Map<String,String> getDataAndDescription() {
52.19 - LinkedHashMap<String,String> ret = new LinkedHashMap<String, String>();
52.20 + LinkedHashMap<String,String> ret =
52.21 + new LinkedHashMap<String, String>();
52.22 for (String s : getData()) {
52.23 ret.put(s, s);
52.24 }
53.1 --- a/samples/hellowithsubclassing/src/org/apidesign/hello/ThreeWaysToUseHello.java Sat Jun 14 09:55:24 2008 +0200
53.2 +++ b/samples/hellowithsubclassing/src/org/apidesign/hello/ThreeWaysToUseHello.java Sat Jun 14 09:56:12 2008 +0200
53.3 @@ -19,7 +19,10 @@
53.4 // BEGIN: hello.supercall
53.5 private static class SuperHello extends Hello {
53.6 @Override
53.7 - public void hello() { super.hello(); System.out.println("Hello once again"); }
53.8 + public void hello() {
53.9 + super.hello();
53.10 + System.out.println("Hello once again");
53.11 + }
53.12 }
53.13 // END: hello.supercall
53.14
54.1 --- a/samples/javabeans/src/org/apidesign/javabeans/toomany/HighlightsContainer.java Sat Jun 14 09:55:24 2008 +0200
54.2 +++ b/samples/javabeans/src/org/apidesign/javabeans/toomany/HighlightsContainer.java Sat Jun 14 09:56:12 2008 +0200
54.3 @@ -4,8 +4,9 @@
54.4
54.5 public interface HighlightsContainer {
54.6 // BEGIN: javabeans.with.HighlightsContainer.TooMany
54.7 - public void addHighlightsChangeListener(HighlightsChangeListener listener) throws TooManyListenersException;
54.8 + public void addHighlightsChangeListener(HighlightsChangeListener l)
54.9 + throws TooManyListenersException;
54.10 // END: javabeans.with.HighlightsContainer.TooMany
54.11 public HighlightsSequence getHighlights(int startOffset, int endOffset);
54.12 - public void removeHighlightsChangeListener(HighlightsChangeListener listener);
54.13 + public void removeHighlightsChangeListener(HighlightsChangeListener l);
54.14 }
55.1 --- a/samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java Sat Jun 14 09:55:24 2008 +0200
55.2 +++ b/samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java Sat Jun 14 09:56:12 2008 +0200
55.3 @@ -11,11 +11,15 @@
55.4 final class MyHighlightsContainer implements HighlightsContainer {
55.5 private HighlightsChangeListener listener;
55.6
55.7 - public synchronized void addHighlightsChangeListener(HighlightsChangeListener l) throws TooManyListenersException {
55.8 + public synchronized void addHighlightsChangeListener(
55.9 + HighlightsChangeListener l
55.10 + ) throws TooManyListenersException {
55.11 if (listener != null) throw new TooManyListenersException();
55.12 listener = l;
55.13 }
55.14 - public synchronized void removeHighlightsChangeListener(HighlightsChangeListener l) {
55.15 + public synchronized void removeHighlightsChangeListener(
55.16 + HighlightsChangeListener l
55.17 + ) {
55.18 if (listener == l) listener = null;
55.19 }
55.20 public HighlightsSequence getHighlights(int startOffset, int endOffset) {
56.1 --- a/samples/libs/build.xml Sat Jun 14 09:55:24 2008 +0200
56.2 +++ b/samples/libs/build.xml Sat Jun 14 09:56:12 2008 +0200
56.3 @@ -1,6 +1,8 @@
56.4 <?xml version="1.0" encoding="UTF-8"?>
56.5 <project name="Downloads necessary libraries" default="libraries" basedir=".">
56.6 <target name="clean">
56.7 + </target>
56.8 + <target name="real-clean">
56.9 <delete dir="dist"/>
56.10 </target>
56.11
57.1 --- a/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java Sat Jun 14 09:55:24 2008 +0200
57.2 +++ b/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java Sat Jun 14 09:56:12 2008 +0200
57.3 @@ -1,8 +1,3 @@
57.4 -/*
57.5 - * To change this template, choose Tools | Templates
57.6 - * and open the template in the editor.
57.7 - */
57.8 -
57.9 package org.apidesign.impl.security.extension;
57.10
57.11 import java.nio.ByteBuffer;
57.12 @@ -18,7 +13,8 @@
57.13 */
57.14 // BEGIN: day.end.bridges.BridgeToNew
57.15 public class BridgeToNew extends Digestor<MessageDigest> {
57.16 - /** initializes the other bridge, and allow us to eliminate stack overflow */
57.17 + /** initializes the other bridge, and allow us to eliminate stack
57.18 + * overflow */
57.19 private static final BridgeToOld oldBridge = new BridgeToOld();
57.20
57.21 @Override
57.22 @@ -34,7 +30,9 @@
57.23 try {
57.24 return MessageDigest.getInstance(algorithm);
57.25 } catch (NoSuchAlgorithmException ex) {
57.26 - Logger.getLogger(BridgeToNew.class.getName()).log(Level.FINE, "Cannot find " + algorithm, ex);
57.27 + Logger.getLogger(BridgeToNew.class.getName()).log(
57.28 + Level.FINE, "Cannot find " + algorithm, ex
57.29 + );
57.30 return null;
57.31 }
57.32 }
58.1 --- a/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOld.java Sat Jun 14 09:55:24 2008 +0200
58.2 +++ b/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOld.java Sat Jun 14 09:56:12 2008 +0200
58.3 @@ -1,8 +1,3 @@
58.4 -/*
58.5 - * To change this template, choose Tools | Templates
58.6 - * and open the template in the editor.
58.7 - */
58.8 -
58.9 package org.apidesign.impl.security.extension;
58.10
58.11 import org.apidesign.api.security.Digest;
58.12 @@ -41,7 +36,10 @@
58.13 if ("MessageDigest".equals(type)) {
58.14 Digest dig = Digest.getInstance(algorithm);
58.15 if (dig != null) {
58.16 - return new ServiceImpl(dig, this, type, algorithm, "", Collections.<String>emptyList(), Collections.<String,String>emptyMap());
58.17 + return new ServiceImpl(
58.18 + dig, this, type, algorithm, "",
58.19 + Collections.<String>emptyList(),
58.20 + Collections.<String,String>emptyMap());
58.21 }
58.22 }
58.23 return null;
58.24 @@ -54,13 +52,17 @@
58.25 private static class ServiceImpl<Data> extends Service {
58.26 Digest dig;
58.27
58.28 - public ServiceImpl(Digest dig, Provider provider, String type, String algorithm, String className, List<String> aliases, Map<String, String> attributes) {
58.29 + public ServiceImpl(Digest dig, Provider provider,
58.30 + String type, String algorithm, String className,
58.31 + List<String> aliases, Map<String, String> attributes
58.32 + ) {
58.33 super(provider, type, algorithm, className, aliases, attributes);
58.34 this.dig = dig;
58.35 }
58.36
58.37 @Override
58.38 - public Object newInstance(Object constructorParameter) throws NoSuchAlgorithmException {
58.39 + public Object newInstance(Object constructorParameter)
58.40 + throws NoSuchAlgorithmException {
58.41 return new MessageDigest(getAlgorithm()) {
58.42 private byte[] res;
58.43
58.44 @@ -71,7 +73,9 @@
58.45 }
58.46
58.47 @Override
58.48 - protected void engineUpdate(byte[] input, int offset, int len) {
58.49 + protected void engineUpdate(
58.50 + byte[] input, int offset, int len
58.51 + ) {
58.52 ByteBuffer bb = ByteBuffer.wrap(input);
58.53 bb.position(offset);
58.54 bb.limit(offset + len);
59.1 --- a/samples/messagedigest/src-new-api/org/apidesign/api/security/Digest.java Sat Jun 14 09:55:24 2008 +0200
59.2 +++ b/samples/messagedigest/src-new-api/org/apidesign/api/security/Digest.java Sat Jun 14 09:56:12 2008 +0200
59.3 @@ -23,7 +23,9 @@
59.4 */
59.5 public static Digest getInstance(String algorithm) {
59.6 for (Digestor<?> digestor : ServiceLoader.load(Digestor.class)) {
59.7 - DigestImplementation<?> impl = DigestImplementation.create(digestor, algorithm);
59.8 + DigestImplementation<?> impl = DigestImplementation.create(
59.9 + digestor, algorithm
59.10 + );
59.11 if (impl != null) {
59.12 return new Digest(impl);
59.13 }
60.1 --- a/samples/messagedigest/src-test/test/CountingDigestor.java Sat Jun 14 09:55:24 2008 +0200
60.2 +++ b/samples/messagedigest/src-test/test/CountingDigestor.java Sat Jun 14 09:56:12 2008 +0200
60.3 @@ -17,7 +17,12 @@
60.4 @Override
60.5 protected byte[] digest(int[] data) {
60.6 int i = data[0];
60.7 - byte[] arr = { (byte) (i & 255), (byte) ((i >> 8) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 24) & 255) };
60.8 + byte[] arr = {
60.9 + (byte) (i & 255),
60.10 + (byte) ((i >> 8) & 255),
60.11 + (byte) ((i >> 16) & 255),
60.12 + (byte) ((i >> 24) & 255)
60.13 + };
60.14 return arr;
60.15 }
60.16
61.1 --- a/samples/misuse/src/org/apidesign/misuse/projectconfig/ProjectConfigurationCorrect.java Sat Jun 14 09:55:24 2008 +0200
61.2 +++ b/samples/misuse/src/org/apidesign/misuse/projectconfig/ProjectConfigurationCorrect.java Sat Jun 14 09:56:12 2008 +0200
61.3 @@ -2,7 +2,8 @@
61.4
61.5 public class ProjectConfigurationCorrect {
61.6 // BEGIN: misuse.prjconfig.correct
61.7 - interface ProjectConfigurationProvider<Configuration extends ProjectConfiguration> {
61.8 + interface ProjectConfigurationProvider
61.9 + <Configuration extends ProjectConfiguration> {
61.10 Configuration[] getConfigurations();
61.11 Configuration getActive();
61.12 void setActive(Configuration c);
61.13 @@ -17,7 +18,7 @@
61.14 /* Following does not work:
61.15 static {
61.16 // BEGIN: misuse.prjconfig.correct.trivial.access
61.17 - ProjectConfigurationProvider<?> provider = null; // obtain from somewhere;
61.18 + ProjectConfigurationProvider<?> provider = null; // obtain elsewhere;
61.19 provider.setActive(provider.getConfigurations()[0]);
61.20 // END: misuse.prjconfig.correct.trivial.access
61.21 }
61.22 @@ -25,7 +26,7 @@
61.23
61.24 static {
61.25 // BEGIN: misuse.prjconfig.correct.access
61.26 - ProjectConfigurationProvider<?> provider = null; // obtain from somewhere;
61.27 + ProjectConfigurationProvider<?> provider = null; // obtain elsewhere;
61.28 resetToZero(provider);
61.29 // END: misuse.prjconfig.correct.access
61.30 }
61.31 @@ -39,7 +40,9 @@
61.32 // END: misuse.prjconfig.correct.openmethod
61.33
61.34 // BEGIN: misuse.prjconfig.correct.openclass
61.35 - static void workWithProjectConfigurationProvider(ProjectConfigurationProvider<?> p) {
61.36 + static void workWithProjectConfigurationProvider(
61.37 + ProjectConfigurationProvider<?> p
61.38 + ) {
61.39 ResetToZero<?> rtz = ResetToZero.create(p);
61.40 rtz.obtainFirst();
61.41 // after a while
61.42 @@ -54,7 +57,9 @@
61.43 this.provider = provider;
61.44 }
61.45
61.46 - static <C extends ProjectConfiguration> ResetToZero<C> create(ProjectConfigurationProvider<C> p) {
61.47 + static <C extends ProjectConfiguration> ResetToZero<C> create(
61.48 + ProjectConfigurationProvider<C> p
61.49 + ) {
61.50 return new ResetToZero<C>(p);
61.51 }
61.52