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

// -*-Mode: Java-*- 
// $Id: Balances.java,v 1.3 2003/03/06 00:40:49 moltmans Exp $
// Balances.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Tue May 23 16:50:14 2000> 
// Time-stamp: <2000-07-19 16:49:46 moltmans> 
package rec.annotate.facts;

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

/**
 **/
public class Balances extends Annotation
{
  protected Lever m_body;
  protected Collection m_forces;

  public Balances( Lever body, Collection forces )
  {
    super( Annotation.getMinTime( forces ),
	   Annotation.getMaxTime( forces ) );
    m_body = body;
    m_forces = new LinkedList( forces );
  }

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

  public boolean sameFact( Fact fact ) 
  {
    if( fact instanceof Balances ) {
      Balances f = (Balances)fact;
      return ( m_body.sameFact( f.m_body ) &&
	       Annotation.sameFacts( m_forces, f.m_forces ) );
    }
    return false;
  }

  public String toEnglish() 
  {
    return m_body.toEnglish() + " is balanced by " + m_forces;
  }

  public String toString() 
  {
    return "<Balances: [" + m_body + "] [" + m_forces + "]>";
  }
}
