Width { public Width adjust(final Width that) { final int min = Math.max(this.min, that.min); final int max = Math.max(this.max, that.max); return new Width(min, max); } Width(final int min, final int max); Width toMin(); Width toMax(); static Width ofString(final String string); Width adjust(final Width that); Width add(final Width that); Width subtract(final Width that); int getMin(); int getMax(); @Override String toString(); static final Width ZERO; }
@Test public void adjust() { final Width a = new Width(3, 10); final Width b = new Width(7, 8); final Width c = a.adjust(b); assertEquals(7, c.getMin()); assertEquals(10, c.getMax()); }