本文整理汇总了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();
}
}
示例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;
}
示例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));
}
}
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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));
}
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}