Author: dbrosius
Date: Sat Jul 16 17:53:03 2005
New Revision: 219362
URL: http://svn.apache.org/viewcvs?rev=219362&view=rev
Log:
Bug 33822: Change Faculty to Factorial, as was the intention of the samples.
Added:
jakarta/bcel/branches/jakarta/docs/Factorial.java
jakarta/bcel/tags/BCEL_5_0/docs/Factorial.java
Modified:
jakarta/bcel/branches/jakarta/build.xml
jakarta/bcel/tags/BCEL_5_0/build.xml
jakarta/bcel/trunk/build.xml
jakarta/bcel/trunk/xdocs/manual.xml
Modified: jakarta/bcel/branches/jakarta/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/bcel/branches/jakarta/build.xml?rev=219362&r1=219361&r2=219362&view=diff
==============================================================================
--- jakarta/bcel/branches/jakarta/build.xml (original)
+++ jakarta/bcel/branches/jakarta/build.xml Sat Jul 16 17:53:03 2005
@@ -134,7 +134,7 @@
<arg value="max.mini"/>
</java>
- <echo message="Faculty"/>
+ <echo message="Factorial"/>
<java classname="fac" classpath="${mini.dir}" />
<echo message="Fibonacci"/>
<java classname="fib" classpath="${mini.dir}" />
Added: jakarta/bcel/branches/jakarta/docs/Factorial.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/branches/jakarta/docs/Factorial.java?rev=219362&view=auto
==============================================================================
--- jakarta/bcel/branches/jakarta/docs/Factorial.java (added)
+++ jakarta/bcel/branches/jakarta/docs/Factorial.java Sat Jul 16 17:53:03 2005
@@ -0,0 +1,28 @@
+import java.io.*;
+
+public class Factorial {
+ private static BufferedReader in = new BufferedReader(new
+ InputStreamReader(System.in));
+
+ public static final int fac(int n) {
+ return(n == 0)? 1 : n * fac(n - 1);
+ }
+
+ public static final int readInt() {
+ int n = 4711;
+
+ try {
+ System.out.print("Please enter a number> ");
+ n = Integer.parseInt(in.readLine());
+ }
+ catch(IOException e1) { System.err.println(e1); }
+ catch(NumberFormatException e2) { System.err.println(e2); }
+
+ return n;
+ }
+
+ public static void main(String[] args) {
+ int n = readInt();
+ System.out.println("Factorial of " + n + " is " + fac(n));
+ }
+}
Modified: jakarta/bcel/tags/BCEL_5_0/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/bcel/tags/BCEL_5_0/build.xml?rev=219362&r1=219361&r2=219362&view=diff
==============================================================================
--- jakarta/bcel/tags/BCEL_5_0/build.xml (original)
+++ jakarta/bcel/tags/BCEL_5_0/build.xml Sat Jul 16 17:53:03 2005
@@ -134,7 +134,7 @@
<arg value="max.mini"/>
</java>
- <echo message="Faculty"/>
+ <echo message="Factorial"/>
<java classname="fac" classpath="${mini.dir}" />
<echo message="Fibonacci"/>
<java classname="fib" classpath="${mini.dir}" />
Added: jakarta/bcel/tags/BCEL_5_0/docs/Factorial.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/tags/BCEL_5_0/docs/Factorial.java?rev=219362&view=auto
==============================================================================
--- jakarta/bcel/tags/BCEL_5_0/docs/Factorial.java (added)
+++ jakarta/bcel/tags/BCEL_5_0/docs/Factorial.java Sat Jul 16 17:53:03 2005
@@ -0,0 +1,28 @@
+import java.io.*;
+
+public class Factorial {
+ private static BufferedReader in = new BufferedReader(new
+ InputStreamReader(System.in));
+
+ public static final int fac(int n) {
+ return(n == 0)? 1 : n * fac(n - 1);
+ }
+
+ public static final int readInt() {
+ int n = 4711;
+
+ try {
+ System.out.print("Please enter a number> ");
+ n = Integer.parseInt(in.readLine());
+ }
+ catch(IOException e1) { System.err.println(e1); }
+ catch(NumberFormatException e2) { System.err.println(e2); }
+
+ return n;
+ }
+
+ public static void main(String[] args) {
+ int n = readInt();
+ System.out.println("Factorial of " + n + " is " + fac(n));
+ }
+}
Modified: jakarta/bcel/trunk/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/build.xml?rev=219362&r1=219361&r2=219362&view=diff
==============================================================================
--- jakarta/bcel/trunk/build.xml (original)
+++ jakarta/bcel/trunk/build.xml Sat Jul 16 17:53:03 2005
@@ -77,7 +77,7 @@
<!-- Compile the examples -->
<target name="examples" depends="compile">
- <javac srcdir="${examples.dir}" destdir="${build.dest}" classpath="${class.path}" />
+ <javac srcdir="${examples.dir}" destdir="${build.dest}" classpath="${class.path}" debug="true" />
</target>
<!-- Creates the API documentation -->
@@ -139,7 +139,7 @@
<arg value="max.mini"/>
</java>
- <echo message="Faculty"/>
+ <echo message="Factorial"/>
<java classname="fac" classpath="${mini.dir}" />
<echo message="Fibonacci"/>
<java classname="fib" classpath="${mini.dir}" />
Modified: jakarta/bcel/trunk/xdocs/manual.xml
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/xdocs/manual.xml?rev=219362&r1=219361&r2=219362&view=diff
==============================================================================
--- jakarta/bcel/trunk/xdocs/manual.xml (original)
+++ jakarta/bcel/trunk/xdocs/manual.xml Sat Jul 16 17:53:03 2005
@@ -430,7 +430,7 @@
<section name="2.6 Code example">
<p>
The following example program prompts for a number and prints the
- faculty of it. The <tt>readLine()</tt> method reading from the
+ factorial of it. The <tt>readLine()</tt> method reading from the
standard input may raise an <tt>IOException</tt> and if a
misspelled number is passed to <tt>parseInt()</tt> it throws a
<tt>NumberFormatException</tt>. Thus, the critical area of code
@@ -440,7 +440,7 @@
<source>
import java.io.*;
- public class Faculty {
+ public class Factorial {
private static BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
@@ -460,7 +460,7 @@
public static void main(String[] argv) {
int n = readInt();
- System.out.println("Faculty of " + n + " is " + fac(n));
+ System.out.println("Factorial of " + n + " is " + fac(n));
}
}
</source>
@@ -479,7 +479,7 @@
9: iload_0
10: iconst_1
11: isub
- 12: invokestatic Faculty.fac (I)I (12)
+ 12: invokestatic Factorial.fac (I)I (12)
15: imul
16: ireturn
@@ -513,7 +513,7 @@
4: getstatic java.lang.System.out Ljava/io/PrintStream;
7: ldc "Please enter a number> "
9: invokevirtual java.io.PrintStream.print (Ljava/lang/String;)V
- 12: getstatic Faculty.in Ljava/io/BufferedReader;
+ 12: getstatic Factorial.in Ljava/io/BufferedReader;
15: invokevirtual java.io.BufferedReader.readLine ()Ljava/lang/String;
18: invokestatic java.lang.Integer.parseInt (Ljava/lang/String;)I
21: istore_0
@@ -981,7 +981,7 @@
<p>
Using instruction lists gives us a generic view upon the code: In
<a href="#Figure 5">Figure 5</a> we again present the code chunk
- of the <tt>readInt()</tt> method of the faculty example in section
+ of the <tt>readInt()</tt> method of the factorial example in section
<a href="#2.6 Code example">2.6</a>: The local variables
<tt>n</tt> and <tt>e1</tt> both hold two references to
instructions, defining their scope. There are two <tt>goto</tt>s
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.