CategorizedLegend implements AbstractAttributeLegend, ParameterLegend { public void setField(String field) { this.field = field; SeParameter c = getParameter(); if(c instanceof Categorize){ RealParameter lookupValue = ((Categorize) c).getLookupValue(); if(lookupValue instanceof RealAttribute){ ((RealAttribute) lookupValue).setColumnName(field); } } }  @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 testSetField(){ CategorizedString cs = new CategorizedString(new StringLiteral("youhou")); assertTrue(cs.getField().equals("")); cs.setField("potato"); assertTrue(cs.getField().equals("potato")); RealAttribute vf = new RealAttribute("height"); Categorize2String c2s = new Categorize2String(new StringLiteral("youhou"),new StringLiteral("fallback"), vf); cs = new CategorizedString(c2s); assertTrue(cs.getField().equals("height")); cs.setField("new"); assertTrue(cs.getField().equals("new")); assertTrue(vf.getColumnName().equals("new")); }