org.shiwa.fgi.agwl2iwir.misc
Class SourceSearchHelper

java.lang.Object
  extended by org.shiwa.fgi.agwl2iwir.misc.SourceSearchHelper

public class SourceSearchHelper
extends java.lang.Object

Author:
Margit Mutschlechner

Constructor Summary
SourceSearchHelper()
           
 
Method Summary
static org.shiwa.fgi.iwir.AbstractDataPort searchInChildren(java.lang.String searchedPortName, java.util.List<org.shiwa.fgi.iwir.AbstractTask> childTasks)
          Searches in a given list of child tasks for a port given by its name.
static org.shiwa.fgi.iwir.AbstractPort searchInOwnAllInputPorts(java.lang.String searchedPortName, org.shiwa.fgi.iwir.AbstractCompoundTask myTask, java.util.HashMap<org.shiwa.fgi.iwir.InputPort,java.lang.String> inputPortLinkInfo)
          Searches in all own input ports (eventually also loop ports, loop elements, loop counter) for a given port name.
The search is done for all input ports of one of the own children.
static org.shiwa.fgi.iwir.InputPort searchInOwnInputPortLinkInfo(java.util.Map<org.shiwa.fgi.iwir.InputPort,java.lang.String> inputPortLinkInfo, java.lang.String searchedPortName)
           
static java.util.Map<java.lang.String,org.shiwa.fgi.iwir.AbstractDataPort> searchInOwnInputPortsSwitch(java.util.HashMap<org.shiwa.fgi.iwir.OutputPort,java.util.HashSet<java.lang.String>> outputPortLinkInfo, java.util.List<org.shiwa.fgi.iwir.InputPort> inputPorts, java.lang.String activityName)
          Searches in the own input ports for the source of one of the own output ports.
Used only in the SwitchTranslator.
static org.shiwa.fgi.iwir.LoopPort searchInOwnLoopPorts(java.lang.String searchedPortName, org.shiwa.fgi.iwir.AbstractSimpleCompoundTask task)
          Searches a port given by its name in the own loop ports.
static org.shiwa.fgi.iwir.AbstractDataPort searchInPropertiesOfChildren(java.lang.String searchedPortName, java.util.List<org.shiwa.fgi.iwir.AbstractTask> tasks)
          Searches in the properties of the output ports of the children for a given port name.
Used only in the SwitchTranslator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceSearchHelper

public SourceSearchHelper()
Method Detail

searchInOwnAllInputPorts

public static org.shiwa.fgi.iwir.AbstractPort searchInOwnAllInputPorts(java.lang.String searchedPortName,
                                                                       org.shiwa.fgi.iwir.AbstractCompoundTask myTask,
                                                                       java.util.HashMap<org.shiwa.fgi.iwir.InputPort,java.lang.String> inputPortLinkInfo)
Searches in all own input ports (eventually also loop ports, loop elements, loop counter) for a given port name.
The search is done for all input ports of one of the own children.

Parameters:
searchedPortName - name of the port that has to be searched for
myTask - parent task where the input port has to be searched
inputPortLinkInfo - link info about the input ports of the children
Returns:
the abstract data port that corresponds to the given name or null

searchInOwnInputPortLinkInfo

public static org.shiwa.fgi.iwir.InputPort searchInOwnInputPortLinkInfo(java.util.Map<org.shiwa.fgi.iwir.InputPort,java.lang.String> inputPortLinkInfo,
                                                                        java.lang.String searchedPortName)

searchInOwnLoopPorts

public static org.shiwa.fgi.iwir.LoopPort searchInOwnLoopPorts(java.lang.String searchedPortName,
                                                               org.shiwa.fgi.iwir.AbstractSimpleCompoundTask task)
Searches a port given by its name in the own loop ports.

Parameters:
searchedPortName - name of the port to be searched for
task - in this task's loop ports the given port name has to be searched
Returns:
the loop port that corresponds to the given port name or null

searchInChildren

public static org.shiwa.fgi.iwir.AbstractDataPort searchInChildren(java.lang.String searchedPortName,
                                                                   java.util.List<org.shiwa.fgi.iwir.AbstractTask> childTasks)
Searches in a given list of child tasks for a port given by its name.

Searches in the following order:
- search in output ports. If found return that output port
- search in input ports (if it is not an atomic task). If found create new output port, link the two and return the new output port
- if task is a blockscope call the function recursively for the children of that child (depth first search). If found create new output port, link the two and return the new output port

Parameters:
searchedPortName - name of the port that has to be searched for
childTasks - list of tasks where the port has to be searched
Returns:
the abstract data port that corresponds to the given name or null

searchInPropertiesOfChildren

public static org.shiwa.fgi.iwir.AbstractDataPort searchInPropertiesOfChildren(java.lang.String searchedPortName,
                                                                               java.util.List<org.shiwa.fgi.iwir.AbstractTask> tasks)
Searches in the properties of the output ports of the children for a given port name.
Used only in the SwitchTranslator. When an output port has a link from one of its children that information gets stored in the properties of the output port. Here that information gets searched through.

Parameters:
searchedPortName - name of the port that has to be searched for
tasks - list of child tasks where the corresponding property has to be searched
Returns:
the abstract data port that has a corresponding property or null

searchInOwnInputPortsSwitch

public static java.util.Map<java.lang.String,org.shiwa.fgi.iwir.AbstractDataPort> searchInOwnInputPortsSwitch(java.util.HashMap<org.shiwa.fgi.iwir.OutputPort,java.util.HashSet<java.lang.String>> outputPortLinkInfo,
                                                                                                              java.util.List<org.shiwa.fgi.iwir.InputPort> inputPorts,
                                                                                                              java.lang.String activityName)
Searches in the own input ports for the source of one of the own output ports.
Used only in the SwitchTranslator. Has to be searched separately because the name of the translated IfTask is not the same as the name of the original SwitchActivity. ( <taskName> = <activityName>_branch_<caseValue>)

Parameters:
outputPortLinkInfo - the information about the searched port
inputPorts - list of input ports where the port has to be searched
activityName - name of the original SwitchActivity
Returns:
a map containing the "to" and "from" ports of the link that has to be generated or null if no pair could be found