public Vector<String> getAttributeNames() { Vector<String> names = new Vector<>(); Vector<String> regularNames = new Vector<>(); MetaData metaData = getMetaData(); if (metaData != null) { if (metaData instanceof ExampleSetMetaData) { ExampleSetMetaData emd = (ExampleSetMetaData) metaData; for (AttributeMetaData amd : emd.getAllAttributes()) { if (!isFilteredOut(amd) && isOfAllowedType(amd.getValueType())) { if (amd.isSpecial()) { names.add(amd.getName()); } else { regularNames.add(amd.getName()); } } } } else if (metaData instanceof ModelMetaData) { ModelMetaData mmd = (ModelMetaData) metaData; ExampleSetMetaData emd = mmd.getTrainingSetMetaData(); if (emd != null) { for (AttributeMetaData amd : emd.getAllAttributes()) { if (!isFilteredOut(amd) && isOfAllowedType(amd.getValueType())) { if (amd.isSpecial()) { names.add(amd.getName()); } else { regularNames.add(amd.getName()); } } } } } } Collections.sort(names); Collections.sort(regularNames); names.addAll(regularNames); return names; }
@Override public ExampleSetMetaData applyOnFilteredMetaData(ExampleSetMetaData emd) { boolean round = getParameterAsBoolean(PARAMETER_ROUND); for (AttributeMetaData amd : emd.getAllAttributes()) { if ((Ontology.ATTRIBUTE_VALUE_TYPE.isA(amd.getValueType(), Ontology.NUMERICAL)) && (!Ontology.ATTRIBUTE_VALUE_TYPE.isA(amd.getValueType(), Ontology.INTEGER))) { amd.setType(Ontology.INTEGER); } if (round) { amd.setValueRange( new Range( Math.round(amd.getValueRange().getLower()), Math.round(amd.getValueRange().getUpper())), SetRelation.EQUAL); } else { amd.setValueRange( new Range((long) amd.getValueRange().getLower(), (long) amd.getValueRange().getUpper()), SetRelation.EQUAL); } } return emd; }