package yi.ds;

/**
 * Class DataRange is to represent data ranges.  E.g. [0,256).  The data range
 * is to represent the range from [lowerBound, higherBound)
 */
public class DataRange extends java.awt.Point{

  public DataRange(int lower_bound, int higher_bound) {
    super(lower_bound, higher_bound);
  }

  public int getLowerBound() {
    return x;
  }

  public int getHigherBound() {
    return y;
  }

  public boolean fallIn(int data) {
    if (x <= y) {
      return data >= x && data < y;
    } else { // in the circular data situation. eg. angle
      return data >= x || data < y;
    }
  }

  // shift the data range
  public void shift(int shift) {
    x += shift; y += shift;
  }
}