Package org.jibx.binding.util
Class SparseStack
- java.lang.Object
-
- org.jibx.binding.util.SparseStack
-
public class SparseStack extends java.lang.ObjectStack 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 Modifier and Type Field Description private java.lang.Objectm_currentCurrent item.private ObjectStackm_itemsStack of different items (paired with m_levels stack).private intm_levelCurrent nesting level.private IntStackm_levelsLevels with different items (paired with m_items stack).
-
Constructor Summary
Constructors Constructor Description SparseStack()Constructor with no initial value.SparseStack(java.lang.Object current)Constructor with initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenter()Enter a level of nesting.java.lang.Objectexit()Exit a level of nesting with changed item returned.java.lang.ObjectgetCurrent()Get current object.voidsetCurrent(java.lang.Object obj)Set current object.
-
-
-
Field Detail
-
m_current
private java.lang.Object m_current
Current item.
-
m_level
private int m_level
Current nesting level.
-
m_levels
private IntStack m_levels
Levels with different items (paired with m_items stack).
-
m_items
private ObjectStack m_items
Stack of different items (paired with m_levels stack).
-
-
Method Detail
-
getCurrent
public java.lang.Object getCurrent()
Get current object.- Returns:
- current
-
setCurrent
public void setCurrent(java.lang.Object obj)
Set current object.- Parameters:
obj- set the current object
-
enter
public void enter()
Enter a level of nesting.
-
exit
public java.lang.Object exit()
Exit a level of nesting with changed item returned.- Returns:
- item that was active until this exit, or
nullif same item still active
-
-