org.knime.core.node.workflow
Class FlowVariable

java.lang.Object
  extended by org.knime.core.node.workflow.FlowObject
      extended by org.knime.core.node.workflow.FlowVariable
All Implemented Interfaces:
Cloneable

public final class FlowVariable
extends FlowObject

FlowVariable holding local variables of basic types which can be passed along connections in a workflow.

Author:
M. Berthold, University of Konstanz

Nested Class Summary
static class FlowVariable.Scope
          Scope of variable.
static class FlowVariable.Type
          Type of a variable, supports currently only scalars.
 
Field Summary
static String GLOBAL_CONST_ID
          Deprecated. Use FlowVariable.Scope.getPrefix() of enum constant FlowVariable.Scope.Global instead.
 
Constructor Summary
FlowVariable(String name, double valueD)
          create new FlowVariable representing a double.
FlowVariable(String name, double valueD, FlowVariable.Scope scope)
          create new FlowVariable representing a double which can either be a global workflow variable or a local one.
FlowVariable(String name, int valueI)
          create new FlowVariable representing an integer.
FlowVariable(String name, int valueI, FlowVariable.Scope scope)
          create new FlowVariable representing an integer which can either be a global workflow variable or a local one.
FlowVariable(String name, String valueS)
          create new FlowVariable representing a string.
FlowVariable(String name, String valueS, FlowVariable.Scope scope)
          create new FlowVariable representing a string which can either be a global workflow variable or a local one.
 
Method Summary
 boolean equals(Object obj)
          
 double getDoubleValue()
           
 int getIntValue()
           
 String getName()
           
 FlowVariable.Scope getScope()
           
 String getStringValue()
           
 FlowVariable.Type getType()
           
 int hashCode()
          
 boolean isGlobalConstant()
           
(package private) static FlowVariable load(NodeSettingsRO sub)
          Read a flow variable from a settings object.
(package private)  void save(NodeSettingsWO settings)
          Saves this flow variable to a settings object.
 String toString()
          
 
Methods inherited from class org.knime.core.node.workflow.FlowObject
clone, cloneAndUnsetOwner, getOwner, setOwner
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

GLOBAL_CONST_ID

@Deprecated
public static final String GLOBAL_CONST_ID
Deprecated. Use FlowVariable.Scope.getPrefix() of enum constant FlowVariable.Scope.Global instead.
reserved prefix for global flow variables.

See Also:
Constant Field Values
Constructor Detail

FlowVariable

public FlowVariable(String name,
                    String valueS)
create new FlowVariable representing a string.

Parameters:
name - of the variable
valueS - string value

FlowVariable

public FlowVariable(String name,
                    double valueD)
create new FlowVariable representing a double.

Parameters:
name - of the variable
valueD - double value

FlowVariable

public FlowVariable(String name,
                    int valueI)
create new FlowVariable representing an integer.

Parameters:
name - of the variable
valueI - int value

FlowVariable

FlowVariable(String name,
             String valueS,
             FlowVariable.Scope scope)
create new FlowVariable representing a string which can either be a global workflow variable or a local one.

Parameters:
name - of the variable
valueS - string value
scope - Scope of variable

FlowVariable

FlowVariable(String name,
             double valueD,
             FlowVariable.Scope scope)
create new FlowVariable representing a double which can either be a global workflow variable or a local one.

Parameters:
name - of the variable
valueD - double value
scope - Scope of variable

FlowVariable

FlowVariable(String name,
             int valueI,
             FlowVariable.Scope scope)
create new FlowVariable representing an integer which can either be a global workflow variable or a local one.

Parameters:
name - of the variable
valueI - int value
scope - Scope of variable
Method Detail

getName

public String getName()
Returns:
name of variable.

isGlobalConstant

public boolean isGlobalConstant()
Returns:
true if the variable is a global workflow variable.

getScope

public FlowVariable.Scope getScope()
Returns:
the scope

getType

public FlowVariable.Type getType()
Returns:
the type

getStringValue

public String getStringValue()
Returns:
get string value of the variable or null if it's not a string.

getDoubleValue

public double getDoubleValue()
Returns:
get double value of the variable or Double.NaN if it's not a double.

getIntValue

public int getIntValue()
Returns:
get int value of the variable or 0 if it's not an integer.

save

void save(NodeSettingsWO settings)
Saves this flow variable to a settings object. This method writes directly into the argument object (no creating of intermediate child).

Parameters:
settings - To save to.

load

static FlowVariable load(NodeSettingsRO sub)
                  throws org.knime.core.node.InvalidSettingsException
Read a flow variable from a settings object. This is the counterpart to save(NodeSettingsWO).

Parameters:
sub - To load from.
Returns:
A new FlowVariable read from the settings object.
Throws:
org.knime.core.node.InvalidSettingsException - If that fails for any reason.

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright, 2003 - 2011. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.