File: CSimple.java

package info (click to toggle)
smarteiffel 1.1-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,288 kB
  • ctags: 40,785
  • sloc: ansic: 35,791; lisp: 4,036; sh: 1,783; java: 895; ruby: 613; python: 209; makefile: 115; csh: 78; cpp: 50
file content (91 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* CSimple.java */

import example5._any;
import example5.example5;

class CSimple
{
	
   public static void main( java.lang.String[] args )
   {
      
// initialize the Eiffel runtime
      
		java.lang.String a[] = new java.lang.String[0]; // no command line args
		_any._initialize_eiffel_runtime( a );

// create an instance of example5

		example5 theE = new example5();
		
// note that the Eiffel creation procedure has not been called, and that 
// Eiffel object attributes can be read and written from Java

 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );
 		theE.eiffel_integer = 2;
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );

// now call the Eiffel creation procedure

		theE.make();
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );

// create an instance of CSimple

      CSimple csimple = new CSimple();
      
// call the proc1 procedure with argument 13

      csimple.proc1( theE, 13 );
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );

// call the proc1 procedure with argument -11

      csimple.proc1( theE, -11 );
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );
      
// call the proc2 procedure with argument 13

      csimple.proc2( theE, 103 );
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );

// call the proc2 procedure with argument -11

      csimple.proc2( theE, -101 );
 		System.out.println( "value of example5.eiffel_integer: " + theE.eiffel_integer );
//      
 		System.out.println( "main() in CSimple ended." );
   }

   public CSimple()
   {
   }


   public void proc1( example5 theE, int i )
   {
      try
      {
         theE.proc1( i );
      }
      catch ( java.lang.Exception e )
      {
   		System.out.println( "Exception was thrown: " + e.getMessage() );
      }
   }
   
   public void proc2( example5 theE, int i )
   {
      try
      {
         theE.proc2( i );
      }
      catch ( java.lang.Exception e )
      {
   		System.out.println( "Exception was thrown: " + e.getMessage() );
      }
   }
   
}

/* End of file */