Region { public Number length() { if(cachedLength == null) { Number l = getMax() == null || getMin() == null ? null : getMax().doubleValue() - getMin().doubleValue(); if(l != null) { cachedLength = FastNumber.orNull(l); } } return cachedLength; } Region();  Region(Number v1, Number v2); static Region withDefaults(Region defaults); void setMinMax(Region region); static Number measure(Number v1, Number v2); Number length(); boolean contains(Number value); boolean intersects(Region region); Number center(); Number transform(double value, Region region2); Number transform(double value, Region region2, boolean flip); double transform(double value, double min, double max, boolean flip); Number ratio(Region r2); double ratio(double min, double max); void union(Number value); void union(Region input); void intersect(Region input); boolean intersects(Number line2Min, Number line2Max); boolean isMinSet(); Number getMin(); void setMin(Number min); boolean isMaxSet(); Number getMax(); void setMax(Number max); boolean isDefined(); @Override String toString();  }
@Test public void testLength() throws Exception { Region lr = new Region(0, 10); assertEquals(10d, lr.length().doubleValue(), 0); lr = new Region(-5, 5); assertEquals(10d, lr.length().doubleValue(), 0); }