public class SparseStack
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
private java.lang.Object |
m_current |
Current item.
|
private ObjectStack |
m_items |
Stack of different items (paired with m_levels stack).
|
private int |
m_level |
Current nesting level.
|
private IntStack |
m_levels |
Levels with different items (paired with m_items stack).
|
Constructor | Description |
---|---|
SparseStack() |
Constructor with no initial value.
|
SparseStack(java.lang.Object current) |
Constructor with initial value.
|
Modifier and Type | Method | Description |
---|---|---|
void |
enter() |
Enter a level of nesting.
|
java.lang.Object |
exit() |
Exit a level of nesting with changed item returned.
|
java.lang.Object |
getCurrent() |
Get current object.
|
void |
setCurrent(java.lang.Object obj) |
Set current object.
|
private java.lang.Object m_current
private int m_level
private IntStack m_levels
private ObjectStack m_items
public SparseStack(java.lang.Object current)
current
- initial valuepublic SparseStack()
public java.lang.Object getCurrent()
public void setCurrent(java.lang.Object obj)
obj
- set the current objectpublic void enter()
public java.lang.Object exit()
null
if
same item still active