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

// -*-Mode: Java-*- 
// $Id: Body.java,v 1.3 2003/03/06 00:40:49 moltmans Exp $
// Body.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Wed May 10 15:07:21 2000> 
// Time-stamp: <2000-07-19 16:55:12 moltmans> 
package rec.annotate.facts;

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

/**
 * This class is for storing information about bodies
 **/
public class Body extends Annotation
{
  protected WSimBody m_body;
  protected String m_name;

  public Body( WSimBody body, String name )
  {
    super( body.getTime(), body.getTime() );
    Assert.notNull( body, "Cannot make Body with null body" );
    m_body = body;
    m_name = name;
  }

  public WSimBody getBody()
  {
    return m_body;
  }

  public String getName() 
  {
    return m_name;
  }

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

  public boolean sameFact( Fact fact ) 
  {
    if( fact instanceof Body ) {
      Body body = (Body)fact;
      return ( m_body.equals( body.m_body ) &&
	       m_name.equals( body.m_name ) );
    }
    return false;
  }

  public boolean isAnchored() 
  {
    return m_body.isAnchored();
  }

  public String toEnglish() 
  {
    return m_name;
  }
  
  public String toString() 
  {
    return "<Body: [" + m_name + "]>";
  }
}
