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

package rec.fun;

import java.util.*;
import java.awt.*;
import rec.util.*;
import rec.geo.*;
import rec.sys.*;

public class QuestionRecognizer extends Recognizer
{


  public QuestionRecognizer()
  {
  }

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

  public boolean recognize( Surface s, Widget w )
  {
    Grid g = new Grid( s, (Squiggle)w );

    if ( g.missAt( 1,2 ) && g.missAt( 2,2 ) 
	 && g.missAt( 4,3 ) && g.missAt(4,4)
	 && g.hitAt( 2,1 ) && g.hitAt( 2,3 ) )
      {
	Question q = new Question( s, (Squiggle)w );
	s.replaceWidget( w, q );

	return true;
      }

    return false;
  }

  public Iterator getInputTypes()
  {
    Vector v = new Vector();

    v.addElement( "rec.sys.Squiggle" );

    return( v.iterator() );
  }

  public Iterator getOutputTypes()
  {
    Vector v = new Vector();

    v.addElement( "rec.fun.Grid" );

    return( v.iterator() );
  }
}

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