/** * Intersects the ith component of this box with another interval. * * @return true iff the intersection is nonempty */ public boolean setToInter(int i, Interval x) { // if (x.isEmpty()) { setToEmpty(); return false; } // if (isEmpty()) return false; comp.get(i).setToInter(x); if (comp.get(i).isEmpty()) { setToEmpty(); return false; } return true; }
/** * Assign the ith component to [lb,ub], unless the box was empty in which case the ith component * remains the empty interval. */ private void set(int i, double lb, double ub) { if (!isEmpty()) { comp.get(i).set(lb, ub); if (comp.get(i).isEmpty()) setToEmpty(); } }