Package org.jibx.binding.util
Class SparseStack
java.lang.Object
org.jibx.binding.util.SparseStack
Stack for values that depend on the level of nesting, where only some of the
levels change the current value.
- Author:
- Dennis M. Sosnoski
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no initial value.SparseStack
(Object current) Constructor with initial value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
enter()
Enter a level of nesting.exit()
Exit a level of nesting with changed item returned.Get current object.void
setCurrent
(Object obj) Set current object.
-
Field Details
-
m_current
Current item. -
m_level
private int m_levelCurrent nesting level. -
m_levels
Levels with different items (paired with m_items stack). -
m_items
Stack of different items (paired with m_levels stack).
-
-
Constructor Details
-
SparseStack
Constructor with initial value.- Parameters:
current
- initial value
-
SparseStack
public SparseStack()Constructor with no initial value.
-
-
Method Details
-
getCurrent
Get current object.- Returns:
- current
-
setCurrent
Set current object.- Parameters:
obj
- set the current object
-
enter
public void enter()Enter a level of nesting. -
exit
Exit a level of nesting with changed item returned.- Returns:
- item that was active until this exit, or
null
if same item still active
-