de.rwth.dfa
Interface Worklist

All Known Implementing Classes:
StackWorklist

public interface Worklist

This interface describes the requirements for work list implementations used the the DataFlowSolver. A work list is just a collection data structure, capable of storing elements. The strategy in which elements are retrieved is implementation dependent. Despite its name, it does not need to be a list: The same element does not have to be stored more than once.

Version:
$Id: Worklist.java,v 1.2 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Method Summary
 boolean add(java.lang.Object o)
          This methods adds an element to the work list.
 java.lang.Object get()
          Chooses a previously added element from the work list and returns it.
 boolean isEmpty()
          Checks if there are elements in the work list.
 void moveToFront(java.lang.Object o)
          Maybe makes a previously added element the next to be retrieved by get().
 int size()
          Returns the number of elements stored in this work list.
 

Method Detail

add

public boolean add(java.lang.Object o)
This methods adds an element to the work list. This method may be called multiple times with the same element without calls to get() in between. An implementation is free to choose if at any time, such element are contained more than once.
Parameters:
o - an Object value
Returns:
a boolean value: whether the element was added or not.

isEmpty

public boolean isEmpty()
Checks if there are elements in the work list.
Returns:
a boolean value

get

public java.lang.Object get()
                     throws java.util.NoSuchElementException
Chooses a previously added element from the work list and returns it. Implementations are free to choose which element to select.
Returns:
an Object value
Throws:
java.util.NoSuchElementException - if there are no elements in this work list

moveToFront

public void moveToFront(java.lang.Object o)
                 throws java.util.NoSuchElementException
Maybe makes a previously added element the next to be retrieved by get(). An implementation is free to ignore calls.
Parameters:
o - an Object value
Throws:
java.util.NoSuchElementException - if o is not in the list

size

public int size()
Returns the number of elements stored in this work list.
Returns:
an int value