CategorizedString extends CategorizedLegend<String> { @Override public String get(Double d){ if(parameter instanceof StringLiteral){ return Double.isInfinite(d) && d < 0 ? ((StringLiteral) parameter).getValue(null) : null; } else { try{ StringParameter sp = ((Categorize2String)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); } } } CategorizedString(StringParameter sp); @Override SeParameter getParameter(); void setParameter(StringParameter param); String getFallbackValue(); void setFallbackValue(String value); @Override String get(Double d); @Override void put(Double d, String v); @Override String remove(Double d); @Override String getFromLower(Double d);  }
@Test public void testGetFromCategorize(){ CategorizedString cs = new CategorizedString(getCategorize2String()); assertTrue(cs.get(20.0).equals("Greater")); assertTrue(cs.get(Double.NEGATIVE_INFINITY).equals("youhou")); assertNull(cs.get(25.0)); assertTrue(cs.get(30.0).equals("EvenGreater")); cs = new CategorizedString(new StringLiteral("yo")); assertNull(cs.get(25.0)); assertTrue(cs.get(Double.NEGATIVE_INFINITY).equals("yo")); }