CategorizedReal extends CategorizedLegend<Double> { public void setParameter(RealParameter param) { if(param instanceof RealLiteral){ parameter = param; fireTypeChanged(); } else if(param instanceof Categorize2Real){ RealParameter rp = ((Categorize2Real) param).getLookupValue(); if(rp instanceof RealAttribute){ parameter = param; field = ((RealAttribute) rp).getColumnName(); fireTypeChanged(); } else { throw new IllegalArgumentException("The given RealParameter instance can't be recognized as a " + "valid CategorizedReal."); } } else { throw new IllegalArgumentException("The given RealParameter instance can't be recognized as a " + "valid CategorizedReal."); } } 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 testFiredTypeEvent() throws Exception{ RealAttribute vf = new RealAttribute("height"); Categorize2Real c2s = new Categorize2Real(new RealLiteral(100.0),new RealLiteral(-15.0), vf); CategorizedReal cs = new CategorizedReal(c2s); DummyTypeListener tl = new DummyTypeListener(); cs.addListener(tl); cs.setParameter(new RealLiteral(252.252)); assertTrue(tl.count == 1); cs.setParameter(c2s); assertTrue(tl.count == 2); }