fr.umlv.corosol.component.impl
Class VerboseJThread

java.lang.Object
  extended by fr.umlv.corosol.component.impl.VerboseJThread
All Implemented Interfaces:
JObject, JThread

public class VerboseJThread
extends java.lang.Object
implements JThread

The verbose implementation of the JThread interface.

Author:
DELERAY Christophe

Field Summary
 
Fields inherited from interface fr.umlv.corosol.component.JThread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
VerboseJThread()
          The default constructor.
 
Method Summary
 void execNextInstruction()
          Executes the next instruction of the current method.
 JClass getCurrentClass()
          Returns the class of the method being executed.
 JStackFrame getCurrentFrame()
          Returns the current frame of the current method.
 JClassMethod getCurrentMethod()
          Returns the method being executed.
 JavaStack getJavaStack()
          Returns the Java Stack of this thread.
 JOperandInput getOperandInput()
          Returns an input stream that reads the operands of the current bytecode instruction.
 int getPC()
          Returns the program counter value.
 int getPriority()
          Returns this thread's priority.
 boolean hasMoreInstructions()
          Determines if there are instructions to execute.
 void incPC(int offset)
          Increments the program counter with the specified offset value.
 void pushContext(JClassMethod method)
          Pushes the next execution context for the execution of the specified method.
 void restoreContext()
          Restores the thread to its previous execution context.
 void setPC(int pc)
          Sets the program counter with the specified value.
 void setPriority(int newPriority)
          Changes the priority of this thread.
 java.lang.String toString()
          Returns a String representation of this thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VerboseJThread

public VerboseJThread()
The default constructor.

Method Detail

getJavaStack

public JavaStack getJavaStack()
Returns the Java Stack of this thread.

Specified by:
getJavaStack in interface JThread

getPriority

public int getPriority()
Returns this thread's priority.

Specified by:
getPriority in interface JThread
Returns:
this thread's priority.
See Also:
setPriority(int), JThread.setPriority(int)

setPriority

public void setPriority(int newPriority)
Changes the priority of this thread. Tthe priority of this thread is set to the smaller of the specified newPriority and the maximum permitted priority.

Specified by:
setPriority in interface JThread
Parameters:
newPriority - priority to set this thread to
Throws:
java.lang.IllegalArgumentException - if the priority is not in the range MIN_PRIORITY to MAX_PRIORITY.
See Also:
JThread.getPriority(), JThread.MAX_PRIORITY, JThread.NORM_PRIORITY, JThread.MIN_PRIORITY

getCurrentClass

public JClass getCurrentClass()
Returns the class of the method being executed.

Specified by:
getCurrentClass in interface JThread

getCurrentFrame

public JStackFrame getCurrentFrame()
Returns the current frame of the current method.

Specified by:
getCurrentFrame in interface JThread

getCurrentMethod

public JClassMethod getCurrentMethod()
Returns the method being executed.

Specified by:
getCurrentMethod in interface JThread

getPC

public int getPC()
Returns the program counter value.

Specified by:
getPC in interface JThread

setPC

public void setPC(int pc)
Sets the program counter with the specified value.

Specified by:
setPC in interface JThread
Parameters:
pc - the program counter

incPC

public void incPC(int offset)
Increments the program counter with the specified offset value.

Specified by:
incPC in interface JThread
Parameters:
offset - a value for increment the current program counter

pushContext

public void pushContext(JClassMethod method)
Pushes the next execution context for the execution of the specified method.

Specified by:
pushContext in interface JThread
Parameters:
method - the method to be executed

restoreContext

public void restoreContext()
Restores the thread to its previous execution context.

Specified by:
restoreContext in interface JThread

hasMoreInstructions

public boolean hasMoreInstructions()
Determines if there are instructions to execute.

Specified by:
hasMoreInstructions in interface JThread
Returns:
true if there are instructions to execute and false otherwise.

execNextInstruction

public void execNextInstruction()
                         throws java.lang.Throwable
Executes the next instruction of the current method.

Specified by:
execNextInstruction in interface JThread
Throws:
java.lang.IllegalStateException - if there isn't instruction to execute
java.lang.Throwable - if an exception occurs during execution

toString

public java.lang.String toString()
Returns a String representation of this thread.

Overrides:
toString in class java.lang.Object

getOperandInput

public JOperandInput getOperandInput()
Returns an input stream that reads the operands of the current bytecode instruction.

Specified by:
getOperandInput in interface JThread
Returns:
an input stream reading the current instruction operands