A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / builder / WorkQueue.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core.builder;
12
13 import java.util.ArrayList;
14
15 public class WorkQueue {
16
17         ArrayList needsCompileList;
18
19         ArrayList compiledList;
20
21         public WorkQueue() {
22                 this.needsCompileList = new ArrayList(11);
23                 this.compiledList = new ArrayList(11);
24         }
25
26         public void add(SourceFile element) {
27                 needsCompileList.add(element);
28         }
29
30         public void addAll(SourceFile[] elements) {
31                 for (int i = 0, l = elements.length; i < l; i++)
32                         add(elements[i]);
33         }
34
35         public void clear() {
36                 this.needsCompileList.clear();
37                 this.compiledList.clear();
38         }
39
40         public void finished(SourceFile element) {
41                 needsCompileList.remove(element);
42                 compiledList.add(element);
43         }
44
45         public boolean isCompiled(SourceFile element) {
46                 return compiledList.contains(element);
47         }
48
49         public boolean isWaiting(SourceFile element) {
50                 return needsCompileList.contains(element);
51         }
52
53         public String toString() {
54                 return "WorkQueue: " + needsCompileList; //$NON-NLS-1$
55         }
56 }