home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.8 KB | 85 lines |
- // FaculteVector.java
- // 27.02.96
- //
- // Puts a lot of typecasting in one place
-
- package cybcerone.utils;
-
- import java.util.Vector;
- import java.util.Enumeration;
-
-
- /**
- * A Vector of Faculte objects. See the comments for the
- * Vector class, they all apply. The only difference is that it
- * only takes and returns Faculte'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 Faculte;
- */
- public class FaculteVector {
-
- /* the real Vector behind the scenes */
- private Vector objects;
-
- public FaculteVector () {
- objects = new Vector ();
- }
-
- public FaculteVector (int initCapacity) {
- objects = new Vector (initCapacity);
- }
-
- /**
- * Converts a Vector into a FaculteVector.
- */
- public FaculteVector (Vector oldVector) {
- objects = oldVector;
- }
-
- public synchronized void addElement (Faculte newElement) {
- objects.addElement (newElement);
- }
-
- public synchronized Faculte elementAt (int index) {
- return (Faculte)objects.elementAt (index);
- }
-
- public synchronized Faculte firstElement () {
- return (Faculte)objects.firstElement ();
- }
-
- public synchronized Faculte lastElement () {
- return (Faculte)objects.lastElement ();
- }
-
- /**
- * Ok, so the Faculte 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 ();
- }
-
- public synchronized Vector toVector () {
- return objects;
- }
- }
-