CategorizedReal extends CategorizedLegend<Double> { @Override public Double remove(Double d){ if(d==null){ throw new NullPointerException("The input threshold must not be null"); } if(parameter instanceof RealLiteral){ return null; } else { Categorize2Real c2s = (Categorize2Real) parameter; RealParameter ret = c2s.remove(new RealLiteral(d)); if(ret == null){ return null; } else if(c2s.getNumClasses()==1 && c2s.getFallbackValue().equals(c2s.get(0))){ parameter = new RealLiteral(c2s.getFallbackValue().getValue(null)); } if(ret instanceof RealLiteral){ try{ return ret.getValue(null); } catch (ParameterException pe){ throw new IllegalStateException("We've failed at retrieved the value of a literal. " + "Something is going really wrong here."); } } else { throw new IllegalStateException("We're not supposed to have values that are not RealLiteral in this categorize."); } } } 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 testRemoveFromLiteral(){ CategorizedReal cs = new CategorizedReal(new RealLiteral(16.8)); assertNull(cs.remove(50.0)); assertNull(cs.remove(Double.NEGATIVE_INFINITY)); }
@Test public void testRemoveFromCat(){ CategorizedReal cs = new CategorizedReal(getCategorize2Real()); assertTrue(cs.remove(20.0).equals(24.0)); assertNull(cs.remove(20.0)); }