<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/** Numeric interval -- closed intervals
 */
class Interval {

  private double base;  // low end
  private double width; // interval width
   
  /** Constructor: An Interval has a specified base and width w */
  public Interval(double base, double w) {
    this.base= base;
    setWidth(w);
  }
  
  /** =Get right end of this Interval */
  public double getEnd() { return base + width; }
  
  /** =Get base of this Interval */
  public double getBase() { return base; }
  
  /** Set width of this Interval to w */
  public void setWidth(double w) { width= w; }
  
  /** Expand this Interval by a factor of f (expand to the right) */
  public void expand(double f) {
    setWidth(width*f);
  }

  /** ={This Interval is in Interval i}
   *  If the ends of this Interval and i are exactly equal, consider
   *  this Interval to be in i.
   */
  public boolean isIn(Interval i) {
    return ( getBase()&gt;=i.getBase() &amp;&amp; getEnd()&lt;=i.getEnd() );
  }

  /** =String description of this Interval */
  public String toString(){
    return "[" + getBase() + "," + getEnd() + "]";
  }
  
} //class Interval

</pre></body></html>