/* This file is part of SableCC ( http://sablecc.org ).
 * 
 * See the NOTICE file distributed with this work for copyright information.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.sablecc.sablecc.util;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

import org.sablecc.sablecc.exception.InternalException;

public class WorkSet<T> {

    /** The list of the elements already treated. */
    private final Set<T> done = new HashSet<T>();

    /** The list of the elements left to be treated. */
    private final LinkedHashSet<T> toDo = new LinkedHashSet<T>();

    /**
     * Indicates if an element has a next one.
     * 
     * @return boolean a boolean value indicating whether the element has a next
     *         one or not.
     */
    public boolean hasNext() {

        return !this.toDo.isEmpty();
    }

    /**
     * Treats a new element, adding it to the done list.
     * 
     * @return T the treated element.
     */
    public T next() {

        T next = this.toDo.iterator().next();

        this.toDo.remove(next);
        this.done.add(next);

        return next;
    }

    /**
     * Adds a new element to be treated.
     * 
     * @param element
     *            the new element to be treated.
     * @throws InternalException
     *             if the element is <code>null</code>.
     */
    public void add(
            T element) {

        if (element == null) {
            throw new InternalException("element may not be null");
        }

        if (!this.done.contains(element)) {
            this.toDo.add(element);
        }
    }
}

@@ -866,16 +866,135 @@
 ption;%0A%0A
+/**%0A * A work set is a set of element to work on. This class provides various%0A * methods to maniplutate work sets.%0A */%0A
 public c
@@ -1321,25 +1321,30 @@
 urn 
-boolean a boolean
+a %3Ccode%3Eboolean%3C/code%3E
  val
@@ -1380,23 +1380,16 @@
 ment has
- a next
 %0A     * 
@@ -1396,16 +1396,23 @@
         
+a next 
 one or n
@@ -1564,32 +1564,32 @@
 e list.%0A     * %0A
+
      * @return T
@@ -1587,18 +1587,16 @@
 @return 
-T 
 the trea

Improve javadoc comments. See ticket:30.