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

// -*-Mode: JDE-*- 
// $Id: Measurement.java,v 1.3 2003/03/06 00:40:49 moltmans Exp $
// Measurement.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Sat Jun 10 17:11:25 2000> 
// Time-stamp: <2000-07-19 17:06:46 moltmans> 
package rec.annotate.facts;

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

/**
 **/
public class Measurement extends Annotation
{
  protected Point m_point1;
  protected Point m_point2;

  public Measurement( Point point1, Point point2 )
  {
    super( Math.min( point1.getStartTime(), point2.getStartTime() ),
	   Math.max( point1.getEndTime(), point2.getEndTime() ) );
    m_point1 = point1;
    m_point2 = point2;
  }

  public Point getPoint1()
  {
    return m_point1;
  }

  public Point getPoint2()
  {
    return m_point2;
  }
  
  public String getFactType() 
  {
    return Type.MEASUREMENT;
  }
  
  public boolean sameFact( Fact fact ) 
  {
    if( fact instanceof Measurement ) {
      Measurement f = (Measurement)fact;
      return ( m_point1.sameFact( f.m_point1 ) &&
	       m_point2.sameFact( f.m_point2 ) );
    }
    return false;
  }
  
  public String toEnglish() 
  {
    return "measurement from " + m_point1 + " to " + m_point2;
  }

  public String toString() 
  {
    return "<Measurement: [" + m_point1 + "] [" + m_point2 + "]>";
  }
}
