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

// -*-Mode: Java-*- 
// $Id: SimPulleyReasoner.java,v 1.4 2003/03/06 00:40:41 moltmans Exp $
// SimPulleyReasoner.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Mon May 22 21:50:23 2000> 
// Time-stamp: <2000-05-30 10:48:37 moltmans> 
package rec.simulate.reasoners;

import java.util.*;
import rec.util.*;
import rec.sys.*;
import rec.simulate.widgets.*;

public class SimPulleyReasoner extends Reasoner 
{
  public Iterator getStrongerTypes()
  {
    Vector v = new Vector();
    v.addElement( "rec.simulate.widgets.WSimPulley" );
    return v.iterator();
  }

  public Iterator getWeakerTypes()
  {
    Vector v = new Vector();
    v.addElement( "rec.simulate.widgets.WSimObject" );
    //    v.addElement( "rec.simulate.widgets.WSimBody" );
    //    v.addElement( "rec.simulate.widgets.WSimPinJoint" );
    return v.iterator();
  }

  public boolean match( Surface s, Widget stronger, Widget weaker )
  {
      // if both are pulleys, the stronger one is the one
      // with more wheels
      if((weaker instanceof WSimPulley) &&
	 (stronger instanceof WSimPulley)){
	  
	  if(((WSimPulley)weaker).getNumWheels() 
	     < ((WSimPulley)stronger).getNumWheels()){
      	      return true;
	  }
	  else{
      	      return false;
	  }
      }
      else{
      	  return !( weaker instanceof WSimPulley );
      }
  }
  

}


