/** * Adds a Object into the Path. This method ensures that the resulting <tt>Path</tt> is still * simple. If not, an <tt>IllegalPathException</tt> is thrown. * * <p>If adding this new <tt>Edge</tt> instance is not desired and you want to add an existing * <tt>Edge</tt> instance instead ( i.e.: from an <tt>Edge</tt> in a <tt>Graph</tt> ), then you * should call <tt>addEdge( Edge )</tt> instead. * * @param newvertex Object to be added to the Path * @throws IllegalPathException Thrown if adding the <tt>Vertex</tt> will result to a non-simple * <tt>Path</tt>. */ public void add(Object newObject) throws GraphException { // Throw exception if it is already in the path.. // synonymous to if it is already in the Graph. this.validatePath(newObject); super.add(newObject); }