home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.6 KB | 74 lines |
- // PageVector.java
- // 27.02.96
- //
- // Puts a lot of typecasting in one place
-
- package cybcerone.utils;
-
- import java.util.Vector;
- import java.util.Enumeration;
-
-
- /**
- * This is a Vector of Page objects. See the comments for the
- * Vector class, they all apply. The only difference is that it
- * only takes and returns Page's. Note: I didn't implement
- * the entire set of Vector methods, just the one's I use. I would
- * have extended the Vector class, but most of its methods are final.
- *
- * @see Vector;
- * @see Page;
- */
- public class PageVector {
-
- /* the real Vector behind the scenes */
- private Vector objects;
-
- public PageVector () {
- objects = new Vector ();
- }
-
- public PageVector (int initCapacity) {
- objects = new Vector (initCapacity);
- }
-
- public synchronized void addElement (Page newElement) {
- objects.addElement (newElement);
- }
-
- public synchronized Page elementAt (int index) {
- return (Page)objects.elementAt (index);
- }
-
- public synchronized Page firstElement () {
- return (Page)objects.firstElement ();
- }
-
- public synchronized Page lastElement () {
- return (Page)objects.lastElement ();
- }
-
- /**
- * Ok, so the Page type info is lost in the Enumeration.
- */
- public synchronized Enumeration elements () {
- return objects.elements ();
- }
-
- public int size () {
- return objects.size ();
- }
-
- public boolean isEmpty () {
- return objects.isEmpty ();
- }
-
- public synchronized void removeElementAt (int index) {
- objects.removeElementAt (index);
- }
-
- public synchronized String toString () {
- return objects.toString ();
- }
- }
-