diff options
Diffstat (limited to 'tutorial/examples/verbose')
-rw-r--r-- | tutorial/examples/verbose/Hello.java | 22 | ||||
-rw-r--r-- | tutorial/examples/verbose/Hello.oj | 13 | ||||
-rw-r--r-- | tutorial/examples/verbose/Test.java | 98 | ||||
-rw-r--r-- | tutorial/examples/verbose/Test.oj | 73 | ||||
-rw-r--r-- | tutorial/examples/verbose/VerboseClass.java | 45 | ||||
-rw-r--r-- | tutorial/examples/verbose/VerboseClass.oj | 30 |
6 files changed, 281 insertions, 0 deletions
diff --git a/tutorial/examples/verbose/Hello.java b/tutorial/examples/verbose/Hello.java new file mode 100644 index 0000000..4f6cebb --- /dev/null +++ b/tutorial/examples/verbose/Hello.java @@ -0,0 +1,22 @@ +/* + * This code was generated by ojc. + */ +package examples.verbose; + + +public class Hello +{ + + public static void main( java.lang.String[] argv ) + { + java.lang.System.out.println( "public static void examples.verbose.Hello.main(java.lang.String[]) was called" ); + hello(); + } + + static void hello() + { + java.lang.System.out.println( "static void examples.verbose.Hello.hello() was called" ); + System.out.println( "Hello, world." ); + } + +} diff --git a/tutorial/examples/verbose/Hello.oj b/tutorial/examples/verbose/Hello.oj new file mode 100644 index 0000000..0267289 --- /dev/null +++ b/tutorial/examples/verbose/Hello.oj @@ -0,0 +1,13 @@ +package examples.verbose;
+
+
+public class Hello instantiates VerboseClass
+{
+ public static void main(String[] argv) {
+ hello();
+ }
+
+ static void hello() {
+ System.out.println("Hello, world.");
+ }
+}
diff --git a/tutorial/examples/verbose/Test.java b/tutorial/examples/verbose/Test.java new file mode 100644 index 0000000..7b60da7 --- /dev/null +++ b/tutorial/examples/verbose/Test.java @@ -0,0 +1,98 @@ +/* + * This code was generated by ojc. + */ +package examples.verbose; + + +import java.awt.Panel; +import java.util.*; +import java.io.PrintStream; + + +public class Test extends java.awt.Panel +{ + + private int iii = 0; + + private examples.verbose.Test n = null; + + private java.lang.String str = "string"; + + public Test() + { + super(); + } + + /** + * @param + * @return + * @exception + * @see java.lang.Object + */ + public static void main( java.lang.String[] argv ) + { + java.lang.System.out.println( "public static void examples.verbose.Test.main(java.lang.String[]) was called" ); + java.io.PrintStream out = System.out; + java.io.PrintStream error = java.lang.System.err; + out.println( "Hello" + " " + "World" ); + examples.verbose.Test n = new examples.verbose.Test(); + java.lang.System.err.println( "done. " ); + examples.verbose.Test test = new examples.verbose.Test(); + test.hoge(); + test.foo(); + } + + public void hoge() + { + java.lang.System.out.println( "public void examples.verbose.Test.hoge() was called" ); + examples.verbose.Local l = new examples.verbose.Local(); + System.out.println( l.foo ); + System.out.println( l.bar.str ); + } + + public Test( java.lang.String str ) + { + this.str = str; + n = null; + } + + public int foo() + { + java.lang.System.out.println( "public int examples.verbose.Test.foo() was called" ); + return iii; + } + + public java.lang.String toString() + { + java.lang.System.out.println( "public java.lang.String examples.verbose.Test.toString() was called" ); + if (n == null) { + return str; + } + return str + n; + } + +} + + +class Local +{ + + java.lang.String foo = null; + + examples.verbose.Local2 bar = new examples.verbose.Local2(); + + public final java.lang.String getFoo( java.lang.Integer i ) + { + java.lang.System.out.println( "public final java.lang.String examples.verbose.Local.getFoo(java.lang.Integer) was called" ); + return foo; + } + +} + + +class Local2 +{ + + java.lang.String str = "" + "TEST"; + +} diff --git a/tutorial/examples/verbose/Test.oj b/tutorial/examples/verbose/Test.oj new file mode 100644 index 0000000..24de2ea --- /dev/null +++ b/tutorial/examples/verbose/Test.oj @@ -0,0 +1,73 @@ +package examples.verbose;
+
+
+import java.awt.Panel;
+import java.util.*;
+import java.io.PrintStream;
+
+
+public class Test instantiates VerboseClass
+ extends Panel
+{
+ private int iii = 0;
+
+ private Test n = null;
+
+ private String str = "string";
+
+ public Test() {
+ super();
+ }
+
+ /**
+ * @param
+ * @return
+ * @exception
+ * @see java.lang.Object
+ */
+ public static void main( String[] argv ) {
+ PrintStream out = System.out;
+ PrintStream error = java.lang.System.err;
+ out.println( "Hello" + " " + "World" );
+ Test n = new Test();
+ java.lang.System.err.println( "done. " );
+ Test test = new Test();
+ test.hoge();
+ test.foo();
+ }
+
+ public void hoge() {
+ Local l = new Local();
+ System.out.println( l.foo );
+ System.out.println( l.bar.str );
+ }
+
+ public Test( String str ) {
+ this.str = str;
+ n = null;
+ }
+
+ public int foo() {
+ return iii;
+ }
+
+ public String toString() {
+ if (n == null) return str;
+ return str + n;
+ }
+
+}
+
+class Local instantiates VerboseClass
+{
+ String foo = null;
+ Local2 bar = new Local2();
+ public final String getFoo( Integer i ) {
+ return foo;
+ }
+}
+
+class Local2
+{
+ String str = "" + "TEST";
+}
diff --git a/tutorial/examples/verbose/VerboseClass.java b/tutorial/examples/verbose/VerboseClass.java new file mode 100644 index 0000000..ef74480 --- /dev/null +++ b/tutorial/examples/verbose/VerboseClass.java @@ -0,0 +1,45 @@ +/* + * This code was generated by ojc. + */ +/* + * VerboseClass.java + * + * @author Michiaki Tatsubori + * @version %VERSION% %DATE% + * @see java.lang.Object + * + * COPYRIGHT 1999 by Michiaki Tatsubori, ALL RIGHTS RESERVED. + */ +package examples.verbose; + + +import openjava.mop.*; +import openjava.ptree.*; +import openjava.syntax.*; + + +public class VerboseClass extends openjava.mop.OJClass +{ + + /* overrides for translation */ + public void translateDefinition() + throws openjava.mop.MOPException + { + openjava.mop.OJMethod[] methods = getDeclaredMethods(); + for (int i = 0; i < methods.length; ++i) { + openjava.ptree.Statement printer = makeStatement( "java.lang.System.out.println( \"" + methods[i].toString() + " was called\" );" ); + methods[i].getBody().insertElementAt( printer, 0 ); + } + } + + public VerboseClass( openjava.mop.Environment oj_param0, openjava.mop.OJClass oj_param1, openjava.ptree.ClassDeclaration oj_param2 ) + { + super( oj_param0, oj_param1, oj_param2 ); + } + + public VerboseClass( java.lang.Class oj_param0, openjava.mop.MetaInfo oj_param1 ) + { + super( oj_param0, oj_param1 ); + } + +} diff --git a/tutorial/examples/verbose/VerboseClass.oj b/tutorial/examples/verbose/VerboseClass.oj new file mode 100644 index 0000000..a6ac099 --- /dev/null +++ b/tutorial/examples/verbose/VerboseClass.oj @@ -0,0 +1,30 @@ +/*
+ * VerboseClass.java
+ *
+ * @author Michiaki Tatsubori
+ * @version %VERSION% %DATE%
+ * @see java.lang.Object
+ *
+ * COPYRIGHT 1999 by Michiaki Tatsubori, ALL RIGHTS RESERVED.
+ */
+package examples.verbose;
+
+
+import openjava.mop.*;
+import openjava.ptree.*;
+import openjava.syntax.*;
+
+
+public class VerboseClass instantiates Metaclass extends OJClass
+{
+ /* overrides for translation */
+ public void translateDefinition() throws MOPException {
+ OJMethod[] methods = getDeclaredMethods();
+ for (int i = 0; i < methods.length; ++i) {
+ Statement printer = makeStatement(
+ "java.lang.System.out.println( \"" +
+ methods[i].toString() + " was called\" );" );
+ methods[i].getBody().insertElementAt( printer, 0 );
+ }
+ }
+}
|