// Flier.java [dynamic]
interface Flier {
  public void Fly(int x, int y, int altitude);
  void Takeoff();
  void Ascend();
  boolean ThereYet(int x, int y);
  void FlapTowards(int x, int y);
  void Descend();
  void Land();
}
// Flier$Ego.java [dynamic]
public class Flier$Ego 
{
  // upstream interface. Must implement.
  public void Fly(Flier host, int x, int y, 
                  int altitude) {
    resetMetersFlown();
    host.Takeoff();
    for (int a=0; a < altitude; a++) host.Ascend();
    while( !host.ThereYet(x, y) ) host.FlapTowards(x, y);
    for(int a = altitude; a > 0; a--) host.Descend();
    host.Land();
  }
  // private functions. Must implement.
  private void resetMetersFlown() { meters_flown = 0; }
  // attributes (specific to the role)
  private float meters_flown;
  // constructor (optional)
  Flier$Ego( Shrink shrink ) { 
    resetMetersFlown(); 
    shrink.register_personality( "Flier" );
  }
}

// Swimmer.java [dynamic]
interface Swimmer
{
  public void Swim(int miles, int depth);
  void JumpInTheWater();
  void Submerge();
  void MoveFin();
  void Rise();
  void JumpOutOfTheWater();
}
  
// Swimmer$Ego.java [dynamic]
public class  Swimmer$Ego
{
  public void Swim(Swimmer host, int miles, int depth) {
    host.JumpInTheWater();
    for (int d = 0; d < depth; d++)
      host.Submerge();
    while ((miles--) > 0) host.MoveFin();
    for(int d = depth; d > 0; d--)
      host.Rise();
    host.JumpOutOfTheWater();
  }
  public Swimmer$Ego(Shrink shrink) 
  { shrink.register_personality( "Swimmer" ); }
}
  
// Walker.java [dynamic]
interface Walker
{
  public void Walk(int distance);
  void Prepare();
  int NumberOfFeet();
  void MoveFoot(int feetno);
  void Stabilize();
  void AtEase();
}
// Walker$Ego.java [dynamic]
public class  Walker$Ego
{
  public void Walk(Walker host, int distance) {
    host.Prepare();
    while( (distance--) > 0 ) {
      for (int f = 0; f < host.NumberOfFeet(); f++)
	host.MoveFoot(f);
      host.Stabilize();
    }
    host.AtEase();
  }
  public Walker$Ego(Shrink shrink) {
    shrink.register_personality( "Walker" );
  }
}
// Jumper.java [dynamic]
interface Jumper
{
  void Jump(int x, int y, int alt);
  boolean CheckDistance(int x, int y);
  void SprintTo(int x, int y);
  void LiftOff(int alt);
  void Land();
}
  
// Jumper$Ego.java [dynamic]
public class Jumper$Ego
{
  void Jump(Jumper host, int x, int y, int alt) {
    if ( host.CheckDistance(x, y) ) {
      host.SprintTo( x, y );
      host.LiftOff( alt );
      host.Land();
    }
  }
  public Jumper$Ego(Shrink shrink)
  { shrink.register_personality( "Jumper" ); }
}
  
