diff options
Diffstat (limited to 'tutorial/examples/order')
-rw-r--r-- | tutorial/examples/order/OrderKeeperClass.java | 65 | ||||
-rw-r--r-- | tutorial/examples/order/OrderKeeperClass.oj | 46 | ||||
-rw-r--r-- | tutorial/examples/order/Test.java | 21 | ||||
-rw-r--r-- | tutorial/examples/order/Test.oj | 12 |
4 files changed, 144 insertions, 0 deletions
diff --git a/tutorial/examples/order/OrderKeeperClass.java b/tutorial/examples/order/OrderKeeperClass.java new file mode 100644 index 0000000..90460b5 --- /dev/null +++ b/tutorial/examples/order/OrderKeeperClass.java @@ -0,0 +1,65 @@ +/* + * This code was generated by ojc. + */ +/* + * OrderKeeperClass.oj + * + */ +package examples.order; + + +import openjava.mop.*; +import openjava.ptree.ClassDeclaration; +import openjava.syntax.*; + + +public class OrderKeeperClass extends openjava.mop.OJClass +{ + + private static final java.lang.String DEPEND = "dependsOn"; + + public void translateDefinition() + throws openjava.mop.MOPException + { + openjava.mop.OJClass base = getDepended(); + System.out.println( "I'm " + getName() + ". " + "After You, " + base.getName() + "." ); + try { + waitTranslation( base ); + } catch ( java.lang.Exception e ) { + System.err.println( e.toString() ); + } + System.out.println( getName() + " is finished." ); + } + + private openjava.mop.OJClass getDepended() + throws openjava.mop.MOPException + { + return OJClass.forName( getSuffix( DEPEND ).toString() ); + } + + public static boolean isRegisteredKeyword( java.lang.String keyword ) + { + return keyword.equals( DEPEND ); + } + + public static openjava.syntax.SyntaxRule getDeclSuffixRule( java.lang.String keyword ) + { + return keyword.equals( DEPEND ) ? new openjava.syntax.TypeNameRule() : null; + } + + public java.lang.String toString() + { + return super.toString() + "(mc : OrderKeeper)"; + } + + public OrderKeeperClass( openjava.mop.Environment oj_param0, openjava.mop.OJClass oj_param1, openjava.ptree.ClassDeclaration oj_param2 ) + { + super( oj_param0, oj_param1, oj_param2 ); + } + + public OrderKeeperClass( java.lang.Class oj_param0, openjava.mop.MetaInfo oj_param1 ) + { + super( oj_param0, oj_param1 ); + } + +} diff --git a/tutorial/examples/order/OrderKeeperClass.oj b/tutorial/examples/order/OrderKeeperClass.oj new file mode 100644 index 0000000..dca208f --- /dev/null +++ b/tutorial/examples/order/OrderKeeperClass.oj @@ -0,0 +1,46 @@ +/*
+ * OrderKeeperClass.oj
+ *
+ */
+package examples.order;
+
+
+import openjava.mop.*;
+import openjava.ptree.ClassDeclaration;
+import openjava.syntax.*;
+
+
+public class OrderKeeperClass instantiates Metaclass extends OJClass
+{
+ private static final String DEPEND = "dependsOn";
+
+ public void translateDefinition() throws MOPException {
+ OJClass base = getDepended();
+ System.out.println( "I'm " + getName() + ". " +
+ "After You, " + base.getName() + "." );
+ try {
+ waitTranslation( base );
+ } catch ( Exception e ) {
+ System.err.println( e.toString() );
+ }
+
+ System.out.println( getName() + " is finished." );
+ }
+
+ private OJClass getDepended() throws MOPException {
+ return OJClass.forName( getSuffix( DEPEND ).toString() );
+ }
+
+ public static boolean isRegisteredKeyword( String keyword ) {
+ return keyword.equals( DEPEND );
+ }
+
+ public static SyntaxRule getDeclSuffixRule( String keyword ) {
+ return keyword.equals( DEPEND ) ? new TypeNameRule() : null;
+ }
+
+ public String toString() {
+ return super.toString() + "(mc : OrderKeeper)";
+ }
+
+}
diff --git a/tutorial/examples/order/Test.java b/tutorial/examples/order/Test.java new file mode 100644 index 0000000..3714254 --- /dev/null +++ b/tutorial/examples/order/Test.java @@ -0,0 +1,21 @@ +/* + * This code was generated by ojc. + */ +package examples.order; + + +public class Test +{ +} + + +class B +{ +} + + +//class C instantiates OrderKeeperClass dependsOn B {} + +class A +{ +} diff --git a/tutorial/examples/order/Test.oj b/tutorial/examples/order/Test.oj new file mode 100644 index 0000000..a4a00f1 --- /dev/null +++ b/tutorial/examples/order/Test.oj @@ -0,0 +1,12 @@ +package examples.order;
+
+public class Test instantiates OrderKeeperClass
+ dependsOn java.util.Vector
+{
+}
+
+
+class B instantiates OrderKeeperClass dependsOn A {}
+//class C instantiates OrderKeeperClass dependsOn B {}
+class A instantiates OrderKeeperClass dependsOn Test {}
+//class D instantiates OrderKeeperClass dependsOn C {}
|