CategorizedLegend implements AbstractAttributeLegend, ParameterLegend { @Override public ValueReference getValueReference() { SeParameter c = getParameter(); if(c instanceof Categorize){ RealParameter ret = ((Categorize) c).getLookupValue(); if(ret instanceof ValueReference){ return (ValueReference) ret; } else { throw new ClassCastException("We're not working with an authorized Categorize instance"); } } return null; }  @Override ValueReference getValueReference(); @Override String getLookupFieldName(); @Override void setLookupFieldName(String name); String getField(); void setField(String field); abstract U get(Double d); abstract U remove(Double d); abstract void put(Double d, U val); abstract U getFromLower(Double d); Set<Double> getKeys(); void addListener(TypeListener l); void fireTypeChanged(); void acceptVisitor(CategorizedParameterVisitor cpv);  }
@Test public void testValueReference(){ RealAttribute vf = new RealAttribute("height"); Categorize2String c2s = new Categorize2String(new StringLiteral("youhou"),new StringLiteral("fallback"), vf); CategorizedString cs = new CategorizedString(c2s); assertTrue(cs.getValueReference() == vf); }
@Test public void testNullValueReference(){ CategorizedString cs = new CategorizedString(new StringLiteral("youhou")); assertNull(cs.getValueReference()); }