当前位置: 首页>>代码示例>>Java>>正文


Java XMLImporter类代码示例

本文整理汇总了Java中com.rapidminer.io.process.XMLImporter的典型用法代码示例。如果您正苦于以下问题:Java XMLImporter类的具体用法?Java XMLImporter怎么用?Java XMLImporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLImporter类属于com.rapidminer.io.process包,在下文中一共展示了XMLImporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeTextFile

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
public static void writeTextFile(File file, String text) throws IOException {
	// ! THIS IS TO PREVENT A JAVA PROBLEM (BUG?) ON WINDOWS NTFS FILESYSTEM !
	// If the filename is something like C:\path\x:y.z, new FileOutputStream(file) will throw NO
	// error
	// but the result will be an EMPTY file C:\path\x and you never know it failed
	// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4645046
	if (file == null || !canFileBeStoredOnCurrentFilesystem(file.getName())) {
		throw new FileNotFoundException(I18N.getMessage(I18N.getErrorBundle(), "repository.illegal_entry_name",
				file == null ? "null" : file.getName()));
	}

	FileOutputStream outStream = new FileOutputStream(file);
	try {
		if (text != null) {
			outStream.write(text.getBytes(XMLImporter.PROCESS_FILE_CHARSET));
		}
	} finally {
		outStream.close();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:Tools.java

示例2: conditionedApply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String conditionedApply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(parameter)) {
		String value = operator.getParameters().getParameterOrNull(parameter);
		if (value != null) {
			List<String[]> list = ParameterTypeList.transformString2List(value);
			for (String[] pair : list) {
				String first = pair[0];
				pair[0] = pair[1];
				pair[1] = first;
			}
			operator.getParameters().setParameter(parameter, ParameterTypeList.transformList2String(list));
			return "Switched sides of the entries of <code>" + parameter + "</code> in <var>" + operator.getName()
					+ "</var>.";
		}
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:SwitchListEntriesRule.java

示例3: ReplaceOperatorRule

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
public ReplaceOperatorRule(String operatorTypeName, Element element) throws XMLException {
	super(operatorTypeName, element);
	assert (element.getTagName().equals("replaceOperator"));
	NodeList children = element.getChildNodes();
	for (int i = 0; i < children.getLength(); i++) {
		Node child = children.item(i);
		if (child instanceof Element) {
			Element childElement = (Element) child;
			if (childElement.getTagName().equals("replacement")) {
				replacementName = childElement.getTextContent();
			} else if (childElement.getTagName().equals("condition")) {
				parseCondition(childElement);
			} else {
				parseRules.add(XMLImporter.constructRuleFromElement(operatorTypeName, childElement));
			}
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:ReplaceOperatorRule.java

示例4: apply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String apply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(parameter)) {
		String value = operator.getParameters().getParameterOrNull(parameter);
		if (value != null) {
			List<String[]> list = ParameterTypeList.transformString2List(value);
			for (String[] pair : list) {
				if (pair[0].equals("plotter")) {
					if (pair[1].equals("RadViz") || pair[1].equals("GridViz")) {
						pair[1] = "Scatter";
					}
				} else {
					for (Pair<String, String> replacement : REPLACEMENTS) {
						pair[0] = pair[0].replace(replacement.getFirst(), replacement.getSecond());
					}
				}
			}
			operator.getParameters().setParameter(parameter, ParameterTypeList.transformList2String(list));
			return "Corrected plotter setting names in parameter <code>" + parameter + "</code> in <var>"
					+ operator.getName() + "</var>.";
		}
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:RenamePlotterParametersRule.java

示例5: writeTextFile

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
public static void writeTextFile(File file, String text) throws IOException {
	// ! THIS IS TO PREVENT A JAVA PROBLEM (BUG?) ON WINDOWS NTFS FILESYSTEM !
	// If the filename is something like C:\path\x:y.z, new FileOutputStream(file) will throw NO error
	// but the result will be an EMPTY file C:\path\x and you never know it failed
	// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4645046
	if (file == null || !canFileBeStoredOnCurrentFilesystem(file.getName())) {
		throw new FileNotFoundException(I18N.getMessage(I18N.getErrorBundle(), "repository.illegal_entry_name", file == null ? "null" : file.getName()));
	}

	FileOutputStream outStream = new FileOutputStream(file);
	try {
		if (text != null) {
			outStream.write(text.getBytes(XMLImporter.PROCESS_FILE_CHARSET));
		}
	} finally {
		outStream.close();
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:Tools.java

示例6: conditionedApply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String conditionedApply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(parameter)) {
		String value = operator.getParameters().getParameterOrNull(parameter);
		if (value != null) {
			List<String[]> list = ParameterTypeList.transformString2List(value);
			for (String[] pair: list) {
				String first = pair[0];
				pair[0] = pair[1];
				pair[1] = first;
			}
			operator.getParameters().setParameter(parameter, ParameterTypeList.transformList2String(list));
			return "Switched sides of the entries of <code>" + parameter + "</code> in <var>" + operator.getName() + "</var>.";
		}
	}
	return null;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:18,代码来源:SwitchListEntriesRule.java

示例7: ReplaceOperatorRule

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
public ReplaceOperatorRule(String operatorTypeName, Element element) throws XMLException {
	super(operatorTypeName, element);
	assert(element.getTagName().equals("replaceOperator"));
	NodeList children = element.getChildNodes();
	for (int i = 0; i < children.getLength(); i++) {
		Node child = children.item(i);
		if (child instanceof Element) {
			Element childElement = (Element)child;
			if (childElement.getTagName().equals("replacement")) {
				replacementName = childElement.getTextContent();
			} else if (childElement.getTagName().equals("condition")) {
				parseCondition(childElement);
			} else {
				parseRules.add(XMLImporter.constructRuleFromElement(operatorTypeName, childElement));
			} 
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:ReplaceOperatorRule.java

示例8: apply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String apply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(parameter)) {
		String value = operator.getParameters().getParameterOrNull(parameter);
		if (value != null) {
			List<String[]> list = ParameterTypeList.transformString2List(value);
			for (String[] pair: list) {
				if (pair[0].equals("plotter")) {
					if (pair[1].equals("RadViz") || pair[1].equals("GridViz")) {
						pair[1] = "Scatter";
					}
				} else {
					for (Pair<String, String> replacement: REPLACEMENTS) {
						pair[0] = pair[0].replace(replacement.getFirst(), replacement.getSecond());
					}
				}
			}
			operator.getParameters().setParameter(parameter, ParameterTypeList.transformList2String(list));
			return "Corrected plotter setting names in parameter <code>" + parameter + "</code> in <var>" + operator.getName() + "</var>.";
		}
	}
	return null;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:24,代码来源:RenamePlotterParametersRule.java

示例9: writeXML

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
/**
 * This will report this operator with all its parameter settings to the given writer as XML.
 */
public void writeXML(Writer out, boolean hideDefault) throws IOException {
	try {
		XMLTools.stream(new XMLExporter().exportProcess(this, hideDefault), new StreamResult(out),
				XMLImporter.PROCESS_FILE_CHARSET);
	} catch (XMLException e) {
		throw new IOException("Cannot create process XML: " + e, e);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:Operator.java

示例10: createFromXML

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
/**
 * This will create an operator from a XML element describing this operator. The given version
 * will be passed to the XMLImporter to enable the handling of this element as if it would have
 * been created from this version. See {@link XMLImporter#VERSION_RM_5} for details.
 */
public static Operator createFromXML(Element element, Process process,
		List<UnknownParameterInformation> unknownParameterInformation, ProgressListener progressListener,
		VersionNumber originatingVersion) throws XMLException {
	XMLImporter importer = new XMLImporter(progressListener);
	return importer.parseOperator(element, originatingVersion, process, unknownParameterInformation);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:Operator.java

示例11: apply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String apply(final Operator operator, final String operatorTypeName, final XMLImporter importer) {
	importer.doAfterAutoWire(new Runnable() {

		@Override
		public void run() {
			operator.remove();
			importer.addMessage("Removed operator '<var>" + operator.getName() + "</var>' (<code>" + operatorTypeName
					+ "</code>)");
		}
	});
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:DeleteAfterAutoWireRule.java

示例12: conditionedApply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String conditionedApply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(oldAttributeName)) {
		operator.getParameters().renameParameter(oldAttributeName, newAttributeName);
		LogService.getRoot().log(Level.INFO, "com.rapidminer.io.process.rules.ReplaceParameterRule.renamed_parameter",
				new Object[] { oldAttributeName, operator.getName(), operatorTypeName, newAttributeName });
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:ReplaceParameterRule.java

示例13: conditionedApply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
protected String conditionedApply(Operator operator, String operatorTypeName, XMLImporter importer) {
	if (operator.getParameters().isSpecified(attributeName)) {
		String value = operator.getParameters().getParameterOrNull(attributeName);
		if (oldValue.equals(value)) {
			operator.getParameters().setParameter(attributeName, newValue);
			return "The value of the parameter <code>" + attributeName + "</code> in <var>" + operator.getName()
					+ "</var> (<code>" + operatorTypeName + "</code>) was changed from " + value + " to <code>"
					+ newValue + "</code>.";
		}
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:ChangeParameterValueRule.java

示例14: apply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
public String apply(Operator operator, VersionNumber processVersion, XMLImporter importer) {
	if (operator.getOperatorDescription().getKey().equals(operatorTypeName)) {
		if (processVersion == null || processVersion.compareTo(appliesSince) >= 0
				&& processVersion.compareTo(appliesBefore) < 0) {
			return apply(operator, operatorTypeName, importer);
		}
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:AbstractParseRule.java

示例15: apply

import com.rapidminer.io.process.XMLImporter; //导入依赖的package包/类
@Override
public String apply(final Operator operator, VersionNumber processVersion, final XMLImporter importer) {
	if (operator.getClass() == SimpleOperatorChain.class
			&& (processVersion == null || processVersion.compareTo(APPLIES_UNTIL) <= 0)) {
		importer.doAfterTreeConstruction(new Runnable() {

			@Override
			public void run() {
				OperatorChain parent = operator.getParent();
				if (parent != null) {
					// then its not root: search for subprocess containing operator
					for (ExecutionUnit unit : parent.getSubprocesses()) {
						Collection<Operator> innerOperators = unit.getChildOperators();
						if (innerOperators.size() == 1) {
							// and if only contains this operator
							if (innerOperators.iterator().next() == operator) {
								// then place children directly
								importer.addMessage("<code>OperatorChain</code>s are unneccessary if they are the only operator inside a subprocess. Removed unnecessary OperatorChain <var>"
										+ operator.getName() + "</var> in <var>" + parent.getName() + "</var>.");
								OperatorChain self = (OperatorChain) operator;
								for (Operator child : new LinkedList<Operator>(self.getSubprocess(0).getOperators())) {
									child.remove();
									unit.addOperator(child);
								}
								self.remove();
							}
						}
					}
				}
			}
		});
	}
	return null;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:35,代码来源:DeleteUnnecessaryOperatorChainRule.java


注:本文中的com.rapidminer.io.process.XMLImporter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。