// (c) MIT 2003.  All rights reserved.

// $Id: FlipAlterTransition.java,v 1.4 2003/03/06 00:40:40 moltmans Exp $
// Time-stamp: <2000-03-11 18:59:36 moltmans>
package rec.sys;


////////////////////////////////////////////////////////////////////////////////
//
// FILE:	FlipAlterTransition.java

// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:	Drawing recognition
//
//////////////////////////////////////////////////////////////////////////////


import rec.util.*;

/**
 * This is a utility Transition.  It allows for a different kind of
 * method.
 *
 * need to override doUndo() and doRedo()
 */
public abstract class FlipAlterTransition extends AlterTransition
{
  protected boolean flipped;

  /**
   * use this to create the FlipAlterTransition
   */
  public FlipAlterTransition( Surface s, VisibleWidget targetWidget )
  {
    super( s, targetWidget );

    flipped = false;
  }

  /////////////////////////////////////////////////////////////////////////////

  // get rid of this stuff once we see that it works

//    /**
//     * Make the transition which undoes this one and return it.
//     */
//    protected Transition makeRedoTransition( )
//    {
//      final FlipAlterTransition internal = this;;

//      Assert.check( internal.flipped == false,
//  		  "double flip bad" );

//      FlipAlterTransition t = new FlipAlterTransition( getSurface(),
//  						     getTargetWidget() )    {
      
//        public void doUndo( )
//  	{
//  	  internal.doRedo();
//  	}
//        public void doRedo()
//  	{
//  	  internal.doUndo();
//  	}
//        public String name()
//  	{
//  	  return internal.name();
//  	}

//      };
//      t.flipped = true;

//      return t;
//    }

//    public abstract void doRedo( );

//    public abstract String name();

  public String getAction()
  {
    return "alters the state of widget " + m_TargetWidget;
  }
  
  
  public String toString( )
  {
    return name() + ( flipped ? "Flip/a-" : "-" ) + getId();
  }

}

