/**
 * Class to test what sort of communication between
 * inner, nested and outer classes are legal.
 * This experiment does not explore access to local variables
 * when a possibly anonymous class is defined in the middle of a method.
 * @author Roedy Green
 */
public class Outer
   {

   static int osi = 1;
   int oii = 2;

   final static int fosi = 2;
   final int foii = 4;

   static int osm()
      {
      return 5;
      }

   int oim()
      {
      return 6;
      }

   class Inner
      {
      void iim()
         {
         // get
         int i = 7;
         i = osi;
         i = oii;
         i = fosi;
         i = foii;
         i = osm();
         i = oim();
         i = Outer.osi;
         i = Outer.this.oii;
         i = Outer.fosi;
         i = Outer.this.foii;
         i = Outer.osm();
         i = Outer.this.oim();

         // set
         osi = i;
         oii = i;
         Outer.osi = i;
         Outer.this.oii = i;
         }

      // no static methods or variables allowed
      int ii = 8;

      } // end Inner

   static class Nested
      {
      // instance methods in static inner classes are fine.
      // There is no associated outer class object.
      void iim()
         {
         // get
         int i = 9;

         i = osi;
         i = fosi;
         i = osm();
         i = Outer.osi;
         i = Outer.fosi;
         i = Outer.osm();

         // set
         osi = i;
         Outer.osi = i;

         // There is no associated Outer object
         // Illegal forms:
         // i = oii;
         // i = foii;
         // i = oim();
         // i = Outer.this.oii;
         // i = Outer.this.foii;
         // i = Outer.this.oim();
         // oii = i;
         // Outer.this.oii = i;
         }

      static void ism()
         {
         // get
         int i = 42;
         i = osi;
         i = fosi;
         i = osm();
         i = Outer.osi;
         i = Outer.fosi;
         i = Outer.osm();

         // set
         osi = i;
         Outer.osi = i;

         // There is no associated Outer object
         // illegal forms:
         // i = oii;
         // i = foii;
         // i = oim();
         // i = Outer.this.oii;
         // i = Outer.this.foii;
         // i = Outer.this.oim();
         // oii = i;
         // Outer.this.oii = i;
         }
      // static nested classes may have instance or static variables.
      int ni = 10;
      static int nis = 11;
      } // end Nested

   } // end Outer