bitronix.tm.utils
Class Scheduler<T>

java.lang.Object
  extended by bitronix.tm.utils.Scheduler<T>
All Implemented Interfaces:
Iterable<T>

public class Scheduler<T>
extends Object
implements Iterable<T>

Positional object container. Objects can be added to a scheduler at a certain position (or priority) and can be retrieved later on in their position + added order. All the objects of a scheduler can be iterated in order or objects of a cetain position can be retrieved for iteration.

Author:
lorban

Field Summary
static Integer ALWAYS_FIRST_POSITION
           
static Integer ALWAYS_LAST_POSITION
           
static Integer DEFAULT_POSITION
           
 
Constructor Summary
Scheduler()
           
 
Method Summary
 void add(T obj, Integer position)
           
 List<T> getByNaturalOrderForPosition(Integer position)
           
 List<T> getByReverseOrderForPosition(Integer position)
           
 SortedSet<Integer> getNaturalOrderPositions()
           
 SortedSet<Integer> getReverseOrderPositions()
           
 Iterator<T> iterator()
           
 void remove(T obj)
           
 Iterator<T> reverseIterator()
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_POSITION

public static final Integer DEFAULT_POSITION

ALWAYS_FIRST_POSITION

public static final Integer ALWAYS_FIRST_POSITION

ALWAYS_LAST_POSITION

public static final Integer ALWAYS_LAST_POSITION
Constructor Detail

Scheduler

public Scheduler()
Method Detail

add

public void add(T obj,
                Integer position)

remove

public void remove(T obj)

getNaturalOrderPositions

public SortedSet<Integer> getNaturalOrderPositions()

getReverseOrderPositions

public SortedSet<Integer> getReverseOrderPositions()

getByNaturalOrderForPosition

public List<T> getByNaturalOrderForPosition(Integer position)

getByReverseOrderForPosition

public List<T> getByReverseOrderForPosition(Integer position)

size

public int size()

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

reverseIterator

public Iterator<T> reverseIterator()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.