KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > builder > WorkQueue


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.builder;
12
13 import org.eclipse.jdt.internal.compiler.util.SimpleSet;
14
15 public class WorkQueue {
16
17 private SimpleSet needsCompileList;
18 private SimpleSet compiledList;
19
20 public WorkQueue() {
21     this.needsCompileList = new SimpleSet();
22     this.compiledList = new SimpleSet();
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.includes(element);
46 }
47
48 public boolean isWaiting(SourceFile element) {
49     return needsCompileList.includes(element);
50 }
51
52 public String JavaDoc toString() {
53     return "WorkQueue: " + needsCompileList; //$NON-NLS-1$
54
}
55 }
56
Popular Tags