new version with WorkingCopy Management
[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.*;
14
15 public class WorkQueue {
16
17 ArrayList needsCompileList;
18 ArrayList compiledList;
19
20 public WorkQueue() {
21         this.needsCompileList = new ArrayList(11);
22         this.compiledList = new ArrayList(11);
23 }
24
25 public void add(SourceFile element) {
26         needsCompileList.add(element);
27 }
28
29 public void addAll(SourceFile[] elements) {
30         for (int i = 0, l = elements.length; i < l; i++)
31                 add(elements[i]);
32 }
33
34 public void clear() {
35         this.needsCompileList.clear();
36         this.compiledList.clear();
37 }       
38
39 public void finished(SourceFile element) {
40         needsCompileList.remove(element);
41         compiledList.add(element);
42 }
43
44 public boolean isCompiled(SourceFile element) {
45         return compiledList.contains(element);
46 }
47
48 public boolean isWaiting(SourceFile element) {
49         return needsCompileList.contains(element);
50 }
51
52 public String toString() {
53         return "WorkQueue: " + needsCompileList; //$NON-NLS-1$
54 }
55 }