Beispiel #1
0
  /**
   * Adds an <tt>Edge</tt> into <tt>Path</tt>. This method ensures that the resulting <tt>Path</tt>
   * is still simple. If not, an <tt>IllegalPathException</tt> is thrown.
   *
   * @params edge The Edge to be added to the Path
   * @throws IllegalPathException Thrown when the <tt>vertexA</tt> property of the <tt>Edge</tt>
   *     being added is not the last <tt>Vertex</tt> in the path.
   */
  public void addEdge(Edge edge) throws GraphException {

    // Make sure the vertexB() is not in the Path already
    this.validatePath(edge.getVertexB());
    // The ancestor method will make sure that the last
    // Object in the stack is the same as vertexA()
    super.addEdge(edge);
  }