本文整理汇总了Java中com.rapidminer.operator.ports.metadata.CollectionMetaData类的典型用法代码示例。如果您正苦于以下问题:Java CollectionMetaData类的具体用法?Java CollectionMetaData怎么用?Java CollectionMetaData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionMetaData类属于com.rapidminer.operator.ports.metadata包,在下文中一共展示了CollectionMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SelectionOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public SelectionOperator(OperatorDescription description) {
super(description);
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if (md instanceof CollectionMetaData) {
if (getParameterAsBoolean(PARAMETER_UNFOLD)) {
selectedOutput.deliverMD(((CollectionMetaData) md).getElementMetaDataRecursive());
} else {
selectedOutput.deliverMD(((CollectionMetaData) md).getElementMetaData());
}
} else {
selectedOutput.deliverMD(null);
}
}
});
}
示例2: CollectionIterationOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public CollectionIterationOperator(OperatorDescription description) {
super(description, "Iteration");
outExtender.start();
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if (md != null && md instanceof CollectionMetaData) {
if (getParameterAsBoolean(PARAMETER_UNFOLD)) {
singleInnerSource.deliverMD(((CollectionMetaData) md).getElementMetaDataRecursive());
} else {
singleInnerSource.deliverMD(((CollectionMetaData) md).getElementMetaData());
}
} else {
singleInnerSource.deliverMD(null);
}
}
});
getTransformer().addRule(new SubprocessTransformRule(getSubprocess(0)));
getTransformer().addRule(outExtender.makePassThroughRule());
}
示例3: renderConnectionsBackground
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
/**
* Draws the connections background (round pipe) for the given ports.
*
* @param inputPorts
* the input ports for which to draw connection backgrounds
* @param ports
* the output ports for which to draw connection backgrounds
* @param g2
* the graphics context to draw upon
*/
@SuppressWarnings("deprecation")
private void renderConnectionsBackground(final InputPorts inputPorts, final OutputPorts ports, final Graphics2D g2) {
for (int i = 0; i < ports.getNumberOfPorts(); i++) {
OutputPort from = ports.getPortByIndex(i);
Port to = from.getDestination();
if (to != null) {
Shape connector = ProcessDrawUtils.createConnector(from, to, model);
// the first paint can come before any of the operator register listeners fire
// thus we need to check the shape for null; subsequent calls will have a valid
// shape
if (connector == null) {
return;
}
g2.setColor(Color.WHITE);
if (from.getMetaData() instanceof CollectionMetaData) {
g2.setStroke(CONNECTION_COLLECTION_LINE_BACKGROUND_STROKE);
} else {
g2.setStroke(CONNECTION_LINE_BACKGROUND_STROKE);
}
g2.draw(connector);
}
}
}
示例4: getColorFor
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
/**
* Returns the color specified for the given type of metadata.
*
* @param md
* the metadata or {@code null}
* @return a color, never {@code null}
*/
public static Color getColorFor(final MetaData md) {
if (md == null) {
return Color.WHITE;
}
if (md instanceof CollectionMetaData) {
MetaData elementMetaDataRecursive = ((CollectionMetaData) md).getElementMetaDataRecursive();
if (elementMetaDataRecursive != null) {
return IO_CLASS_TO_COLOR_MAP.get(elementMetaDataRecursive.getObjectClass());
} else {
return IO_CLASS_TO_COLOR_MAP.get(IOObject.class);
}
} else {
return IO_CLASS_TO_COLOR_MAP.get(md.getObjectClass());
}
}
示例5: SelectionOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public SelectionOperator(OperatorDescription description) {
super(description);
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if (md instanceof CollectionMetaData) {
if (getParameterAsBoolean(PARAMETER_UNFOLD)) {
selectedOutput.deliverMD(((CollectionMetaData)md).getElementMetaDataRecursive());
} else {
selectedOutput.deliverMD(((CollectionMetaData)md).getElementMetaData());
}
} else {
selectedOutput.deliverMD(null);
}
}
});
}
示例6: CollectionIterationOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public CollectionIterationOperator(OperatorDescription description) {
super(description, "Iteration");
outExtender.start();
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if ((md != null) && (md instanceof CollectionMetaData)) {
if (getParameterAsBoolean(PARAMETER_UNFOLD)) {
singleInnerSource.deliverMD(((CollectionMetaData) md).getElementMetaDataRecursive());
} else {
singleInnerSource.deliverMD(((CollectionMetaData) md).getElementMetaData());
}
} else {
singleInnerSource.deliverMD(null);
}
}
});
getTransformer().addRule(new SubprocessTransformRule(getSubprocess(0)));
getTransformer().addRule(outExtender.makePassThroughRule());
}
示例7: getMetaData
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
/**
* Returns a list of non-null meta data of all input ports.
*/
public List<MetaData> getMetaData(boolean unfold) {
List<MetaData> results = new LinkedList<MetaData>();
for (InputPort port : getManagedPorts()) {
MetaData data = port.getMetaData();
if (data != null) {
if (unfold && data instanceof CollectionMetaData) {
results.add(((CollectionMetaData) data).getElementMetaDataRecursive());
} else {
results.add(data);
}
}
}
return results;
}
示例8: CollectionOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public CollectionOperator(OperatorDescription description) {
super(description);
inExtender.start();
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
boolean unfold = getParameterAsBoolean(PARAMETER_UNFOLD);
MetaData commonSupertype = null;
for (InputPort in : inExtender.getManagedPorts()) {
MetaData md = in.getMetaData();
if (unfold && (md instanceof CollectionMetaData)) {
md = ((CollectionMetaData) md).getElementMetaDataRecursive();
}
if (md == null) {
continue;
} else if (commonSupertype == null) {
commonSupertype = md;
continue;
} else {
if (commonSupertype.getObjectClass().equals(md.getObjectClass())) {
continue;
} else if (commonSupertype.getObjectClass().isAssignableFrom(md.getObjectClass())) {
commonSupertype = md;
} else if (md.getObjectClass().isAssignableFrom(commonSupertype.getObjectClass())) {
// noop, old value was ok
// commonSupertype = commonSupertype;
} else {
in.addError(new SimpleMetaDataError(Severity.WARNING, in, "incompatible_ioobjects",
commonSupertype.getObjectClass().getSimpleName(), md.getObjectClass().getSimpleName()));
collectionOutput.deliverMD(new CollectionMetaData(new MetaData()));
return;
}
}
}
collectionOutput.deliverMD(new CollectionMetaData(commonSupertype));
}
});
}
示例9: UnfoldOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public UnfoldOperator(OperatorDescription description) {
super(description);
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if ((md != null) && (md instanceof CollectionMetaData)) {
flatOutput.deliverMD(new CollectionMetaData(((CollectionMetaData) md).getElementMetaDataRecursive()));
} else {
flatOutput.deliverMD(null);
}
}
});
}
示例10: getMetaData
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
/** Returns a list of non-null meta data of all input ports.
*/
public List<MetaData> getMetaData(boolean unfold) {
List<MetaData> results = new LinkedList<MetaData>();
for (InputPort port : getManagedPorts()) {
MetaData data = port.getMetaData();
if (data != null) {
if (unfold && data instanceof CollectionMetaData )
results.add(((CollectionMetaData) data).getElementMetaDataRecursive());
else
results.add(data);
}
}
return results;
}
示例11: CollectionOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public CollectionOperator(OperatorDescription description) {
super(description);
inExtender.start();
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
boolean unfold = getParameterAsBoolean(PARAMETER_UNFOLD);
MetaData commonSupertype = null;
for (InputPort in : inExtender.getManagedPorts()) {
MetaData md = in.getMetaData();
if (unfold && (md instanceof CollectionMetaData)) {
md = ((CollectionMetaData)md).getElementMetaDataRecursive();
}
if (md == null) {
continue;
} else if (commonSupertype == null) {
commonSupertype = md;
continue;
} else {
if (commonSupertype.getObjectClass().equals(md.getObjectClass())) {
continue;
} else if (commonSupertype.getObjectClass().isAssignableFrom(md.getObjectClass())) {
commonSupertype = md;
} else if (md.getObjectClass().isAssignableFrom(commonSupertype.getObjectClass())) {
// noop, old value was ok
//commonSupertype = commonSupertype;
} else {
in.addError(new SimpleMetaDataError(Severity.WARNING, in, "incompatible_ioobjects", commonSupertype.getObjectClass().getSimpleName(), md.getObjectClass().getSimpleName()));
collectionOutput.deliverMD(new CollectionMetaData(new MetaData()));
return;
}
}
}
collectionOutput.deliverMD(new CollectionMetaData(commonSupertype));
}
});
}
示例12: UnfoldOperator
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public UnfoldOperator(OperatorDescription description) {
super(description);
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
MetaData md = collectionInput.getMetaData();
if ((md != null) && (md instanceof CollectionMetaData)) {
flatOutput.deliverMD(new CollectionMetaData(((CollectionMetaData)md).getElementMetaDataRecursive()));
} else {
flatOutput.deliverMD(null);
}
}
});
}
示例13: getColorFor
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
public static Color getColorFor(MetaData md) {
if (md == null) {
return Color.WHITE;
}
if (md instanceof CollectionMetaData) {
MetaData elementMetaDataRecursive = ((CollectionMetaData) md).getElementMetaDataRecursive();
if (elementMetaDataRecursive != null) {
return IO_CLASS_TO_COLOR_MAP.get(elementMetaDataRecursive.getObjectClass());
} else {
return IO_CLASS_TO_COLOR_MAP.get(IOObject.class);
}
} else {
return IO_CLASS_TO_COLOR_MAP.get(md.getObjectClass());
}
}
示例14: makePrecondition
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
protected Precondition makePrecondition(final InputPort port) {
if (desiredMetaData != null) {
return new Precondition() {
@Override
public void assumeSatisfied() {
if (!getManagedPorts().isEmpty()) {
getManagedPorts().iterator().next().receiveMD(desiredMetaData);
}
}
@Override
public void check(MetaData metaData) {
if (!getManagedPorts().isEmpty()) {
int portIndex = getManagedPorts().indexOf(port);
boolean isMandatory = (portIndex < numberOfMandatory);
// checking if some of the ports received collection
for (int i = portIndex; i >= 0; i--) {
MetaData portMetaData = getManagedPorts().get(i).getMetaData();
if (portMetaData != null) {
isMandatory &= !portMetaData.isCompatible(new CollectionMetaData(desiredMetaData),
CompatibilityLevel.VERSION_5);
}
}
// if not: throw error
if (metaData == null && isMandatory) {
port.addError(new InputMissingMetaDataError(port, desiredMetaData.getObjectClass(), null));
}
if (metaData != null) {
if (!desiredMetaData.isCompatible(metaData, CompatibilityLevel.VERSION_5)) {
Collection<MetaDataError> errors = desiredMetaData.getErrorsForInput(port, metaData,
CompatibilityLevel.VERSION_5);
for (MetaDataError error : errors) {
port.addError(error);
}
}
}
}
}
@Override
public String getDescription() {
return "requires " + ((numberOfMandatory > 0) ? " at least " + numberOfMandatory + " " : "")
+ desiredMetaData.getDescription();
}
@Override
public MetaData getExpectedMetaData() {
return desiredMetaData;
}
@Override
public boolean isCompatible(MetaData input, CompatibilityLevel level) {
return desiredMetaData.isCompatible(input, level);
}
};
}
return null;
}
示例15: transformMetaData
import com.rapidminer.operator.ports.metadata.CollectionMetaData; //导入依赖的package包/类
@Override
protected MetaData transformMetaData(MetaData md) {
return new CollectionMetaData(md);
}