public class VariableStack extends Object implements Cloneable
This has been changed from the previous incarnations of this class to be fairly low level.
Modifier and Type | Field and Description |
---|---|
static int |
CLEARLIMITATION
limitation for 1K
|
Constructor and Description |
---|
VariableStack()
Constructor for a variable stack.
|
VariableStack(int initStackSize)
Constructor for a variable stack.
|
Modifier and Type | Method and Description |
---|---|
void |
clearLocalSlots(int start,
int len)
Use this to clear the variables in a section of the stack.
|
Object |
clone()
Returns a clone of this variable stack.
|
XObject |
elementAt(int i)
Get the element at the given index, regardless of stackframe.
|
XObject |
getGlobalVariable(XPathContext xctxt,
int index)
Get a global variable or parameter from the global stack frame.
|
XObject |
getGlobalVariable(XPathContext xctxt,
int index,
boolean destructiveOK)
Get a global variable or parameter from the global stack frame.
|
XObject |
getLocalVariable(int index,
int frame)
Get a local variable or parameter in the current stack frame.
|
XObject |
getLocalVariable(XPathContext xctxt,
int index)
Get a local variable or parameter in the current stack frame.
|
XObject |
getLocalVariable(XPathContext xctxt,
int index,
boolean destructiveOK)
Get a local variable or parameter in the current stack frame.
|
int |
getStackFrame()
Get the position from where the search should start,
which is either the searchStart property, or the top
of the stack if that value is -1.
|
XObject |
getVariableOrParam(XPathContext xctxt,
QName qname)
Get a variable based on it's qualified name.
|
boolean |
isLocalSet(int index)
Tell if a local variable has been set or not.
|
int |
link(int size)
Allocates memory (called a stackframe) on the stack; used to store
local variables and parameter arguments.
|
void |
reset()
Reset the stack to a start position.
|
protected void |
reset(int linksSize,
int varArraySize)
Reset the stack to a start position.
|
void |
setGlobalVariable(int index,
XObject val)
Set a global variable or parameter in the global stack frame.
|
void |
setLocalVariable(int index,
XObject val)
Set a local variable or parameter in the current stack frame.
|
void |
setLocalVariable(int index,
XObject val,
int stackFrame)
Set a local variable or parameter in the specified stack frame.
|
void |
setStackFrame(int sf)
Set the current stack frame.
|
int |
size()
Get size of the stack.
|
void |
unlink()
Free up the stack frame that was last allocated with
link(int size) . |
void |
unlink(int currentFrame)
Free up the stack frame that was last allocated with
link(int size) . |
public static final int CLEARLIMITATION
public VariableStack()
public VariableStack(int initStackSize)
initStackSize
- The initial stack size. Must be at least one. The
stack can grow if needed.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public XObject elementAt(int i)
i
- index from zero.public int size()
public void reset()
protected void reset(int linksSize, int varArraySize)
linksSize
- Initial stack size to usevarArraySize
- Initial variable array size to usepublic void setStackFrame(int sf)
sf
- The new stack frame position.public int getStackFrame()
public int link(int size)
I use the link/unlink concept because of distant Motorola 68000 assembler memories.
size
- The size of the stack frame allocation. This ammount should
normally be the maximum number of variables that you can have allocated
at one time in the new stack frame.public void unlink()
link(int size)
.public void unlink(int currentFrame)
link(int size)
.currentFrame
- The current frame to set to
after the unlink.public void setLocalVariable(int index, XObject val)
index
- Local variable index relative to the current stack
frame bottom.val
- The value of the variable that is being set.public void setLocalVariable(int index, XObject val, int stackFrame)
index
- Local variable index relative to the current stack
frame bottom.
NEEDSDOC @param stackFrameval
- The value of the variable that is being set.public XObject getLocalVariable(XPathContext xctxt, int index) throws TransformerException
xctxt
- The XPath context, which must be passed in order to
lazy evaluate variables.index
- Local variable index relative to the current stack
frame bottom.TransformerException
public XObject getLocalVariable(int index, int frame) throws TransformerException
index
- Local variable index relative to the given
frame bottom.
NEEDSDOC @param frameTransformerException
public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException
xctxt
- The XPath context, which must be passed in order to
lazy evaluate variables.index
- Local variable index relative to the current stack
frame bottom.TransformerException
public boolean isLocalSet(int index) throws TransformerException
index
- Local variable index relative to the current stack
frame bottom.TransformerException
public void clearLocalSlots(int start, int len)
start
- The start position, relative to the current local stack frame.len
- The number of slots to be cleared.public void setGlobalVariable(int index, XObject val)
index
- Local variable index relative to the global stack frame
bottom.val
- The value of the variable that is being set.public XObject getGlobalVariable(XPathContext xctxt, int index) throws TransformerException
xctxt
- The XPath context, which must be passed in order to
lazy evaluate variables.index
- Global variable index relative to the global stack
frame bottom.TransformerException
public XObject getGlobalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException
xctxt
- The XPath context, which must be passed in order to
lazy evaluate variables.index
- Global variable index relative to the global stack
frame bottom.TransformerException
public XObject getVariableOrParam(XPathContext xctxt, QName qname) throws TransformerException
xctxt
- The XPath context, which must be passed in order to
lazy evaluate variables.qname
- The qualified name of the variable.TransformerException
Copyright © 2016 JBoss by Red Hat. All rights reserved.