Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* ==========================================
* JGraphT : a free Java graph-theory library
* ==========================================
*
* Project Info: http://jgrapht.sourceforge.net/
* Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
*
* (C) Copyright 2003-2008, by Barak Naveh and Contributors.
*
* This program and the accompanying materials are dual-licensed under
* either
*
* (a) the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation, or (at your option) any
* later version.
*
* or (per the licensee's choosing)
*
* (b) the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation.
*/
/* -----------------------
* DepthFirstIterator.java
* -----------------------
* (C) Copyright 2003-2008, by Liviu Rau and Contributors.
*
* Original Author: Liviu Rau
* Contributor(s): Barak Naveh
* Christian Hammer
* Welson Sun
* Ross Judson
*
* $Id$
*
* Changes
* -------
* 29-Jul-2003 : Initial revision (LR);
* 31-Jul-2003 : Fixed traversal across connected components (BN);
* 06-Aug-2003 : Extracted common logic to TraverseUtils.XXFirstIterator (BN);
* 31-Jan-2004 : Reparented and changed interface to parent class (BN);
* 04-May-2004 : Made generic (CH)
* 27-Aug-2006 : Added WHITE/GRAY/BLACK to fix bug reported by Welson Sun (JVS)
* 28-Sep-2008 : Optimized using ArrayDeque per suggestion from Ross (JVS)
*
*/
package org.jgrapht.traverse;
import java.util.*;
import org.jgrapht.*;
import org.jgrapht.util.*;
/**
* A depth-first iterator for a directed and an undirected graph. For this
* iterator to work correctly the graph must not be modified during iteration.
* Currently there are no means to ensure that, nor to fail-fast. The results of
* such modifications are undefined.
*
* @author Liviu Rau
* @author Barak Naveh
* @since Jul 29, 2003
*/
public class DepthFirstIterator
extends CrossComponentIterator
{
/**
* Sentinel object. Unfortunately, we can't use null, because ArrayDeque
* won't accept those. And we don't want to rely on the caller to provide a
* sentinel object for us. So we have to play typecasting games.
*/
public static final Object SENTINEL = new Object();
/**
* @see #getStack
*/
private Deque