本文整理汇总了Java中org.knime.core.node.NodeModel类的典型用法代码示例。如果您正苦于以下问题:Java NodeModel类的具体用法?Java NodeModel怎么用?Java NodeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeModel类属于org.knime.core.node包,在下文中一共展示了NodeModel类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: closeViews
import org.knime.core.node.NodeModel; //导入依赖的package包/类
private void closeViews(final ErrorCollector collector) throws InterruptedException {
Semaphore done = new Semaphore(1);
done.acquire();
SwingUtilities.invokeLater(() -> done.release());
done.tryAcquire(2, TimeUnit.SECONDS);
for (Map.Entry<SingleNodeContainer, List<AbstractNodeView<? extends NodeModel>>> e : m_context.getNodeViews()
.entrySet()) {
for (AbstractNodeView<? extends NodeModel> view : e.getValue()) {
try {
Node.invokeCloseView(view);
} catch (Exception ex) {
String msg =
"View '" + view + "' of node '" + e.getKey().getNameWithID() + "' has thrown a "
+ ex.getClass().getSimpleName() + " during close: " + ex.getMessage();
collector.addError(new Throwable(msg, ex));
}
}
}
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:21,代码来源:WorkflowCloseViewsTest.java
示例2: getIndicesFromFilter
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* Provides a safe method to get the indices of the selected columns from a
* Filter Model, falls back on selecting all compatible types in case the
* selection is invalid.
*
* @param spec
* the spec of the table.
* @param filterModel
* the filter model that specifies the selection
* @param valueClass
* the value class selected in case the selection is invalid
* @param nodeModelClass
* node model class to be able to set right logger message
*
* @return the indices of the selected columns
*/
public static List<Integer> getIndicesFromFilter(final DataTableSpec spec,
final SettingsModelColumnFilter2 filterModel,
final Class<? extends DataValue> valueClass,
final Class<? extends NodeModel> nodeModelClass) {
final FilterResult result = filterModel.applyTo(spec);
// in case of an invalid selection, select all
if ((result.getIncludes().length == 0)
&& (result.getExcludes().length == 0)) {
NodeLogger.getLogger(nodeModelClass)
.warn("Invalid column selection, automatically selecting "
+ "all columns of the following type: "
+ valueClass.getSimpleName());
return collectAllColumnIndicesOfType(valueClass, spec);
}
return columnNamesToIndices(result.getIncludes(), spec);
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:35,代码来源:NodeTools.java
示例3: isStreamable
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* This code is taken from
* org.knime.workbench.repository.view.AbstractRepositoryView.enrichWithAdditionalInfo(IRepositoryObject,
* IProgressMonitor, boolean)
*/
private static boolean isStreamable(NodeTemplate nodeTemplate) {
try {
NodeFactory<? extends NodeModel> nf = nodeTemplate.createFactoryInstance();
NodeModel nm = nf.createNodeModel();
// check whether the current node model overrides the
// #createStreamableOperator-method
Method m = nm.getClass().getMethod("createStreamableOperator", PartitionInfo.class, PortObjectSpec[].class);
if (m.getDeclaringClass() != NodeModel.class) {
// method has been overriden -> node is probably streamable or distributable
return true;
}
} catch (Throwable t) {
System.out.println(
"Unable to instantiate the node " + nodeTemplate.getFactory().getName() + ": " + t.getMessage());
}
return false;
}
开发者ID:qqilihq,项目名称:knime-json-node-doc-generator,代码行数:23,代码来源:JsonNodeDocuGenerator.java
示例4: openView
import org.knime.core.node.NodeModel; //导入依赖的package包/类
private void openView(final SingleNodeContainer node, final int index) {
// test NodeViews
LOGGER.debug("opening view nr. " + index + " for node " + node.getName());
ViewUtils.invokeAndWaitInEDT(new Runnable() {
/** {@inheritDoc} */
@Override
public void run() {
final AbstractNodeView<? extends NodeModel> view = node.getView(index);
// store the view in order to close it after the test finishes
List<AbstractNodeView<? extends NodeModel>> l = m_context.getNodeViews().get(node);
if (l == null) {
l = new ArrayList<AbstractNodeView<? extends NodeModel>>(2);
m_context.getNodeViews().put(node, l);
}
l.add(view);
// open it now.
Node.invokeOpenView(view, "View #" + index);
}
});
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:21,代码来源:WorkflowOpenViewsTest.java
示例5: getNodeFactory
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Class<? extends NodeFactory<? extends NodeModel>>
getNodeFactory(final String id) {
try {
return (Class<? extends NodeFactory<? extends NodeModel>>) Class
.forName(id);
} catch (final ClassNotFoundException e) {
LOGGER.warn("Could not load Node: " + e.getMessage());
}
return null;
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:16,代码来源:LoopNodeSetFactory.java
示例6: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiDimensionViewModel() {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.PRIMARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new FittedParameterViewReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:FittedParameterViewNodeFactory.java
示例7: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiSelectionViewModel(true) {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.DATA_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new DataSelectionReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:DataSelectionNodeFactory.java
示例8: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiSelectionViewModel(false) {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.PRIMARY_MODEL_TYPE, PmmPortObjectSpec.TERTIARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new PredictorViewReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:PredictorViewNodeFactory.java
示例9: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiSelectionViewModel(true) {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.TERTIARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new TertiaryModelSelectionReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:TertiaryModelSelectionNodeFactory.java
示例10: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new SingleSelectionViewModel() {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.SECONDARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new SecondaryPredictorViewReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:SecondaryPredictorViewNodeFactory.java
示例11: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiDimensionViewModel() {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.SECONDARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new SecondaryModelViewReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:SecondaryModelViewNodeFactory.java
示例12: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiSelectionViewModel(false) {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.TERTIARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new TertiaryModelViewReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:TertiaryModelViewNodeFactory.java
示例13: createNodeModel
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeModel createNodeModel() {
return new MultiSelectionViewModel(true) {
@Override
protected List<PmmPortObjectSpec> getCompatibleSpecs() {
return Arrays.asList(PmmPortObjectSpec.PRIMARY_MODEL_TYPE);
}
@Override
protected ViewReader createReader(PmmPortObject input) throws UnitException, ParseException {
return new PrimaryModelSelectionReader(input);
}
};
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:PrimaryModelSelectionNodeFactory.java
示例14: getNodeFactory
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Class<? extends NodeFactory<? extends NodeModel>> getNodeFactory(
final String id) {
try {
return (Class<? extends NodeFactory<? extends NodeModel>>) Class
.forName(id);
} catch (final ClassNotFoundException e) {
}
return null;
}
开发者ID:MichaelZinsmaier,项目名称:knip-contribution,代码行数:15,代码来源:ContributionMZNodeSetFactory.java
示例15: autoColumnSelection
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* If setting holds a valid column name returns the column index. If not
* search the first compatible column and return the index. A logger warning
* is given to indicate the automatic selection in contrast to
* {@link NodeUtils#silentOptionalAutoColumnSelection}.
*
* @param inSpec
* the spec
* @param model
* the model
* @param valueClass
* the value class that is chosen
* @param nodeModelClass
* node model class to be able to set right logger message
* @param except
* columns that should not be chosen e.g. because they are
* already in use
* @return the column index, never -1, a {@link InvalidSettingsException} is
* thrown instead
* @throws InvalidSettingsException
* the invalid settings exception
*/
public static final int autoColumnSelection(final DataTableSpec inSpec,
final SettingsModelString model,
final Class<? extends DataValue> valueClass,
final Class<? extends NodeModel> nodeModelClass,
final Integer... except) throws InvalidSettingsException {
int i = inSpec.findColumnIndex(model.getStringValue());
if ((i > -1)
&& inSpec.getColumnSpec(i).getType().isCompatible(valueClass)) {
return i;
} else {
i = autoOptionalColumnSelection(inSpec, model, valueClass, except);
if (i > -1) {
NodeLogger.getLogger(nodeModelClass)
.warn("No column specified as "
+ valueClass.getSimpleName()
+ ": auto detection suggested column "
+ inSpec.getColumnSpec(i).getName());
} else {
String errorMessage = "";
final StringBuilder sb = new StringBuilder();
if (except.length > 0) {
if (except.length > 1) {
sb.append(" (columns: ");
for (int j = 0; j < except.length; j++) {
sb.append(except[j]);
sb.append(", ");
}
errorMessage =
sb.toString().substring(0, sb.length() - 2);
errorMessage +=
" have already been chosen or have been excluded "
+ "from automatic selection for some other reason)";
} else {
errorMessage += " (column: " + except[0]
+ " has already been chosen or has been "
+ "excluded from automatic selection for some other reason)";
}
}
throw new InvalidSettingsException(model.getKey()
+ ": No column of type " + valueClass.getSimpleName()
+ " available!" + errorMessage);
}
return i;
}
}
开发者ID:knime,项目名称:knime-activelearning,代码行数:72,代码来源:NodeUtils.java
示例16: createNodeView
import org.knime.core.node.NodeModel; //导入依赖的package包/类
@Override
public NodeView<NodeModel> createNodeView(int viewIndex, NodeModel nodeModel) {
return null;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:5,代码来源:ViewFactory.java
示例17: getNodeViews
import org.knime.core.node.NodeModel; //导入依赖的package包/类
/**
* Returns a map with the node views for each node (if there are any). This map is intended to be modified by clients. If a
* node does not have a view, the corresponding entry is <code>null</code>.
*
* @return a map between node containers and their views
*/
public Map<SingleNodeContainer, List<AbstractNodeView<? extends NodeModel>>> getNodeViews() {
return m_views;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:10,代码来源:WorkflowTestContext.java
注:本文中的org.knime.core.node.NodeModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论