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

// -*-Mode: Java-*- 
// $Id: ExternalAction.java,v 1.3 2003/03/06 00:40:49 moltmans Exp $
// ExternalAction.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Fri Jun 02 14:12:07 2000> 
// Time-stamp: <2000-07-19 17:06:13 moltmans> 
package rec.annotate.facts;

import rec.annotate.rules.*;
import java.util.*;
import rec.annotate.widgets.*;
import rec.util.*;
import rec.sys.*;
import rec.tms.*;

/**
 * This class is for storing information about external actions
 * such as the user or a driving force.
 **/
public class ExternalAction extends Annotation
{
  protected Event m_event;
  protected Annotation m_base;

  public ExternalAction( Event event, Annotation base )
  {
    super( event.getStartTime(), event.getEndTime() );
    m_event = event;
    m_base = base;
  }
  
  public Annotation getBase()
  {
    return m_base;
  }

  public Event getEvent()
  {
    return m_event;
  }

  public String getFactType() 
  {
    return Type.EXTERNAL_ACTION;
  }

  public boolean sameFact( Fact fact ) 
  {
    if( fact instanceof ExternalAction ) {
      ExternalAction f = (ExternalAction)fact;
      return ( m_base.sameFact( f.m_base ) &&
	       m_event.sameFact( f.m_event ) );
    }
    return false;
  }

  public String toEnglish() 
  {
    return m_event.toEnglish() + " is an external action";
  }

  public String toString() 
  {
    return( "<ExternalAction: " + m_event + ">" );
  }
}
