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

// -*-Mode: Java-*- 
// $Id: Body.java,v 1.2 2003/03/06 00:40:43 moltmans Exp $
// Body.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Wed May 10 15:07:21 2000> 
// Time-stamp: <2000-05-12 17:40:13 moltmans> 
package rec.annotate.rules;

import java.util.*;
import rec.annotate.*;
import rec.util.*;
import rec.sys.*;
import rec.core.widgets.*;
import rec.simulate.widgets.*;
import rec.tms.*;

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

  public Body( Surface s, WSimBody body, String name )
  {
    Assert.notNull( body, "Cannot make Body with null body" );
    m_surface = s;
    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 String toString() 
  {
    return "<Body: [" + Console.stripPackaging( m_body ) + "]>";
  }
}
