diff options
Diffstat (limited to 'tutorial/examples/adapter/VectorStack.java')
-rw-r--r-- | tutorial/examples/adapter/VectorStack.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tutorial/examples/adapter/VectorStack.java b/tutorial/examples/adapter/VectorStack.java new file mode 100644 index 0000000..9f14a60 --- /dev/null +++ b/tutorial/examples/adapter/VectorStack.java @@ -0,0 +1,68 @@ +/* + * This code was generated by ojc. + */ +package examples.adapter; + + +import java.util.Enumeration; +import java.util.Vector; + + +public class VectorStack implements examples.adapter.Stack +{ + + java.util.Vector v; + + public VectorStack( java.util.Vector v ) + { + this.v = v; + } + + public void push( java.lang.Object o ) + { + v.addElement( o ); + } + + public java.lang.Object pop() + { + java.lang.Object result = peek(); + v.removeElementAt( v.size() - 1 ); + return result; + } + + public java.lang.Object peek() + { + return v.elementAt( v.size() - 1 ); + } + + + public java.lang.Object[] toArray() + { + return v.toArray(); + } + + + public int size() + { + return v.size(); + } + + + public java.util.Enumeration elements() + { + return v.elements(); + } + + + public boolean isEmpty() + { + return v.isEmpty(); + } + + + public int hashCode() + { + return v.hashCode(); + } + +} |