galois.runtime.wl
Class AbstractParameterWorklist<T,S>

java.lang.Object
  extended by galois.runtime.wl.AbstractParameterWorklist<T,S>
Type Parameters:
T - The type of element held in the worklist (visible to the user)
S - The type of element held in the internal worklist and used by ParaMeter executors
All Implemented Interfaces:
ParameterWorklist<T,S>
Direct Known Subclasses:
ParameterOrderedWorklist, ParameterUnorderedWorklist

public abstract class AbstractParameterWorklist<T,S>
extends Object
implements ParameterWorklist<T,S>

Abstract class which defines the worklist that ParaMeter operates over. Internally, all ParaMeter worklists contain two queues, one holding elements left to execute in the current round, the other holding elements to execute in the next round.

Author:
milind

Nested Class Summary
protected static interface AbstractParameterWorklist.InternalParameterQueue<E>
          An internal parameter queue
 
Field Summary
protected  AbstractParameterWorklist.InternalParameterQueue<S> current
           
protected  AbstractParameterWorklist.InternalParameterQueue<S> next
           
 
Constructor Summary
protected AbstractParameterWorklist()
           
 
Method Summary
 void add(T x)
           
 void clear()
           
 void defer(S x)
           
 void deferRemainingItems()
           
 S internalNext()
           
 boolean isEmpty()
           
protected abstract  AbstractParameterWorklist.InternalParameterQueue<S> makeInternalQueue()
          Creates an internal queue for use in AbstractParameterWorklist.
 T next()
           
 void nextStep()
           
 int size()
           
protected abstract  S wrap(T x)
          Wrap an object of type T in an object of type S.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

protected AbstractParameterWorklist.InternalParameterQueue<S> next

current

protected AbstractParameterWorklist.InternalParameterQueue<S> current
Constructor Detail

AbstractParameterWorklist

protected AbstractParameterWorklist()
Method Detail

makeInternalQueue

protected abstract AbstractParameterWorklist.InternalParameterQueue<S> makeInternalQueue()
Creates an internal queue for use in AbstractParameterWorklist. A parameter worklist is implemented with two internal queues: one queue for the current time step and one queue for the next time step.

Returns:
an internal queue

wrap

protected abstract S wrap(T x)
Wrap an object of type T in an object of type S. Used because user code adds Ts to the worklist, but ParaMeter operates over Ss

Parameters:
x - the object to wrap
Returns:
x wrapped in an object of type S (or, if S is the same as T, just x)

add

public void add(T x)
Specified by:
add in interface ParameterWorklist<T,S>

internalNext

public S internalNext()
               throws NoSuchElementException
Specified by:
internalNext in interface ParameterWorklist<T,S>
Throws:
NoSuchElementException

next

public T next()
       throws NoSuchElementException
Specified by:
next in interface ParameterWorklist<T,S>
Throws:
NoSuchElementException

clear

public void clear()
Specified by:
clear in interface ParameterWorklist<T,S>

defer

public void defer(S x)
Specified by:
defer in interface ParameterWorklist<T,S>

nextStep

public void nextStep()
Specified by:
nextStep in interface ParameterWorklist<T,S>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface ParameterWorklist<T,S>

size

public int size()
Specified by:
size in interface ParameterWorklist<T,S>

deferRemainingItems

public void deferRemainingItems()
Specified by:
deferRemainingItems in interface ParameterWorklist<T,S>