org.shiwa.fgi.iwir
Class AbstractTask

java.lang.Object
  extended by org.shiwa.fgi.iwir.AbstractTask
Direct Known Subclasses:
AbstractCompoundTask, Task

public abstract class AbstractTask
extends java.lang.Object

The Class AbstractTask is the superclass of all tasks. Every class has a name, input ports, output ports ,and optional properties and constraints.


Constructor Summary
AbstractTask(java.lang.String name)
          Instantiates a new abstract task.
 
Method Summary
 void addConstraint(Constraint constraint)
          Adds an additional constraint to the task.
 void addInputPort(InputPort inputPort)
          Adds an additional input port to the task.
 void addOutputPort(OutputPort outputPort)
          Adds an additional output port to the task.
 void addProperty(Property property)
          Adds an additional property to the task.
 boolean equals(java.lang.Object obj)
           
abstract  java.util.List<AbstractDataPort> getAllInputPorts()
          Returns a list of all input ports (inputPort, loopPoort,...).
abstract  java.util.List<AbstractDataPort> getAllOutputPorts()
          Returns a list of all output ports (outputPort, unionPort,...).
 java.util.List<AbstractTask> getChildren()
          Returns a shallow copy of the direct child tasks.
 java.util.List<Constraint> getConstraints()
          Returns a shallow copy of the task constraints.
 java.util.List<InputPort> getInputPorts()
          Returns a shallow copy of the input ports InputPorttPort.
 java.lang.String getName()
          Gets the name of the task.
 java.util.List<OutputPort> getOutputPorts()
          Returns a shallow copy of the output ports ports OutputPorttPort.
 AbstractTask getParentTask()
          Gets the parent task or null if the object is the top-level task.
 AbstractPort getPort(java.lang.String portName)
          Returns the port identified by its name or null if the port is not known.
 java.util.List<Property> getProperties()
          Returns a shallow copy of the task properties.
 java.lang.String getUniqueId()
          Returns path+name, representing an unique identifier.
 int hashCode()
           
 java.lang.Boolean isTopLevelTask()
          Checks if the task is the top-level task of an IWIR workflow.
 void removeProperty(Property p)
          Removes the given property from the list.
 void setPortValue(java.lang.String portName, boolean b)
          Sets the port value.
 void setPortValue(java.lang.String portName, double d)
          Sets the port value.
 void setPortValue(java.lang.String portName, int i)
          Sets the port value.
 void setPortValue(java.lang.String portName, java.lang.String s)
          Sets the port value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTask

public AbstractTask(java.lang.String name)
             throws NotWellFormedException
Instantiates a new abstract task. Validates the the name.

Parameters:
name - the name of the task
Throws:
NotWellFormedException - if name is not a valid task name
Method Detail

addInputPort

public void addInputPort(InputPort inputPort)
                  throws NotWellFormedException
Adds an additional input port to the task. Throws a NotWellFormedException if a port id already exist, for example.

Parameters:
inputPort - the input port to add to the task
Throws:
NotWellFormedException - the not well formed exception

addOutputPort

public void addOutputPort(OutputPort outputPort)
                   throws NotWellFormedException
Adds an additional output port to the task. Throws a NotWellFromedException if a port id already exist, for example.

Parameters:
outputPort - the output port to add to the task
Throws:
NotWellFormedException - the not well formed exception

addConstraint

public void addConstraint(Constraint constraint)
                   throws NotWellFormedException
Adds an additional constraint to the task. Throws a NotWellFormedException if a constraint already exist, for example.

Parameters:
constraint - the constraint to add to the task
Throws:
NotWellFormedException - the not well formed exception

addProperty

public void addProperty(Property property)
                 throws NotWellFormedException
Adds an additional property to the task. Throws a NotWellFormedException if a constraint already exist, for example.

Parameters:
property - the property to add to the task
Throws:
NotWellFormedException - the not well formed exception

removeProperty

public void removeProperty(Property p)
Removes the given property from the list.

Parameters:
p - property to remove

getInputPorts

public java.util.List<InputPort> getInputPorts()
Returns a shallow copy of the input ports InputPorttPort. Returns an empty list if no InputPortPort exist.

Returns:
the input ports of the task

getOutputPorts

public java.util.List<OutputPort> getOutputPorts()
Returns a shallow copy of the output ports ports OutputPorttPort. Returns an empty list if no OutputPortPort exist.

Returns:
the output ports of the task

getProperties

public java.util.List<Property> getProperties()
Returns a shallow copy of the task properties. Returns an empty list if no constraints exist.

Returns:
the properties of the task

getConstraints

public java.util.List<Constraint> getConstraints()
Returns a shallow copy of the task constraints. Returns an empty list if no constraints exist.

Returns:
the constraints of the task

getName

public java.lang.String getName()
Gets the name of the task.

Returns:
the name of the task

getPort

public AbstractPort getPort(java.lang.String portName)
Returns the port identified by its name or null if the port is not known. Returns null if the port is not an instance of AbstractDataPort.

Parameters:
portName - the identifier of the port
Returns:
the port with name portName or null if such a port does not exist

setPortValue

public void setPortValue(java.lang.String portName,
                         java.lang.String s)
                  throws java.lang.IllegalArgumentException
Sets the port value. Is used ONLY for evaluating a condition. Throws an IllegalArgumentException if string is not the type of the port.

Parameters:
portName - the port name
s - the string value of the port
Throws:
java.lang.IllegalArgumentException - the illegal argument exception

setPortValue

public void setPortValue(java.lang.String portName,
                         double d)
                  throws java.lang.IllegalArgumentException
Sets the port value. Is used ONLY for evaluating a condition. Throws an IllegalArgumentException if double is not the type of the port.

Parameters:
portName - the port name
d - the double value of the port
Throws:
java.lang.IllegalArgumentException - the illegal argument exception

setPortValue

public void setPortValue(java.lang.String portName,
                         int i)
                  throws java.lang.IllegalArgumentException
Sets the port value. Is used ONLY for evaluating a condition. Throws an IllegalArgumentException if integer is not the type of the port.

Parameters:
portName - the port name
i - the int value of the port
Throws:
java.lang.IllegalArgumentException - the illegal argument exception

setPortValue

public void setPortValue(java.lang.String portName,
                         boolean b)
                  throws java.lang.IllegalArgumentException
Sets the port value. Is used ONLY for evaluating a condition. Throws an IllegalArgumentException if boolean is not the type of the port.

Parameters:
portName - the port name
b - the boolean value of the port
Throws:
java.lang.IllegalArgumentException - the illegal argument exception

getChildren

public java.util.List<AbstractTask> getChildren()
Returns a shallow copy of the direct child tasks. Returns an empty list if no children exist.

Returns:
the children of the task

getUniqueId

public java.lang.String getUniqueId()
Returns path+name, representing an unique identifier.

Returns:
the unique id

isTopLevelTask

public java.lang.Boolean isTopLevelTask()
Checks if the task is the top-level task of an IWIR workflow. A top-level task has no parent.

Returns:
true if task is toplevel

getAllInputPorts

public abstract java.util.List<AbstractDataPort> getAllInputPorts()
Returns a list of all input ports (inputPort, loopPoort,...). For the loopCounter its ports (from,to,step) are added, if they exist.

Returns:
the all input ports

getAllOutputPorts

public abstract java.util.List<AbstractDataPort> getAllOutputPorts()
Returns a list of all output ports (outputPort, unionPort,...).

Returns:
the all input ports

getParentTask

public AbstractTask getParentTask()
Gets the parent task or null if the object is the top-level task.

Returns:
the parent task

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
getUniqueId()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object