APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal

public Class VariableStack

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack
Imports
javax.xml.transform.TransformerException, com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xpath.internal.objects.XObject, com.sun.org.apache.xpath.internal.res.XPATHErrorResources

Defines a class to keep track of a stack for template arguments and variables.

This has been changed from the previous incarnations of this class to be fairly low level.

Field Summary

Modifier and TypeField and Description
private int
_currentFrameBottom

The bottom index of the current frame (relative to _stackFrames).

pack-priv int
_frameTop

The top of the stack frame (_stackFrames).

pack-priv int[]
_links

The stack of frame positions.

pack-priv int
_linksTop

The top of the links stack.

pack-priv XObject[]
_stackFrames

The stack frame where all variables and params will be kept.

public static final int
CLEARLIMITATION

limitation for 1K

private static XObject[]
m_nulls

NEEDSDOC Field m_nulls

Constructor Summary

AccessConstructor and Description
public
VariableStack()

Constructor for a variable stack.

Method Summary

Modifier and TypeMethod and Description
public void
clearLocalSlots(int
The start position, relative to the current local stack frame.
start
,
int
The number of slots to be cleared.
len
)

Use this to clear the variables in a section of the stack.

public synchronized Object

Returns:

a clone of this variable stack.
clone
()

Overrides java.lang.Object.clone.

Returns a clone of this variable stack.

public XObject

Returns:

The item at the given index.
elementAt
(final int
index from zero.
i
)

Get the element at the given index, regardless of stackframe.

public XObject

Returns:

The value of the variable.
getGlobalVariable
(XPathContext
The XPath context, which must be passed in order to lazy evaluate variables.
xctxt
,
final int
Global variable index relative to the global stack frame bottom.
index
)

Get a global variable or parameter from the global stack frame.

public XObject

Returns:

The value of the variable.
getGlobalVariable
(XPathContext
The XPath context, which must be passed in order to lazy evaluate variables.
xctxt
,
final int
Global variable index relative to the global stack frame bottom.
index
,
boolean destructiveOK)

Get a global variable or parameter from the global stack frame.

public XObject

Returns:

The value of the variable.
getLocalVariable
(XPathContext
The XPath context, which must be passed in order to lazy evaluate variables.
xctxt
,
int
Local variable index relative to the current stack frame bottom.
index
)

Get a local variable or parameter in the current stack frame.

public XObject

Returns:

The value of the variable.
getLocalVariable
(int
Local variable index relative to the given frame bottom. NEEDSDOC @param frame
index
,
int frame)

Get a local variable or parameter in the current stack frame.

public XObject

Returns:

The value of the variable.
getLocalVariable
(XPathContext
The XPath context, which must be passed in order to lazy evaluate variables.
xctxt
,
int
Local variable index relative to the current stack frame bottom.
index
,
boolean destructiveOK)

Get a local variable or parameter in the current stack frame.

public int

Returns:

The current stack frame position.
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.

public XObject

Returns:

The evaluated value of the variable.
getVariableOrParam
(XPathContext
The XPath context, which must be passed in order to lazy evaluate variables.
xctxt
,
QName
The qualified name of the variable.
qname
)

Get a variable based on it's qualified name.

public boolean

Returns:

true if the value at the index is not null.
isLocalSet
(int
Local variable index relative to the current stack frame bottom.
index
)

Tell if a local variable has been set or not.

public void

Returns:

the total size of the execution stack.
reset
()

Reset the stack to a start position.

public void
setGlobalVariable(final int
Local variable index relative to the global stack frame bottom.
index
,
final XObject
The value of the variable that is being set.
val
)

Set a global variable or parameter in the global stack frame.

public void
setLocalVariable(int
Local variable index relative to the current stack frame bottom.
index
,
XObject
The value of the variable that is being set.
val
)

Set a local variable or parameter in the current stack frame.

public void
setLocalVariable(int
Local variable index relative to the current stack frame bottom. NEEDSDOC @param stackFrame
index
,
XObject
The value of the variable that is being set.
val
,
int stackFrame)

Set a local variable or parameter in the specified stack frame.

public void
setStackFrame(int
The new stack frame position.
sf
)

Set the current stack frame.

public int

Returns:

the total size of the execution stack.
size
()

Get size of the stack.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_currentFrameBottomback to summary
private int _currentFrameBottom

The bottom index of the current frame (relative to _stackFrames).

_frameTopback to summary
pack-priv int _frameTop

The top of the stack frame (_stackFrames).

_linksTopback to summary
pack-priv int _linksTop

The top of the links stack.

_stackFramesback to summary
pack-priv XObject[] _stackFrames

