com.sun.slamd.scripting.engine
Class LoopInstruction

java.lang.Object
  extended bycom.sun.slamd.scripting.engine.Instruction
      extended bycom.sun.slamd.scripting.engine.LoopInstruction

public class LoopInstruction
extends Instruction

This class defines an instruction that will be executed a specified number of times.


Constructor Summary
LoopInstruction(int lineNumber, Argument iterations, Instruction instruction)
          Creates a new loop instruction to perform repeated executions of a specified instruction.
 
Method Summary
 void debugExecute(JobClass jobThread)
          Performs the function associated with this instruction, writing debug information about its execution to the client's message writer using the writeVerbose method.
 void execute(JobClass jobThread)
          Performs the function associated with this instruction.
 Instruction getInstruction()
          Retrieves the instruction that will be executed by this loop.
 Argument getIterationsArgument()
          Retrieves the argument that will be evaluated at runtime to determine the number of iterations to perform.
 java.lang.String toString(int indent)
          Retrieves a string representation of this instruction as could be found in a script file.
 
Methods inherited from class com.sun.slamd.scripting.engine.Instruction
getLineNumber, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoopInstruction

public LoopInstruction(int lineNumber,
                       Argument iterations,
                       Instruction instruction)
Creates a new loop instruction to perform repeated executions of a specified instruction.

Parameters:
lineNumber - The line number in the script on which this loop instruction starts.
iterations - The number of times to execute the instruction.
instruction - The instruction to execute the specified number of times.
Method Detail

getIterationsArgument

public Argument getIterationsArgument()
Retrieves the argument that will be evaluated at runtime to determine the number of iterations to perform.

Returns:
The argument that will be evaluated at runtime to determine the number of iterations to perform.

getInstruction

public Instruction getInstruction()
Retrieves the instruction that will be executed by this loop.

Returns:
The instruction that will be executed by this loop.

execute

public void execute(JobClass jobThread)
             throws ScriptException
Performs the function associated with this instruction.

Specified by:
execute in class Instruction
Parameters:
jobThread - The job thread that will be executing the script.
Throws:
ScriptException - If a problem occurs while processing this instruction.

debugExecute

public void debugExecute(JobClass jobThread)
                  throws ScriptException
Performs the function associated with this instruction, writing debug information about its execution to the client's message writer using the writeVerbose method.

Specified by:
debugExecute in class Instruction
Parameters:
jobThread - The job thread that will be executing the script.
Throws:
ScriptException - If a problem occurs while processing this instruction.

toString

public java.lang.String toString(int indent)
Retrieves a string representation of this instruction as could be found in a script file. It may consist of multiple lines if necessary.

Specified by:
toString in class Instruction
Parameters:
indent - The number of spaces to indent the output.
Returns:
A string representation of this instruction as could be found in a script file.