org.eviline.randomizer
Class QueuedRandomizer

java.lang.Object
  extended by org.eviline.randomizer.AbstractRandomizer
      extended by org.eviline.randomizer.QueuedRandomizer
All Implemented Interfaces:
Randomizer

public class QueuedRandomizer
extends AbstractRandomizer
implements Randomizer


Field Summary
protected  boolean concurrent
           
protected  ExecutorService executor
           
protected  Future<?> future
           
protected  Field latest
           
protected  Randomizer provider
           
protected  BlockingQueue<ShapeType> queue
           
protected  Semaphore signal
           
protected  int size
           
protected  String taunt
           
 
Constructor Summary
QueuedRandomizer(Randomizer p, int size, boolean concurrent)
           
 
Method Summary
 Shape concurrentProvideShape(Field f)
           
 PropertySource config()
           
 String getTaunt()
           
 String name()
           
 Shape provideShape(Field field)
          Return the Shape to be next played on the argument Field
 Shape sequentialProvideShape(Field f)
           
 Object writeReplace()
           
 
Methods inherited from class org.eviline.randomizer.AbstractRandomizer
getNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eviline.randomizer.Randomizer
getNext
 

Field Detail

provider

protected Randomizer provider

concurrent

protected boolean concurrent

size

protected int size

queue

protected BlockingQueue<ShapeType> queue

executor

protected ExecutorService executor

signal

protected Semaphore signal

future

protected Future<?> future

latest

protected Field latest

taunt

protected volatile String taunt
Constructor Detail

QueuedRandomizer

public QueuedRandomizer(Randomizer p,
                        int size,
                        boolean concurrent)
Method Detail

provideShape

public Shape provideShape(Field field)
Description copied from interface: Randomizer
Return the Shape to be next played on the argument Field

Specified by:
provideShape in interface Randomizer
Returns:

sequentialProvideShape

public Shape sequentialProvideShape(Field f)

concurrentProvideShape

public Shape concurrentProvideShape(Field f)

getTaunt

public String getTaunt()
Specified by:
getTaunt in interface Randomizer

writeReplace

public Object writeReplace()
                    throws ObjectStreamException
Throws:
ObjectStreamException

config

public PropertySource config()
Specified by:
config in interface Randomizer

name

public String name()
Specified by:
name in interface Randomizer


Copyright © 2013. All Rights Reserved.