CategorizedReal extends CategorizedLegend<Double> { @Override public Double get(Double d){ if(parameter instanceof RealLiteral){ return Double.isInfinite(d) && d < 0 ? ((RealLiteral) parameter).getValue(null) : null; } else { try{ RealParameter sp = ((Categorize2Real)parameter).get(new RealLiteral(d)); return sp == null ? null : sp.getValue(null); } catch (ParameterException pe){ throw new IllegalArgumentException("Can't process the input value: "+d, pe); } } } CategorizedReal(RealParameter sp); @Override SeParameter getParameter(); void setParameter(RealParameter param); Double getFallbackValue(); void setFallbackValue(Double value); @Override Double get(Double d); @Override void put(Double d, Double v); @Override Double remove(Double d); @Override Double getFromLower(Double d);  }
@Test public void testGetFromCategorize(){ CategorizedReal cs = new CategorizedReal(getCategorize2Real()); assertTrue(cs.get(20.0).equals(24.0)); assertTrue(cs.get(Double.NEGATIVE_INFINITY).equals(100.0)); assertNull(cs.get(25.0)); assertTrue(cs.get(30.0).equals(0.1)); cs = new CategorizedReal(new RealLiteral(16.8)); assertNull(cs.get(25.0)); assertTrue(cs.get(Double.NEGATIVE_INFINITY).equals(16.8)); }