sky.monome.sequence.factory
Class GenericSequenceIteratorFactory<S extends Sequencer<S,B>,B extends ButtonManager<B>>

java.lang.Object
  extended by sky.monome.sequence.factory.GenericSequenceIteratorFactory<S,B>
Type Parameters:
S - Type of sequencers that use sequence iterators built by this factory.
B - Type of button managers used by the sequencers that use sequence iterators built by this factory.
All Implemented Interfaces:
SequenceIteratorFactory<S,B>

public class GenericSequenceIteratorFactory<S extends Sequencer<S,B>,B extends ButtonManager<B>>
extends java.lang.Object
implements SequenceIteratorFactory<S,B>

Generic sequence iterator factory which can produce serially sequence iterators of the class specified at construction.

Since:
SkyMonome v1.1
Author:
PJ Skyman

Constructor Summary
GenericSequenceIteratorFactory(java.lang.Class<? extends SequenceIterator<S,B>> sequenceIteratorClass, java.lang.Object... argumentsForSequenceIterator)
          Constructs a generic sequence iterator factory which can produce sequence iterators of the specified class and with the specified arguments common to all produced sequence iterators.
 
Method Summary
static
<S extends Sequencer<S,B>,B extends ButtonManager<B>>
GenericSequenceIteratorFactory<S,B>
createGenericSequenceIteratorFactory(java.lang.Class<? extends SequenceIterator> sequenceIteratorClass, java.lang.Object... argumentsForSequenceIterator)
          Creates a generic sequence iterator factory of specified types, and with the specified (not paramtrized) sequence iterator class and specified arguments.
 SequenceIterator<S,B> createSequenceIterator(java.lang.Object... arguments)
          Creates a sequence iterator with the help of optional arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericSequenceIteratorFactory

public GenericSequenceIteratorFactory(java.lang.Class<? extends SequenceIterator<S,B>> sequenceIteratorClass,
                                      java.lang.Object... argumentsForSequenceIterator)
                               throws MonomeException
Constructs a generic sequence iterator factory which can produce sequence iterators of the specified class and with the specified arguments common to all produced sequence iterators.

Parameters:
sequenceIteratorClass - Class object that denotes the type of sequence iterators that will be produced by this factory.s
argumentsForSequenceIterator - Optional arguments that can be used for the sequence iterators factoring. These arguments must be specified in a good order so that a constructor is defined for the specified sequence iterator class with specified arguments.
Throws:
MonomeException - When no constructor is found for the specified class and specified arguments in the same order.
Method Detail

createSequenceIterator

public SequenceIterator<S,B> createSequenceIterator(java.lang.Object... arguments)
                                                                                             throws MonomeException
Creates a sequence iterator with the help of optional arguments.

Specified by:
createSequenceIterator in interface SequenceIteratorFactory<S extends Sequencer<S,B>,B extends ButtonManager<B>>
Parameters:
arguments - Optional arguments that can help the sequence iterator factoring. Note that this kind of factory does not use these arguments.
Returns:
A sequence iterator freshly created.
Throws:
MonomeException - When the sequence iterator factoring can't operate successfully.

createGenericSequenceIteratorFactory

public static <S extends Sequencer<S,B>,B extends ButtonManager<B>> GenericSequenceIteratorFactory<S,B> createGenericSequenceIteratorFactory(java.lang.Class<? extends SequenceIterator> sequenceIteratorClass,
                                                                                                                                             java.lang.Object... argumentsForSequenceIterator)
                                                                                                                                throws MonomeException
Creates a generic sequence iterator factory of specified types, and with the specified (not paramtrized) sequence iterator class and specified arguments. See the constructor doc to know more about these arguments. This static method is a convenience method that can create correctly parametrized factories.

Type Parameters:
S - Type of sequencer that use sequence iterators built by this factory.
B - Type of button manager used by sequencers that use sequence iterators built by this factory.
Parameters:
sequenceIteratorClass - (Not parametrized) sequence iterator class that denotes future factored sequence iterators.
argumentsForSequenceIterator - Arguments used to create the factory.
Returns:
A freshly created generic sequence iterator factory ready to be used to create sequence iterators.
Throws:
MonomeException - When the factory can't be created.
See Also:
GenericSequenceIteratorFactory(Class,Object...)