996
|
1 // This software is Public Domain.
|
|
2
|
|
3 import java.util.Stack;
|
|
4
|
|
5 public class GlyphoStack {
|
|
6 protected Stack stack;
|
|
7
|
|
8 public GlyphoStack() {
|
|
9 stack = new Stack();
|
|
10 }
|
|
11
|
|
12 public GlyphoStack(Stack s) {
|
|
13 stack = s;
|
|
14 }
|
|
15
|
|
16 public void clear() {
|
|
17 stack.clear();
|
|
18 }
|
|
19
|
|
20 public boolean empty() {
|
|
21 return stack.empty();
|
|
22 }
|
|
23
|
|
24 public int peek() {
|
|
25 return ((Integer)stack.peek()).intValue();
|
|
26 }
|
|
27
|
|
28 public int pop() {
|
|
29 return ((Integer)stack.pop()).intValue();
|
|
30 }
|
|
31
|
|
32 public int push(int value) {
|
|
33 return ((Integer)stack.push(new Integer(value))).intValue();
|
|
34 }
|
|
35
|
|
36 public int popBottom() {
|
|
37 return ((Integer)stack.remove(0)).intValue();
|
|
38 }
|
|
39
|
|
40 public void pushBottom(int value) {
|
|
41 stack.add(0, new Integer(value));
|
|
42 }
|
|
43
|
|
44 public String toString() {
|
|
45 return stack.toString();
|
|
46 }
|
|
47
|
|
48 } |