// Copyright (c) 1995, 1996 Regents of the University of California. // All rights reserved. // // This software was developed by the Arcadia project // at the University of California, Irvine. // // Redistribution and use in source and binary forms are permitted // provided that the above copyright notice and this paragraph are // duplicated in all such forms and that any documentation, // advertising materials, and other materials related to such // distribution and use acknowledge that the software was developed // by the University of California, Irvine. The name of the // University may not be used to endorse or promote products derived // from this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED // WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. // File: Package.java // Classes: Package // Original Author: Jason Robbins // $Id: Package.java,v 1.2 2000/09/19 21:08:37 dougo Exp $ // Modified by : Kedar Patankar // Last Modified 12 Oct 1997 package edu.neu.ccs.demeter.tools.apstudio.util; import java.util.Vector; import java.util.Enumeration; /** * This class can reply a vector of the names of all classes stored in * a given package. That list is supplied by the programmer, not * determined from looking at the directory structure. This works with * the Preloader class to load lots of code at once (important for * netscape 2.0 users). User packages should implement a subclass of this * class with a list of their *.class files.

* * PackageGraphEdit and Example provide an example usage. * * @see uci.graphedit.PackageGraphEdit * @see uci.graphedit.Example */ public class Package { /** The name of the package for all classes being loaded. */ private String _packageName; /** The list of classes to load. Normally this is set by a series of * calls to add(). */ private Vector _classNames = new Vector(); /** Make a new Package with the given package name. Then call add() * for each class in your package. Then iterate over the vector * returned by classNames(). * @param packageName The name of the package. * @see Preloader */ public Package(String packageName) { _packageName = packageName; } /** Add a class to this Package. * @param className The name of the class to be added, do not * include the full package name, that is supplied to the constructor. */ public void add(String className) { _classNames.addElement(className); } /** * Returns a vector of all classes in this package, each is a * String with the full package and class names. */ public Vector classNames() { Vector v = new Vector(_classNames.size()); Enumeration cls = _classNames.elements(); while (cls.hasMoreElements()) { String next = (String) cls.nextElement(); v.addElement(_packageName + "." + next); } return v; } } /* end class Package */