ch.tatool.core.element
Class TimerListSelector

java.lang.Object
  extended by ch.tatool.core.element.AbstractListSelector
      extended by ch.tatool.core.element.TimerListSelector
All Implemented Interfaces:
ExecutionStartHandler, ElementSelector, Initializable

public class TimerListSelector
extends AbstractListSelector
implements ExecutionStartHandler

Iterates through the list of elements, executing each them in order. A general timer cancels the execution of the current element.

Author:
Andre Locher

Constructor Summary
TimerListSelector()
           
TimerListSelector(int timeoutSeconds)
           
 
Method Summary
protected  boolean canCreateIterator()
          Returns whether a new iterator can be created.
protected  boolean canExecuteNext()
          Can a next element be executed.
protected  Iterator<Element> createIterator(ExecutionContext context)
          Get the iterator to use for the iteration.
 long getTimeout()
           
 void initialize(Element element)
          Initializes this scheduler.
 boolean selectNextElement(ExecutionContext context)
           
 void setTimeout(long timeout)
           
 void startExecution(ExecutionContext context)
           
 void stopExecution(ExecutionContext context)
           
 void stopTimer()
           
 
Methods inherited from class ch.tatool.core.element.AbstractListSelector
getExecutionElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerListSelector

public TimerListSelector()

TimerListSelector

public TimerListSelector(int timeoutSeconds)
Method Detail

initialize

public void initialize(Element element)
Initializes this scheduler.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class AbstractListSelector

selectNextElement

public boolean selectNextElement(ExecutionContext context)
Specified by:
selectNextElement in interface ElementSelector

canCreateIterator

protected boolean canCreateIterator()
Returns whether a new iterator can be created.


canExecuteNext

protected boolean canExecuteNext()
Can a next element be executed. By default we execute full iterations, so this method by default returns true


createIterator

protected Iterator<Element> createIterator(ExecutionContext context)
Get the iterator to use for the iteration.


getTimeout

public long getTimeout()

setTimeout

public void setTimeout(long timeout)

startExecution

public void startExecution(ExecutionContext context)
Specified by:
startExecution in interface ExecutionStartHandler

stopExecution

public void stopExecution(ExecutionContext context)
Specified by:
stopExecution in interface ExecutionStartHandler

stopTimer

public void stopTimer()
Specified by:
stopTimer in interface ExecutionStartHandler


Copyright © 2012. All Rights Reserved.