fr.umlv.corosol.component.impl
Class DefaultJavaStack

java.lang.Object
  extended by fr.umlv.corosol.component.impl.DefaultJavaStack
All Implemented Interfaces:
JAllocatable, JavaStack, JObject

public class DefaultJavaStack
extends java.lang.Object
implements JavaStack

The default implementation of the JavaStack interface which represents a thread stack.

Author:
DELERAY Christophe

Constructor Summary
DefaultJavaStack(JHeap heap)
          Creates a new java stack allocated into the specified heap.
 
Method Summary
 int getPosition()
          Returns the position of the first byte of the memory allocated for the Java stack representing by this JavaStack object into the Corosol heap memory.
 int getSize()
          Returns the size in bytes of this object into the Corosol memory heap.
 boolean isEmpty()
          Tests if this stack is empty.
 JStackFrame peekFrame()
          Returns the current frame corresponding to the frame at the top of this stack.
 void popFrame()
          Pops the current frame corresponding to the frame at the top of this stack.
 void pushFrame(JClassMethod method)
          Pushes a new frame which will be used for the execution of the specified method.
 void setPosition(int index)
          Sets the position of the first byte of the memory allocated for the Java stack representing by this JavaStack object into the Corosol heap memory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJavaStack

public DefaultJavaStack(JHeap heap)
Creates a new java stack allocated into the specified heap.

Parameters:
heap - the heap where this Java Stack are allocated
Method Detail

getPosition

public int getPosition()
Returns the position of the first byte of the memory allocated for the Java stack representing by this JavaStack object into the Corosol heap memory.

Specified by:
getPosition in interface JAllocatable
Returns:
the position of the first byte of the memory allocated for this Java stack into the Corosol heap memory

setPosition

public void setPosition(int index)
Sets the position of the first byte of the memory allocated for the Java stack representing by this JavaStack object into the Corosol heap memory.

Specified by:
setPosition in interface JAllocatable
Parameters:
index - the position of the first byte of the memory allocated for this Java stack into the Corosol heap memory.

getSize

public int getSize()
Returns the size in bytes of this object into the Corosol memory heap.

Specified by:
getSize in interface JAllocatable

pushFrame

public void pushFrame(JClassMethod method)
Pushes a new frame which will be used for the execution of the specified method.

Specified by:
pushFrame in interface JavaStack
Parameters:
method - a method

popFrame

public void popFrame()
Pops the current frame corresponding to the frame at the top of this stack.

Specified by:
popFrame in interface JavaStack
Throws:
java.lang.EmptyStackException - if java stack is empty

peekFrame

public JStackFrame peekFrame()
Returns the current frame corresponding to the frame at the top of this stack.

Specified by:
peekFrame in interface JavaStack
Returns:
the current frame
Throws:
java.lang.EmptyStackException - if java stack is empty

isEmpty

public boolean isEmpty()
Tests if this stack is empty.

Specified by:
isEmpty in interface JavaStack
Returns:
true if the stack is empty and false otherwise