// 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: NetList.java // Classes: NetList // Original Author: ics125b spring 1996 // $Id: NetList.java,v 1.1.1.1 1997/02/27 20:52:45 chandra Exp $ package uci.graphedit; import java.util.Vector; /** A class that implements the concept of a connected graph. A * NetList is not any one object in the connected graph, it is the * overall graph. A NetList contains a list of nodes, and the nodes * refer to their ports and arcs. */ public class NetList extends NetPrimitive { /** The nodes in the NetList */ private Vector _nodes; /** The name of this connected graph. */ String _name; /** Construct a new NetList with no contained nodes. */ public NetList() { _nodes = new Vector(); } /** Get and set methods */ public void name(String n) { _name = n; } public String name() { return _name; } /** Add a node to this NetList. Needs-More-Work: should I send a * notification? This is called from the Editor when a * DiagramElement is added that is a Perspective. * * @see Editor#add */ public void addNode(NetNode n) { _nodes.addElement(n); } /** Remove a node from this NetList. When a node is deleted a * notification is sent out. */ public void removeNode(NetNode n) { setChanged(); Vector v = new Vector(2); v.addElement("remove"); v.addElement(n); notifyObservers(v); _nodes.removeElement(n); } /** Remove all the nodes from this NetList. */ public void removeAll() { _nodes.removeAllElements();} /** return the node list vector */ public Vector nodes(){ return _nodes;} } /* end class NetList */