frysk.hpd
Class StartRun

java.lang.Object
  extended by frysk.hpd.Command
      extended by frysk.hpd.ParameterizedCommand
          extended by frysk.hpd.StartRun
Direct Known Subclasses:
RunCommand, StartCommand

abstract class StartRun
extends ParameterizedCommand

Due to a lot of similar code in StartCommand/RunCommand this class was created to consolidate most of the methods to one code base.


Nested Class Summary
private static class StartRun.Runner
           
 
Field Summary
(package private)  HashMap procProcArgs
           
(package private)  HashMap procProcCommand
           
(package private)  HashMap procTaskDataList
           
(package private)  PTSet userSet
           
 
Constructor Summary
StartRun(String command, String help1, String help2)
           
 
Method Summary
private  String asString(String[] params)
          asString takes an array of parameters and converts it to a single string of command/params as would be appropriate for a commandline
(package private)  int completer(CLI cli, Input input, int cursor, List completions)
          Complete the command's parameters.
 void interpretCmd(CLI cli, Input cmd, Object options, boolean runToBreak)
           
private  boolean killProcs(CLI cli)
          killProcs loops through the current target set to see if there are any tasks to kill, the philosophy being that all tasks should be killed before
private  String[] makeCommand(String[] params, int parentID, CLI cli)
          makeCommand takes the previous command and a new set of parameters and creates a new command.
private  void run(CLI cli, Input cmd, String command, boolean runToBreak, int taskid)
          run takes a passed proc from the target set and runs it
private  void setParams(Input cmd, CLI cli)
          setParams will take the passed parameters by the run/start commands and makes them the new current parameters.
 
Methods inherited from class frysk.hpd.ParameterizedCommand
add, complete, help, interpret, interpret, options
 
Methods inherited from class frysk.hpd.Command
description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

procTaskDataList

final HashMap procTaskDataList

procProcCommand

final HashMap procProcCommand

procProcArgs

final HashMap procProcArgs

userSet

PTSet userSet
Constructor Detail

StartRun

StartRun(String command,
         String help1,
         String help2)
Method Detail

interpretCmd

public void interpretCmd(CLI cli,
                         Input cmd,
                         Object options,
                         boolean runToBreak)

setParams

private void setParams(Input cmd,
                       CLI cli)
setParams will take the passed parameters by the run/start commands and makes them the new current parameters.

Parameters:
params - is a String[] containing the new params
cli - is the current commandline interface object

makeCommand

private String[] makeCommand(String[] params,
                             int parentID,
                             CLI cli)
makeCommand takes the previous command and a new set of parameters and creates a new command. This new command is stored in the cli.ptsetParams HashMap.

Parameters:
params - is the String array of parameters passed via a run or start command
Returns:
returns a String[]

killProcs

private boolean killProcs(CLI cli)
killProcs loops through the current target set to see if there are any tasks to kill, the philosophy being that all tasks should be killed before

Parameters:
cli - is the command line object
Returns:
true if there were procs to kill, false if there weren't

run

private void run(CLI cli,
                 Input cmd,
                 String command,
                 boolean runToBreak,
                 int taskid)
run takes a passed proc from the target set and runs it

Parameters:
cli - is the commandline object
cmd - is the command object with all the parameters
command - is a string containing the command to run
runToBreak - true if the process is to run to the first break point or until it blows up("run" command), false if it should stop at the first executable statement("start" command)
taskid - the internal target set id that should be used for this process

asString

private String asString(String[] params)
asString takes an array of parameters and converts it to a single string of command/params as would be appropriate for a commandline

Parameters:
params - is a String array with the first position in the array is the command to be run and the rest of the positions are params to pass to the command(if any)
Returns:
a String containing the command to be run follwed by its parameters (if there are any)

completer

int completer(CLI cli,
              Input input,
              int cursor,
              List completions)
Description copied from class: ParameterizedCommand
Complete the command's parameters.

Specified by:
completer in class ParameterizedCommand