The stack frame where all variables and params will be kept.

CLEARLIMITATIONback to summary
public static final int CLEARLIMITATION

limitation for 1K

m_nullsback to summary
private static XObject[] m_nulls

NEEDSDOC Field m_nulls

Constructor Detail

VariableStackback to summary
public VariableStack()

Constructor for a variable stack.

Method Detail

clearLocalSlotsback to summary
public void clearLocalSlots(int start, int len)

Use this to clear the variables in a section of the stack. This is used to clear the parameter section of the stack, so that default param values can tell if they've already been set. It is important to note that this function has a 1K limitation.

Parameters
start:int

The start position, relative to the current local stack frame.

len:int

The number of slots to be cleared.

cloneback to summary
public synchronized Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Returns a clone of this variable stack.

Returns:Object

a clone of this variable stack.

Exceptions
CloneNotSupportedException:

Doc from java.lang.Object.clone.

if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

elementAtback to summary
public XObject elementAt(final int i)

Get the element at the given index, regardless of stackframe.

Parameters
i:int

index from zero.

Returns:XObject

The item at the given index.

getGlobalVariableback to summary
public XObject getGlobalVariable(XPathContext xctxt, final int index) throws TransformerException

Get a global variable or parameter from the global stack frame.

Parameters
xctxt:XPathContext

The XPath context, which must be passed in order to lazy evaluate variables.

index:int

Global variable index relative to the global stack frame bottom.

Returns:XObject

The value of the variable.

getGlobalVariableback to summary
public XObject getGlobalVariable(XPathContext xctxt, final int index, boolean destructiveOK) throws TransformerException

Get a global variable or parameter from the global stack frame.

Parameters
xctxt:XPathContext

The XPath context, which must be passed in order to lazy evaluate variables.

index:int

Global variable index relative to the global stack frame bottom.

Returns:XObject

The value of the variable.

getLocalVariableback to summary
public XObject getLocalVariable(XPathContext xctxt, int index) throws TransformerException

Get a local variable or parameter in the current stack frame.

Parameters
xctxt:XPathContext

The XPath context, which must be passed in order to lazy evaluate variables.

index:int

Local variable index relative to the current stack frame bottom.

Returns:XObject

The value of the variable.

getLocalVariableback to summary
public XObject getLocalVariable(int index, int frame) throws TransformerException

Get a local variable or parameter in the current stack frame.

Parameters
index:int

Local variable index relative to the given frame bottom. NEEDSDOC @param frame

Returns:XObject

The value of the variable.

getLocalVariableback to summary
public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException

Get a local variable or parameter in the current stack frame.

Parameters
xctxt:XPathContext

The XPath context, which must be passed in order to lazy evaluate variables.

index:int

Local variable index relative to the current stack frame bottom.

Returns:XObject

The value of the variable.

getStackFrameback to summary
public 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.

Returns:int

The current stack frame position.

getVariableOrParamback to summary
public XObject getVariableOrParam(XPathContext xctxt, QName qname) throws TransformerException

Get a variable based on it's qualified name. This is for external use only.

Parameters
xctxt:XPathContext

The XPath context, which must be passed in order to lazy evaluate variables.

qname:QName

The qualified name of the variable.

Returns:XObject

The evaluated value of the variable.

isLocalSetback to summary
public boolean isLocalSet(int index) throws TransformerException

Tell if a local variable has been set or not.

Parameters
index:int

Local variable index relative to the current stack frame bottom.

Returns:boolean

true if the value at the index is not null.

resetback to summary
public void reset()

Reset the stack to a start position.

Returns:void

the total size of the execution stack.

setGlobalVariableback to summary
public void setGlobalVariable(final int index, final XObject val)

Set a global variable or parameter in the global stack frame.

Parameters
index:int

Local variable index relative to the global stack frame bottom.

val:XObject

The value of the variable that is being set.

setLocalVariableback to summary
public void setLocalVariable(int index, XObject val)

Set a local variable or parameter in the current stack frame.

Parameters
index:int

Local variable index relative to the current stack frame bottom.

val:XObject

The value of the variable that is being set.

setLocalVariableback to summary
public void setLocalVariable(int index, XObject val, int stackFrame)

Set a local variable or parameter in the specified stack frame.

Parameters
index:int

Local variable index relative to the current stack frame bottom. NEEDSDOC @param stackFrame

val:XObject

The value of the variable that is being set.

setStackFrameback to summary
public void setStackFrame(int sf)

Set the current stack frame.

Parameters
sf:int

The new stack frame position.

sizeback to summary
public int size()

Get size of the stack.

Returns:int

the total size of the execution stack.