當前位置: 首頁>>代碼示例>>Java>>正文


Java FlowVariable類代碼示例

本文整理匯總了Java中org.knime.core.node.workflow.FlowVariable的典型用法代碼示例。如果您正苦於以下問題:Java FlowVariable類的具體用法?Java FlowVariable怎麽用?Java FlowVariable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FlowVariable類屬於org.knime.core.node.workflow包,在下文中一共展示了FlowVariable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateData

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Update the settings and input spec.
 * @param settings the settings
 * @param spec the input spec
 * @param flowVars the available flow variables
 */
public void updateData(final JavaSnippetSettings settings,
        final DataTableSpec spec,
        final Map<String, FlowVariable> flowVars) {
    m_inListenerArmed = false;
    m_outListenerArmed = false;
    m_inFieldsTable.updateData(settings.getJavaSnippetFields(),
            spec, flowVars);
    m_outFieldsTable.updateData(settings.getJavaSnippetFields(),
            spec, flowVars);
    // update snippet.
    m_snippet.setJavaSnippetFields(new JavaSnippetFields(
            m_inFieldsTable.getInColFields(),
            m_inFieldsTable.getInVarFields(),
            m_outFieldsTable.getOutColFields(),
            m_outFieldsTable.getOutVarFields()));
    m_inListenerArmed = true;
    m_outListenerArmed = true;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:25,代碼來源:JSnippetFieldsController.java

示例2: getAllowedJavaTypes

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
public Class[] getAllowedJavaTypes(final int row) {
    Object input = getValueAt(row, Column.COLUMN);
    if (input instanceof DataColumnSpec) {
        DataColumnSpec colSpec = (DataColumnSpec)input;
        DataType elemType = colSpec.getType().isCollectionType()
            ? colSpec.getType().getCollectionElementType()
            : colSpec.getType();
        DataValueToJava dvToJava =
            TypeProvider.getDefault().getDataValueToJava(elemType,
                    colSpec.getType().isCollectionType());
        return dvToJava.canProvideJavaTypes();
    } else if (input instanceof FlowVariable) {
        FlowVariable flowVar = (FlowVariable)input;
        TypeConverter typeConversion =
            TypeProvider.getDefault().getTypeConverter(
                flowVar.getType());
        return typeConversion.canProvideJavaTypes();
    } else {
        return new Class[0];
    }
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:27,代碼來源:InFieldsTableModel.java

示例3: addRow

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Adds a row for the given flow variable.
 *
 * @param var the flow variable definition
 * @return true when the row was added successfully
 */
public boolean addRow(final FlowVariable var) {
    int r = m_model.getRowCount();
    m_model.addRow();
    m_model.setValueAt(var, r, Column.COLUMN);
    String varName = var.getName();
    Set<String> taken = new HashSet<String>();
    for (int i = 0; i < m_model.getRowCount(); i++) {
        taken.add((String)m_model.getValueAt(i, Column.JAVA_FIELD));
    }
    String fieldName = FieldsTableUtil.createUniqueJavaIdentifier(
            varName, taken, "v_");
    m_model.setValueAt(fieldName, r, Column.JAVA_FIELD);
    Class javaType = TypeProvider.getDefault()
        .getTypeConverter(var.getType()).getPreferredJavaType();
    m_model.setValueAt(javaType, r, Column.JAVA_TYPE);
    return true;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:24,代碼來源:InFieldsTable.java

示例4: createInputCellEditor

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/** Create cell editor for for the input columns / flow variables. */
private TableCellEditor createInputCellEditor() {
    JComboBox comboBox = new JComboBox();
    comboBox.setRenderer(new InputListCellRenderer());
    if (null != m_spec) {
        for (DataColumnSpec colSpec : m_spec) {
            comboBox.addItem(colSpec);
        }
    }
    if (null != m_flowVars) {
        for (FlowVariable flowVar : m_flowVars.values()) {
            comboBox.addItem(flowVar);
        }
    }
    DefaultCellEditor editor =  new DefaultCellEditor(comboBox);
    editor.setClickCountToStart(2);
    return editor;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:19,代碼來源:InFieldsTable.java

示例5: getInVarFields

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Get the field definitions representing input flow variables.
 *
 * @return fields representing input flow variables
 */
public InVarList getInVarFields() {
    InVarList inCols = new InVarList();
    for (int r = 0; r < m_model.getRowCount(); r++) {
        if (!m_model.validateValues(r)) {
            // there are errors in this row
            continue;
        }
        Object value = m_model.getValueAt(r, Column.COLUMN);
        if (value instanceof FlowVariable) {
            FlowVariable colSpec = (FlowVariable)value;
            InVar inVar = new InVar();
            inVar.setKnimeType(colSpec.getType());
            inVar.setKnimeName(colSpec.getName());
            inVar.setJavaName(
                    (String)m_model.getValueAt(r, Column.JAVA_FIELD));
            inVar.setJavaType((Class)m_model.getValueAt(r,
                    Column.JAVA_TYPE));
            inCols.add(inVar);
        }
    }
    return inCols;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:28,代碼來源:InFieldsTable.java

示例6: validateColDataType

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Validate knime type in the given row.
 * @param row the row to check
 * @return error message if error occurs
 */
private String validateColDataType(final int row) {
    Object value = getValueAt(row, Column.DATA_TYPE);
    if (null == value) {
        return "Please select a value";
    }
    if (value instanceof Type) {
        if (getFieldType(row).equals(FieldType.Column)) {
            return "Please select a data type.";
        }
    } else if (value instanceof DataType) {
        if (getFieldType(row).equals(FieldType.FlowVariable)) {
            return "Please select a flow variable type.";
        }
    } else if (value instanceof String) {
        return "Please select a valid type.";
    }
    // no errors found
    return null;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:25,代碼來源:OutFieldsTableModel.java

示例7: addRow

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Adds a row using the values of the given output variable.
 *
 * @param outVar the output variable definition
 * @return true when the row was added successfully
 */
public boolean addRow(final OutVar outVar) {
    int r = m_model.getRowCount();
    m_model.addRow();
    m_model.setValueAt(outVar.getReplaceExisting(),
            r, Column.REPLACE_EXISTING);
    if (!m_flowVarsOnly) {
        m_model.setValueAt(FieldType.FlowVariable,  r,
                Column.FIELD_TYPE);
    }
    String name = outVar.getKnimeName();
    FlowVariable flowVar = m_flowVars.get(name);
    Object value = null != flowVar ? flowVar : name;
    m_model.setValueAt(value, r, Column.COLUMN);
    m_model.setValueAt(outVar.getKnimeType(), r, Column.DATA_TYPE);
    if (!m_flowVarsOnly) {
        m_model.setValueAt(false, r, Column.IS_COLLECTION);
    }

    m_model.setValueAt(outVar.getJavaName(), r, Column.JAVA_FIELD);
    m_model.setValueAt(outVar.getJavaType(), r, Column.JAVA_TYPE);
    return true;
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:29,代碼來源:OutFieldsTable.java

示例8: setFlowVariables

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Set the flow variables to display.
 * @param flowVars the flow variables.
 */
public void setFlowVariables(final Collection<FlowVariable> flowVars) {
    Collection<FlowVariable> sortedFlowVars = new TreeSet<FlowVariable>(new Comparator<FlowVariable>() {
        @Override
        public int compare(final FlowVariable o1, final FlowVariable o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    sortedFlowVars.addAll(flowVars);
    DefaultListModel fvListModel =
        (DefaultListModel)getModel();
    fvListModel.removeAllElements();
    for (FlowVariable v : sortedFlowVars) {
        fvListModel.addElement(v);
    }

}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:21,代碼來源:FlowVariableList.java

示例9: FlowVariableRepository

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Create a new repository.
 * @param input the flow variables from the input stack.
 */
public FlowVariableRepository(final Map<String, FlowVariable> input) {
    super();
    m_input = input;
    m_modified = new LinkedHashMap<String, FlowVariable>();
    m_flowVarNames = new LinkedHashSet<String>();
    m_flowVarNames.addAll(input.keySet());
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:12,代碼來源:FlowVariableRepository.java

示例10: getValueOfType

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Get value of a flow variable. The type of the returned object is equal
 * to the given className.
 * @param name the name of the flow variable
 * @param className the type of the returned object
 * @return the value of the flow variable
 */
@SuppressWarnings("rawtypes")
public Object getValueOfType(final String name, final Class className) {
    FlowVariable flowVar = getFlowVariable(name);
    if (null == flowVar) {
        throw new FlowVariableException("The flow variable with name \""
                + name + "\" does not exist.");
    }
    TypeConverter converter =
        TypeProvider.getDefault().getTypeConverter(flowVar.getType());
    return converter.getValue(flowVar, className);
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:19,代碼來源:FlowVariableRepository.java

示例11: isOfType

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Returns true when getValueOfType(String, Class) does not throw
 * an TypeException when called with the given flow variable and the given
 * class name.
 * @param name the name of the flow variable
 * @param className the type
 * @return true when flow variable is of type.
 */
@SuppressWarnings("rawtypes")
public boolean isOfType(final String name, final Class className) {
    FlowVariable flowVar = getFlowVariable(name);
    if (null == flowVar) {
        throw new FlowVariableException("The flow variable with name \""
                + name + "\" does not exist.");
    }
    TypeConverter converter =
        TypeProvider.getDefault().getTypeConverter(flowVar.getType());
    return converter.canProvideJavaType(className);
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:20,代碼來源:FlowVariableRepository.java

示例12: put

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Add a new or updated flow variable.
 * @param flowVar the flow variable associated with name
 */
public void put(final FlowVariable flowVar) {
    m_modified.put(flowVar.getName(), flowVar);
    // re-add element since natural ordering of flow variables is a stack
    m_flowVarNames.remove(flowVar.getName());
    m_flowVarNames.add(flowVar.getName());
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:11,代碼來源:FlowVariableRepository.java

示例13: validateJavaTypeColumn

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Validate java type in the given row.
 * @param row the row to check
 * @return error message if error occurs
 */
@SuppressWarnings("rawtypes")
private String validateJavaTypeColumn(final int row) {
    Object value = this.getValueAt(row, Column.JAVA_TYPE);
    if (null == value) {
        return "Please select a value";
    }
    if (!(value instanceof Class)) {
        return "Cannot find class " + value.toString();
    }
    Class javaType = (Class)value;
    Object input = this.getValueAt(row, Column.COLUMN);
    if (input instanceof DataColumnSpec) {
        DataColumnSpec colSpec = (DataColumnSpec)input;
        DataType elemType = colSpec.getType().isCollectionType()
            ? colSpec.getType().getCollectionElementType()
            : colSpec.getType();
        DataValueToJava dvToJava =
            TypeProvider.getDefault().getDataValueToJava(elemType,
                    colSpec.getType().isCollectionType());
        return dvToJava.canProvideJavaType(javaType) ? null
                : "The java type \"" + javaType.getSimpleName()
                  + "\" is not supported.";
    } else if (input instanceof FlowVariable) {
        FlowVariable flowVar = (FlowVariable)input;
        TypeConverter typeConversion =
            TypeProvider.getDefault().getTypeConverter(
                flowVar.getType());
        return typeConversion.canProvideJavaType(javaType) ? null
                : "The java type \"" + javaType.getSimpleName()
                  + "\" is not supported.";
    } else {
        return null;
    }
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:40,代碼來源:InFieldsTableModel.java

示例14: getFieldType

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Returns the field type for the given column.
 *
 * @param row the row to check
 * @return the field type of the given column
 */
private FieldType getFieldType(final int row) {
    if (m_flowVarsOnly) {
        return FieldType.FlowVariable;
    } else {
        return (FieldType)getValueAt(row, Column.FIELD_TYPE);
    }
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:14,代碼來源:OutFieldsTableModel.java

示例15: validateColFieldType

import org.knime.core.node.workflow.FlowVariable; //導入依賴的package包/類
/**
 * Validate field type in the given row.
 * @param row the row to check
 * @return error message if error occurs
 */
private String validateColFieldType(final int row) {
    Object value = getFieldType(row);
    if (null == value) {
        return "Please select a value.";
    }
    return value.equals(FieldType.Column)
        || value.equals(FieldType.FlowVariable) ? null
                : "No valid field type: " + value.toString();
}
 
開發者ID:pavloff-de,項目名稱:spark4knime,代碼行數:15,代碼來源:OutFieldsTableModel.java


注:本文中的org.knime.core.node.workflow.FlowVariable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。