Package org.web3d.util
Class SimpleStackLogged
java.lang.Object
org.web3d.util.SimpleStack
org.web3d.util.SimpleStackLogged
- All Implemented Interfaces:
SimpleStackInterface
A stack that has a minimal implementation and no sychronisation.
Looks all activity to help in debugging.
This stack is designed to be used in a high-speed, single threaded environment. It is directly backed by an array for fast access.
- Version:
- $Revision: 1.10 $
- Author:
- Alan Hudson
- See Also:
-
Field Summary
Fields inherited from class org.web3d.util.SimpleStack
STACK_START_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty hashtable with a default capacity and load factor, which is20
respectively.SimpleStackLogged
(int initialCapacity) Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is0.75
.SimpleStackLogged
(int initialCapacity, String name) Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is0.75
.SimpleStackLogged
(String name) Constructs a new, empty hashtable with a default capacity and load factor, which is20
respectively. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears this stack so that it contains no values.peek()
Peek at the value on the top of the stack without removing it.pop()
Pop the value from the top of the stack.void
Push a new value onto the top of the stack.void
Remove the given object from the stack if it exists.void
setDebugCalls
(boolean debug) Should we display all calls to this stack.Get a string representation of the history.Methods inherited from class org.web3d.util.SimpleStack
contains, isEmpty, size, toString
-
Constructor Details
-
SimpleStackLogged
public SimpleStackLogged()Constructs a new, empty hashtable with a default capacity and load factor, which is20
respectively. -
SimpleStackLogged
Constructs a new, empty hashtable with a default capacity and load factor, which is20
respectively.- Parameters:
name
-
-
SimpleStackLogged
public SimpleStackLogged(int initialCapacity) Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is0.75
.- Parameters:
initialCapacity
- the initial capacity of the hashtable.- Throws:
IllegalArgumentException
- if the initial capacity is less than zero.
-
SimpleStackLogged
Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is0.75
.- Parameters:
initialCapacity
- the initial capacity of the hashtable.name
-- Throws:
IllegalArgumentException
- if the initial capacity is less than zero.
-
-
Method Details
-
setDebugCalls
public void setDebugCalls(boolean debug) Should we display all calls to this stack.- Parameters:
debug
- Debug calls
-
push
Push a new value onto the top of the stack. The value may be any legal reference to an object including null.- Specified by:
push
in interfaceSimpleStackInterface
- Overrides:
push
in classSimpleStack
- Parameters:
val
- The new value for the stack.
-
pop
Pop the value from the top of the stack. If the last value in the stack was null then this will return null.- Specified by:
pop
in interfaceSimpleStackInterface
- Overrides:
pop
in classSimpleStack
- Returns:
- The top object on the stack
-
peek
Peek at the value on the top of the stack without removing it. If the value pushed was null, then null is returned here.- Specified by:
peek
in interfaceSimpleStackInterface
- Overrides:
peek
in classSimpleStack
- Returns:
- A reference to the object on the top of the stack
- Throws:
EmptyStackException
- The stack is currently empty
-
remove
Remove the given object from the stack if it exists. If it is not in the stack, then ignore it quietly.- Specified by:
remove
in interfaceSimpleStackInterface
- Overrides:
remove
in classSimpleStack
- Parameters:
obj
- The object to be removed
-
clear
public void clear()Clears this stack so that it contains no values.- Specified by:
clear
in interfaceSimpleStackInterface
- Overrides:
clear
in classSimpleStack
-
toStringHistory
-