View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gwui.graphview;
7   
8   import java.util.*;
9   
10  /***
11     A simple iterator for all elements (nodes and edges) of a graph. 
12     The iteration order of this iterator is not determined.
13   */
14  public class ElementIterator implements Iterator {
15      private LinkedList _elements;
16  
17      public ElementIterator(WorkflowGraph graph) {
18  	_elements = new LinkedList();
19  	_elements.addAll(graph.getNodes());
20  	_elements.addAll(graph.getEdges());
21      }
22  
23      public Object next() {
24  	return _elements.removeFirst();
25      }
26  
27      public boolean hasNext() {
28  	return !_elements.isEmpty();
29      }
30  
31      /***
32         @exception UnsupportedOperationExeption Always.
33       */
34      public void remove() throws UnsupportedOperationException {
35  	throw new UnsupportedOperationException();
36      }
37  }