public class Stacks
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
Stacks.StackInstance |
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ConcurrentHashMap<java.lang.String,Stacks.StackInstance> |
stacks |
(package private) java.io.File |
stacksLocation |
(package private) java.lang.String |
stacksPrefix |
Constructor and Description |
---|
Stacks(java.io.File stacksLocation,
java.lang.String stacksPrefix)
create a stack organizing object.
|
Modifier and Type | Method and Description |
---|---|
Stack.Entry |
bot(java.lang.String stack)
return the bottom element of the stack.
|
void |
close()
close all stack files
|
void |
finalize() |
byte[] |
get(java.lang.String stack,
long handle)
get an element from the stack using the handle
|
private Stack |
getStack(java.lang.String stack) |
java.util.Iterator<java.lang.Long> |
handles(java.lang.String stack)
Iterate all handles from a stack as Long numbers
|
Stack.Entry |
pop(java.lang.String stack)
remove the top element from the stack
|
Stack.Entry |
pot(java.lang.String stack)
remove the bottom element from the stack
|
long |
push(java.lang.String stack,
byte[] b)
push a new element on the top of the stack
|
protected void |
push(java.lang.String stack,
Stack.Entry e)
push a new element on the top of the stack using a entry object
this is only useful for internal processes where a special handle
is created
|
byte[] |
remove(java.lang.String stack,
long handle)
remove an element from the stack using the entry handle
|
int |
size()
get the number of stacks organized by this object
|
int |
size(java.lang.String stack)
get the size of a stack
|
java.util.Iterator<java.lang.String> |
stacks()
iterate all stack names
|
Stack.Entry |
top(java.lang.String stack)
return the top element of the stack.
|
java.io.File stacksLocation
java.lang.String stacksPrefix
private final java.util.concurrent.ConcurrentHashMap<java.lang.String,Stacks.StackInstance> stacks
public Stacks(java.io.File stacksLocation, java.lang.String stacksPrefix)
stackFile
- java.io.IOException
private Stack getStack(java.lang.String stack)
public int size()
public java.util.Iterator<java.lang.String> stacks()
public int size(java.lang.String stack)
stack
- the name of the stackpublic java.util.Iterator<java.lang.Long> handles(java.lang.String stack) throws java.io.IOException
stack
- the name of the stackjava.io.IOException
public long push(java.lang.String stack, byte[] b) throws java.io.IOException, SpaceExceededException
stack
- the name of the stackb
- the new stack elementjava.io.IOException
SpaceExceededException
protected void push(java.lang.String stack, Stack.Entry e) throws java.io.IOException, SpaceExceededException
stack
- the name of the stackb
- the new stack elementjava.io.IOException
SpaceExceededException
public byte[] get(java.lang.String stack, long handle) throws java.io.IOException, SpaceExceededException
stack
- the name of the stackhandle
- java.io.IOException
SpaceExceededException
public byte[] remove(java.lang.String stack, long handle) throws java.io.IOException, SpaceExceededException
stack
- the name of the stackhandle
- java.io.IOException
SpaceExceededException
public Stack.Entry pop(java.lang.String stack) throws java.io.IOException
stack
- the name of the stackjava.io.IOException
public Stack.Entry top(java.lang.String stack) throws java.io.IOException
stack
- the name of the stackjava.io.IOException
public Stack.Entry pot(java.lang.String stack) throws java.io.IOException
stack
- the name of the stackjava.io.IOException
public Stack.Entry bot(java.lang.String stack) throws java.io.IOException
stack
- the name of the stackjava.io.IOException
public void close()
public void finalize()
finalize
in class java.lang.Object