Class PipelineFunctions

java.lang.Object
mgui.pipelines.PipelineFunctions

public class PipelineFunctions
extends java.lang.Object
Provides a set of common functions operating on pipeline objects. TODO: Replace Foxtrot with native Java threading
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Summary

    Fields
    Modifier and Type Field Description
    static boolean fail_on_exception  
  • Constructor Summary

    Constructors
    Constructor Description
    PipelineFunctions()  
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String getArgString​(java.lang.String[] args)  
    static java.util.ArrayList<java.lang.String> getWildcardFiles​(java.io.File dir, java.lang.String pattern)
    Returns a list of all files that match the specified wildcard pattern.
    static java.util.ArrayList<java.lang.String> getWildcardFiles​(java.io.File dir, java.lang.String pattern, java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> value_map)
    Returns a list of all files that match the specified wildcard pattern.
    static boolean launchBlockingPipelineProcess​(PipelineProcessInstance process_instance, java.lang.String instance, InterfaceProject project, java.lang.String logger, PipelineState state)
    Launches a pipeline process instance and blocks until it terminates.
    static boolean launchPipelineAsJob​(InterfacePipeline pipeline, boolean blocking)  
    static boolean launchPipelineProcess​(PipelineProcessInstance process, boolean blocking, PipelineState state)  
    static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, java.lang.String logger, boolean blocking, PipelineState state)  
    static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, java.lang.String logger, PipelineState state)  
    static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, PipelineState state)  
    static boolean launchPipelineProcess​(PipelineProcessInstance process, PipelineState state)  
    static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg)  
    static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, java.lang.String root_dir)
    Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including: instance The current pipeline instance root The current root directory instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended) project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
    static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, java.lang.String root_dir, java.lang.String instance_dir, java.lang.String project_dir)
    Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including: instance The current pipeline instance root_dir The current root directory instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended) project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
    static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, InterfaceProject project)
    Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including: instance The current pipeline instance root The current root directory instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended) project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
    protected static void processCompleted​(PipelineProcessInstance process, boolean success, PipelineState state)
    Called when a SwingWorker invoked by launchPipelineProcess completes.
    static java.lang.String setParameterVariables​(java.lang.String param, java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> variables, int idx)
    Replaces all variables in param with the values in variables.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fail_on_exception

      public static boolean fail_on_exception
  • Constructor Details

    • PipelineFunctions

      public PipelineFunctions()
  • Method Details

    • launchPipelineProcess

      public static boolean launchPipelineProcess​(PipelineProcessInstance process, PipelineState state)
    • launchPipelineProcess

      public static boolean launchPipelineProcess​(PipelineProcessInstance process, boolean blocking, PipelineState state)
    • launchPipelineProcess

      public static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, PipelineState state)
    • launchPipelineProcess

      public static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, java.lang.String logger, PipelineState state)
    • launchPipelineProcess

      public static boolean launchPipelineProcess​(PipelineProcessInstance process, java.lang.String instance, InterfaceProject project, java.lang.String logger, boolean blocking, PipelineState state)
    • processCompleted

      protected static void processCompleted​(PipelineProcessInstance process, boolean success, PipelineState state)
      Called when a SwingWorker invoked by launchPipelineProcess completes.
      Parameters:
      process -
      instance -
      project -
      logger -
      blocking -
      state -
    • launchBlockingPipelineProcess

      public static boolean launchBlockingPipelineProcess​(PipelineProcessInstance process_instance, java.lang.String instance, InterfaceProject project, java.lang.String logger, PipelineState state)
      Launches a pipeline process instance and blocks until it terminates.
      Parameters:
      process_instance -
      instance -
      project -
      logger -
      state -
      Returns:
    • launchPipelineAsJob

      public static boolean launchPipelineAsJob​(InterfacePipeline pipeline, boolean blocking) throws PipelineException
      Throws:
      PipelineException
    • getArgString

      public static java.lang.String getArgString​(java.lang.String[] args)
    • parseArg

      public static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg)
    • parseArg

      public static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, InterfaceProject project)
      Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including:
      • instance The current pipeline instance
      • root The current root directory
      • instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended)
      • project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
      Parameters:
      arg -
      subject -
      root -
      Returns:
    • parseArg

      public static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, java.lang.String root_dir)
      Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including:
      • instance The current pipeline instance
      • root The current root directory
      • instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended)
      • project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
      Parameters:
      arg -
      subject -
      root -
      Returns:
    • parseArg

      public static java.util.ArrayList<java.lang.String> parseArg​(java.lang.String arg, java.lang.String instance, java.lang.String root_dir, java.lang.String instance_dir, java.lang.String project_dir)
      Parses an argument, replacing special symbols contained within "{" and "}" characters with their value; including:
      • instance The current pipeline instance
      • root_dir The current root directory
      • instances_dir The subdirectory for instance data (relative to root; note that root_dir will be prepended to this string, and instance will be appended)
      • project_dir The subdirectory for project data (relative to root; note that root_dir will be prepended to this string)
      Parameters:
      arg -
      subject -
      root -
      Returns:
    • getWildcardFiles

      public static java.util.ArrayList<java.lang.String> getWildcardFiles​(java.io.File dir, java.lang.String pattern)
      Returns a list of all files that match the specified wildcard pattern. Wildcards are specified with the "%" character.
      Parameters:
      pattern -
      Returns:
    • getWildcardFiles

      public static java.util.ArrayList<java.lang.String> getWildcardFiles​(java.io.File dir, java.lang.String pattern, java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> value_map)
      Returns a list of all files that match the specified wildcard pattern. Wildcards are specified with the "*" character. Additionally, if a sequence of alphanumeric characters is inserted between two "%" characters, its value will be stored in the value_map, assuming this is not null.
      Parameters:
      pattern -
      value_map - Map of value names with patterns matching them; this will be populated by the function, and associates variable names with lists having an entry for each returned file
      Returns:
    • setParameterVariables

      public static java.lang.String setParameterVariables​(java.lang.String param, java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> variables, int idx)
      Replaces all variables in param with the values in variables. Variables in a parameter value must be specified by their name, wrapped in "%"

      Example "blah_%var1%.dat" will replace the text "%var1%" with the idxth entry in the list found in variables.get("var1").

      Parameters:
      param -
      variables -
      i -
      Returns: