/** * Parses a given list of options. * * <p> * <!-- options-start --> * Valid options are: * * <p> * * <pre> -T <NUM|NOM|STR|DAT> * The type of attribute to create: * NUM = Numeric attribute * NOM = Nominal attribute * STR = String attribute * DAT = Date attribute * (default: NUM)</pre> * * <pre> -C <index> * Specify where to insert the column. First and last * are valid indexes.(default: last)</pre> * * <pre> -N <name> * Name of the new attribute. * (default: 'Unnamed')</pre> * * <pre> -L <label1,label2,...> * Create nominal attribute with given labels * (default: numeric attribute)</pre> * * <pre> -F <format> * The format of the date values (see ISO-8601) * (default: yyyy-MM-dd'T'HH:mm:ss)</pre> * * <!-- options-end --> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption('T', options); if (tmpStr.length() != 0) setAttributeType(new SelectedTag(tmpStr, TAGS_TYPE)); else setAttributeType(new SelectedTag(Attribute.NUMERIC, TAGS_TYPE)); tmpStr = Utils.getOption('C', options); if (tmpStr.length() == 0) tmpStr = "last"; setAttributeIndex(tmpStr); setAttributeName(Utils.unbackQuoteChars(Utils.getOption('N', options))); if (m_AttributeType == Attribute.NOMINAL) { tmpStr = Utils.getOption('L', options); if (tmpStr.length() != 0) setNominalLabels(tmpStr); } else if (m_AttributeType == Attribute.DATE) { tmpStr = Utils.getOption('F', options); if (tmpStr.length() != 0) setDateFormat(tmpStr); } if (getInputFormat() != null) { setInputFormat(getInputFormat()); } }
/** Creates a specialized Add */ public Filter getFilter(int pos) { Add af = new Add(); af.setAttributeIndex("" + (pos + 1)); return af; }