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

// -*-Mode: Java-*- 
// $Id: PropelsDecompRule.java,v 1.4 2005/02/17 21:40:57 moltmans Exp $
// PropelsToMotionsRule.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Thu May 18 19:12:27 2000> 
// Time-stamp: <2005-02-16 14:03:37 moltmans> 
package rec.annotate.rules;

import rec.annotate.facts.*;
import java.util.*;
import rec.util.*;
import rec.tms.*;
import rec.sys.*;

/**
 **/
public class PropelsDecompRule extends AnnotateRule
{

  public LinkedList getTriggers() 
  {
    LinkedList triggers = new LinkedList();
    triggers.add( Type.PROPELS_EVENT );
    return triggers;
  }

  public boolean match( LinkedList params ) 
  {
    return true;
  }

  public void run( Surface s, Notebook book, LinkedList params )
  {
    PropelsEvent event = (PropelsEvent)params.get(0);

    MotionEvent event1 = new MotionEvent( s, event.getBody1(), event);
    MotionEvent event2 = new MotionEvent( s, event.getBody2(), event);
    Causes causes = new Causes( event1, event2 );

    LinkedList list = new LinkedList();
    list.add( event1 );
    list.add( event2 );
    SubEvent subEvent = new SubEvent( event, list );

    book.myassert( event1, "PropelsDecompRule", params );
    book.myassert( event2, "PropelsDecompRule", params );

    params.add( event1 );
    params.add( event2 );
    
    book.myassert( causes, "PropelsDecompRule", params );
    book.myassert( subEvent, "PropelsDecompRule", params );
  }
}

