public void addConfigurationParameter(ConfigurationParameter aConfigurationParameter) { ConfigurationParameter[] current = getConfigurationParameters(); ConfigurationParameter[] newArr = new ConfigurationParameter[current.length + 1]; System.arraycopy(current, 0, newArr, 0, current.length); newArr[current.length] = aConfigurationParameter; setConfigurationParameters(newArr); }
/** * Overridden to write the <code>names</code> property as an XML attribute. * * @see MetaDataObject_impl#getXMLAttributes() */ protected AttributesImpl getXMLAttributes() { AttributesImpl attrs = super.getXMLAttributes(); StringBuffer buf = new StringBuffer(); String[] names = getNames(); buf.append(names[0]); for (int i = 1; i < names.length; i++) { buf.append(' ').append(names[i]); } attrs.addAttribute("", "names", "names", "", buf.toString()); return attrs; }
/** * Called to add group to aggregate parm decl based on delegate group. * * @param group the delegate group needing to be added to the aggregate * @return the config group */ public ConfigGroup addGroup(ConfigGroup group) { String groupName = group.getName(); String[] groupNameArray = group.getNameArray(); if (group.getKind() == ConfigGroup.COMMON) { groupNameArray = getAllGroupNames(group.getCPD()); groupName = groupNameArrayToString(groupNameArray); } ConfigurationGroup cg = new ConfigurationGroup_impl(); cg.setConfigurationParameters(configurationParameterArray0); TreeItem item = addGroupToGUI(groupName, cg); // fill(commonParms, item); // don't add common parsm, they're added by definition addGroupToModel(cg); cg.setNames(groupNameArray); tree.setSelection(new TreeItem[] { item }); return new ConfigGroup(cpd, cg); }
/** * Overridden to read <code>names</code> property from XML attribute. * * @see org.apache.uima.util.XMLizable#buildFromXMLElement(org.w3c.dom.Element, * org.apache.uima.util.XMLParser) */ public void buildFromXMLElement(Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions) throws InvalidXMLException { String names = aElement.getAttribute("names"); if (names.length() == 0) { throw new InvalidXMLException(InvalidXMLException.REQUIRED_ATTRIBUTE_MISSING, new Object[] { "names", "configurationGroup" }); } // treat names as a space-separated list StringTokenizer tokenizer = new StringTokenizer(names, " \t"); List<String> nameList = new ArrayList<String>(); while (tokenizer.hasMoreTokens()) { nameList.add(tokenizer.nextToken()); } String[] nameArr = new String[nameList.size()]; nameList.toArray(nameArr); setNames(nameArr); // call superclass method to read the configurationParameters property super.buildFromXMLElement(aElement, aParser, aOptions); }
ConfigurationGroup cg = new ConfigurationGroup_impl(); cg.setConfigurationParameters(configurationParameterArray0); cg.setNames(groupNamesToArray(names));
public void removeConfigurationParameter(ConfigurationParameter aConfigurationParameter) { ConfigurationParameter[] current = getConfigurationParameters(); for (int i = 0; i < current.length; i++) { if (current[i] == aConfigurationParameter) { ConfigurationParameter[] newArr = new ConfigurationParameter[current.length - 1]; System.arraycopy(current, 0, newArr, 0, i); System.arraycopy(current, i + 1, newArr, i, current.length - i - 1); setConfigurationParameters(newArr); break; } } }