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

// $Id: Resolver.java,v 1.8 2003/04/16 18:34:20 rebecca8 Exp $
// Time-stamp: <2000-03-11 18:59:37 moltmans>
package rec.sys;



import java.io.*;
import java.util.*;
import rec.util.*;

public abstract class Resolver implements Serializable
{
  public Resolver()
  {
    m_Id = new Id();
  }

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

  /**
   * Called by Surface after recognition is done.  Finds a representative
   * widget for the squiggle just added and elects it (and if necesary
   * changes the representation of other squiggles).
   *
   * @param w   The last thing added to the Surface, the root Widget
   *     which caused recognition to begin again.
   */
  public Collection resolve( Surface s, Widget w, OrderGraph g )
  {
    return resolve( s, w, false, g );
  }
  
  public Collection resolve(Surface s, Widget w, boolean retry, OrderGraph g){
     return resolve( s, w, retry, g, new Vector());
  }

  public abstract Collection resolve( Surface s, Widget w, boolean retry,
				OrderGraph g, Vector newWidgets );

  public abstract Collection findRepresentatives( Widget w );

  public Collection getLastElects()
  {
    return null;
  }

  public abstract Collection getLastRelatedElects( Widget w );
  
  /**
   * @return the name of the Recognizer
   */
  public final String toString()
  {
    return( getClass().getName() );
  }

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

  public final Id getId()
  {
    return( m_Id );
  }

  public final boolean equals( Resolver r )
  {
    return( m_Id.equals( r.m_Id ) );
  }

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

  private Id m_Id;
}

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