sky.monome
Class MultiSequencerGroup.SpecificSequencerGroup

java.lang.Object
  extended by sky.monome.Component
      extended by sky.monome.Container
          extended by sky.monome.AbstractGroup<LedButtonCouple>
              extended by sky.monome.MultiSequencerGroup.SpecificSequencerGroup
All Implemented Interfaces:
SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>, LedStateModificationLayer, Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Enclosing class:
MultiSequencerGroup

public class MultiSequencerGroup.SpecificSequencerGroup
extends AbstractGroup<LedButtonCouple>
implements Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>, LedStateModificationLayer

Specific sequencer group. This class is a special implementation of the Sequencer interface based on the AbstractGroup<LedButtonCouple> class.


Nested Class Summary
 
Nested classes/interfaces inherited from interface sky.monome.sequencer.Sequencer
Sequencer.SequencerOrientation
 
Field Summary
protected  boolean active
          Indicates if this specific sequencer group is currently used in the multisequencer group.
protected  int activeStepNumber
          Number of the currently active step in the sequence.
protected  int activeStepNumberPseudoCopyForSequencerEffect
          Copy of the number of the currently active step in the sequence.
protected  SynchronizedList<OptionalRadio.OptionalRadioGroup> buttonManagers
          List of button managers that manage each step of the enclosing sequencer.
protected  SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator
          Sequence iterator.
protected  int stepsNumber
          Number of steps in the sequence.
protected  int stepsNumberPseudoCopyWhenChangingRealValue
          Copy of the number of steps in the sequence.
 
Fields inherited from class sky.monome.AbstractGroup
components
 
Fields inherited from class sky.monome.Container
height, width
 
Fields inherited from class sky.monome.Component
container, eventListenerList, lockObject, name, x, y
 
Fields inherited from interface sky.monome.sequencer.Sequencer
SEQUENCER_EFFECT_TIME
 
Constructor Summary
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name, int x, int y, int width, int height, float tempo, int divisions, SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
          Deprecated. Since tempo and divisions parameters are not used at all, so it is recommended to use the SpecificSequencerGroup(String,int,int,int,int,SequenceIterator) constructor instead of this one.
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name, int x, int y, int width, int height, float tempo, int divisions, SequenceIteratorFactory<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIteratorFactory)
          Deprecated. Since tempo and divisions parameters are not used at all, so it is recommended to use the SpecificSequencerGroup(String,int,int,int,int,SequenceIteratorFactory) constructor instead of this one.
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name, int x, int y, int width, int height, SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
          Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, and the specified sequence iterator.
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name, int x, int y, int width, int height, SequenceIteratorFactory<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIteratorFactory)
          Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, and the specified sequence iterator factory.
 
Method Summary
protected  void addLedButtonCouple(LedButtonCouple ledButtonCouple)
          Adds the specified led/button couple to the list of led/button couples.
 void addSequencerListener(SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerListener)
          Adds the specified sequencer listener to the list of sequencer listeners.
 void fireStepChanged(MultiSequencerGroup.SpecificSequencerGroup sequencerComponent, int activeStepNumber)
          Invoked when a step change occurs.
 int getActiveStepNumberInSequence()
          Returns the number of the active step in the sequence.
<T extends ButtonManager<?>>
T
getButtonManager(java.lang.Class<T> clazz, int number)
          Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManager(int) instead.
 OptionalRadio.OptionalRadioGroup getButtonManager(int number)
          Returns the button manager of this sequencer component at the specified step number.
 OptionalRadio.OptionalRadioGroup[] getButtonManagers()
          Returns an array of all button managers of this sequencer component.
<T extends ButtonManager<?>>
T[]
getButtonManagers(java.lang.Class<T> clazz)
          Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManagers() instead.
 LedButtonCouple[] getLedButtonCouples()
          Returns an array of all led/button couples contained by this specific sequencer group.
 LedButtonCouple.LedState getLedStateToShow(LedButtonCouple ledButtonCouple)
          Returns the led state to show instead of the natural led state of the specified led/button couple.
 int getMaximumStepsNumberInSequence()
          Returns the maximum possible number of steps in the sequence.
 int getNotesNumberByStep()
          Returns the number of available notes by step in the sequence.
 SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> getSequenceIterator()
          Returns the sequence iterator used by this sequencer.
 long getSequencerEffectTime()
          Returns the sequencer effect time, in milliseconds.
 SequencerEngine<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> getSequencerEngine()
          Returns the sequencer engine that is used by this sequencer.
 SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>[] getSequencerListeners()
          Returns an array of all sequencer listeners.
 int getStepsNumberInSequence()
          Returns the number of steps in the sequence.
 boolean isActive()
          Indicates if this specific sequencer group is currently used in the multisequencer group.
 void removeSequencerListener(SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerListener)
          Removes the specified sequencer listener from the list of sequencer listeners.
 void sequencingAction(SequencerEngine<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerEngine)
          Invoked when this sequencer must iterate over the sequence.
 void setActive(boolean active)
          Sets if this specific sequencer group must be used in the multisequencer group.
 void setSequenceIterator(SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
          Sets the sequence iterator used by this sequencer.
 void setSequencerEffectTime(long sequencerEffectTime)
          Modifies the sequencer effect time, in milliseconds.
 void setStepsNumber(int stepsNumber)
          Modifies the number of steps to iterate over the sequence.
 java.lang.String toString()
          Returns a string representation of this specific sequencer group.
 
Methods inherited from class sky.monome.AbstractGroup
canHaveParentContainer, getAbsoluteX, getAbsoluteY, getBounds, getMonome, isVisible, notify, writeOn
 
Methods inherited from class sky.monome.Container
getHeight, getWidth
 
Methods inherited from class sky.monome.Component
getContainer, getLockObject, getName, getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonManagers

protected final SynchronizedList<OptionalRadio.OptionalRadioGroup> buttonManagers
List of button managers that manage each step of the enclosing sequencer.


activeStepNumber

protected int activeStepNumber
Number of the currently active step in the sequence.


activeStepNumberPseudoCopyForSequencerEffect

protected int activeStepNumberPseudoCopyForSequencerEffect
Copy of the number of the currently active step in the sequence. This copy is used for the sequencer lightning effect.


stepsNumber

protected int stepsNumber
Number of steps in the sequence.


stepsNumberPseudoCopyWhenChangingRealValue

protected int stepsNumberPseudoCopyWhenChangingRealValue
Copy of the number of steps in the sequence. This copy is used when the user change the real value in live.


sequenceIterator

protected SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator
Sequence iterator.


active

protected boolean active
Indicates if this specific sequencer group is currently used in the multisequencer group.

Constructor Detail

MultiSequencerGroup.SpecificSequencerGroup

protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name,
                                                     int x,
                                                     int y,
                                                     int width,
                                                     int height,
                                                     SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
                                              throws MonomeException
Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, and the specified sequence iterator.

Parameters:
name - Name of this specific sequencer group.
x - X-coordinate of this specific sequencer group in the local context of its container.
y - Y-coordinate of this specific sequencer group in the local context of its container.
width - Width of this specific sequencer group.
height - Height of this specific sequencer group.
sequenceIterator - Sequence iterator to use to iterate over the sequence.
Throws:
MonomeException - When the number of steps is invalid.
Since:
SkyMonome v1.1

MultiSequencerGroup.SpecificSequencerGroup

@Deprecated
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name,
                                                                int x,
                                                                int y,
                                                                int width,
                                                                int height,
                                                                float tempo,
                                                                int divisions,
                                                                SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
                                              throws MonomeException
Deprecated. Since tempo and divisions parameters are not used at all, so it is recommended to use the SpecificSequencerGroup(String,int,int,int,int,SequenceIterator) constructor instead of this one.

Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, specified tempo and number of divisions by quarter note and the specified sequence iterator.

Parameters:
name - Name of this specific sequencer group.
x - X-coordinate of this specific sequencer group in the local context of its container.
y - Y-coordinate of this specific sequencer group in the local context of its container.
width - Width of this specific sequencer group.
height - Height of this specific sequencer group.
tempo - Tempo, in number of quarter notes by minute.
divisions - Number of divisions by quarter note.
sequenceIterator - Sequence iterator to use to iterate over the sequence.
Throws:
MonomeException - When the number of steps is invalid.

MultiSequencerGroup.SpecificSequencerGroup

protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name,
                                                     int x,
                                                     int y,
                                                     int width,
                                                     int height,
                                                     SequenceIteratorFactory<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIteratorFactory)
                                              throws MonomeException
Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, and the specified sequence iterator factory.

Parameters:
name - Name of this specific sequencer group.
x - X-coordinate of this specific sequencer group in the local context of its container.
y - Y-coordinate of this specific sequencer group in the local context of its container.
width - Width of this specific sequencer group.
height - Height of this specific sequencer group.
sequenceIteratorFactory - Factory for sequence iterator to use to iterate over the sequence.
Throws:
MonomeException - When the number of steps is invalid.
Since:
SkyMonome v1.1

MultiSequencerGroup.SpecificSequencerGroup

@Deprecated
protected MultiSequencerGroup.SpecificSequencerGroup(java.lang.String name,
                                                                int x,
                                                                int y,
                                                                int width,
                                                                int height,
                                                                float tempo,
                                                                int divisions,
                                                                SequenceIteratorFactory<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIteratorFactory)
                                              throws MonomeException
Deprecated. Since tempo and divisions parameters are not used at all, so it is recommended to use the SpecificSequencerGroup(String,int,int,int,int,SequenceIteratorFactory) constructor instead of this one.

Constructs a specific sequencer group with the specified name, specified coordinates and dimensions, specified tempo and number of divisions by quarter note and the specified sequence iterator factory.

Parameters:
name - Name of this specific sequencer group.
x - X-coordinate of this specific sequencer group in the local context of its container.
y - Y-coordinate of this specific sequencer group in the local context of its container.
width - Width of this specific sequencer group.
height - Height of this specific sequencer group.
tempo - Tempo, in number of quarter notes by minute.
divisions - Number of divisions by quarter note.
sequenceIteratorFactory - Factory for sequence iterator to use to iterate over the sequence.
Throws:
MonomeException - When the number of steps is invalid.
Since:
SkyMonome v1.1
Method Detail

sequencingAction

public void sequencingAction(SequencerEngine<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerEngine)
Invoked when this sequencer must iterate over the sequence. This implementation does nothing.

Specified by:
sequencingAction in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequencerEngine - Sequencer engine that called this method.
Throws:
MonomeException - When a problem occurs in the iteration over the sequence.

getSequencerEffectTime

public long getSequencerEffectTime()
Returns the sequencer effect time, in milliseconds. The sequencer effect is the short lightning that symbolizes the activation of a new step in the sequence.

Specified by:
getSequencerEffectTime in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The sequencer effect time, in milliseconds.
Since:
SkyMonome v1.3

setSequencerEffectTime

public void setSequencerEffectTime(long sequencerEffectTime)
Modifies the sequencer effect time, in milliseconds. The sequencer effect is the short lightning that symbolizes the activation of a new step in the sequence.

Specified by:
setSequencerEffectTime in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequencerEffectTime - New sequencer effect time, in milliseconds. Please note that if this new time exceeds the time between two consecutive steps, so you may meet erratic behaviors.
Since:
SkyMonome v1.3

getSequencerEngine

public SequencerEngine<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> getSequencerEngine()
Returns the sequencer engine that is used by this sequencer.

Specified by:
getSequencerEngine in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The sequencer engine that is used by this sequencer.
Since:
SkyMonome v1.3

getActiveStepNumberInSequence

public int getActiveStepNumberInSequence()
Returns the number of the active step in the sequence.

Specified by:
getActiveStepNumberInSequence in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The number of the active step in the sequence.

getStepsNumberInSequence

public int getStepsNumberInSequence()
Returns the number of steps in the sequence.

Specified by:
getStepsNumberInSequence in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The number of steps in the sequence.

getMaximumStepsNumberInSequence

public int getMaximumStepsNumberInSequence()
Returns the maximum possible number of steps in the sequence.

Specified by:
getMaximumStepsNumberInSequence in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The maximum possible number of steps in the sequence.
Since:
SkyMonome v1.1

getNotesNumberByStep

public int getNotesNumberByStep()
Returns the number of available notes by step in the sequence.

Specified by:
getNotesNumberByStep in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The number of available notes by step in the sequence.
Since:
SkyMonome v1.1

setStepsNumber

public void setStepsNumber(int stepsNumber)
                    throws MonomeException
Modifies the number of steps to iterate over the sequence.

Specified by:
setStepsNumber in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
stepsNumber - New number of steps to iterate over the sequence.
Throws:
MonomeException - When the new steps number is incorrect for this sequencer.

getButtonManagers

@Deprecated
public <T extends ButtonManager<?>> T[] getButtonManagers(java.lang.Class<T> clazz)
Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManagers() instead.

Returns an array of all button managers of this specific sequencer group. Returned button managers are typed to the specified type.

Specified by:
getButtonManagers in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Type Parameters:
T - Desired type for button managers. It should be a subclass of ButtonManager.
Parameters:
clazz - Class object that specify the return type for button managers.
Returns:
An array of all button managers of this specific sequencer group.
Throws:
java.lang.ClassCastException - When button managers can't be typed to the specified type.

getButtonManagers

public OptionalRadio.OptionalRadioGroup[] getButtonManagers()
Returns an array of all button managers of this sequencer component. Returned button managers are typed to the type defined by the parametrization of this class.

Specified by:
getButtonManagers in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
An array of all button managers of this sequencer component.
Since:
SkyMonome v1.1

getButtonManager

@Deprecated
public <T extends ButtonManager<?>> T getButtonManager(java.lang.Class<T> clazz,
                                                                  int number)
Deprecated. Since this class implements an interface that is parametrized, it is recommended to use getButtonManager(int) instead.

Returns the button manager of this specific sequencer group at the specified step number. The returned button manager is typed to the specified type.

Specified by:
getButtonManager in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Type Parameters:
T - Desired type for the button manager. It should be a subclass of ButtonManager.
Parameters:
clazz - Class object that specify the return type for the button manager.
number - Number of the button manager needed.
Returns:
The button manager of this specific sequencer group at the specified step number.
Throws:
java.lang.ClassCastException - When the button manager can't be typed to the specified type.

getButtonManager

public OptionalRadio.OptionalRadioGroup getButtonManager(int number)
Returns the button manager of this sequencer component at the specified step number. The returned button manager is typed to the type defined by the parametrization of this class.

Specified by:
getButtonManager in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
number - Number of the button manager needed.
Returns:
The button manager of this sequencer component at the specified step number.
Since:
SkyMonome v1.1

getSequenceIterator

public SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> getSequenceIterator()
Returns the sequence iterator used by this sequencer.

Specified by:
getSequenceIterator in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
The sequence iterator used by this sequencer.
Since:
SkyMonome v1.1

setSequenceIterator

public void setSequenceIterator(SequenceIterator<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequenceIterator)
Sets the sequence iterator used by this sequencer.

Specified by:
setSequenceIterator in interface Sequencer<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequenceIterator - New sequence iterator to use in this sequencer.
Since:
SkyMonome v1.1

getLedButtonCouples

public LedButtonCouple[] getLedButtonCouples()
Returns an array of all led/button couples contained by this specific sequencer group.

Returns:
An array of all led/button couples contained by this specific sequencer group.

addLedButtonCouple

protected void addLedButtonCouple(LedButtonCouple ledButtonCouple)
                           throws MonomeException
Adds the specified led/button couple to the list of led/button couples.

Parameters:
ledButtonCouple - Led/button couple to add to the list of led/button couples.
Throws:
MonomeException - When a led/button couple has bounds already used by another led/button couple.

toString

public java.lang.String toString()
Returns a string representation of this specific sequencer group.

Specified by:
toString in class Component
Returns:
A string representation of this specific sequencer group.

getLedStateToShow

public LedButtonCouple.LedState getLedStateToShow(LedButtonCouple ledButtonCouple)
Returns the led state to show instead of the natural led state of the specified led/button couple.

Specified by:
getLedStateToShow in interface LedStateModificationLayer
Parameters:
ledButtonCouple - led/button couple which is the reference.
Returns:
The led state to show instead of the natural led state of the specified led/button couple.

addSequencerListener

public void addSequencerListener(SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerListener)
Adds the specified sequencer listener to the list of sequencer listeners.

Specified by:
addSequencerListener in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequencerListener - Sequencer listener to add to the list of sequencer listeners.

removeSequencerListener

public void removeSequencerListener(SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup> sequencerListener)
Removes the specified sequencer listener from the list of sequencer listeners.

Specified by:
removeSequencerListener in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequencerListener - Sequencer listener to remove from the list of sequencer listeners.

getSequencerListeners

public SequencerListener<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>[] getSequencerListeners()
Returns an array of all sequencer listeners.

Specified by:
getSequencerListeners in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Returns:
An array of all sequencer listeners.

fireStepChanged

public void fireStepChanged(MultiSequencerGroup.SpecificSequencerGroup sequencerComponent,
                            int activeStepNumber)
Invoked when a step change occurs.

Specified by:
fireStepChanged in interface SequencerComponent<MultiSequencerGroup.SpecificSequencerGroup,OptionalRadio.OptionalRadioGroup>
Parameters:
sequencerComponent - Sequencer component that triggered the sequencer event.

isActive

public boolean isActive()
Indicates if this specific sequencer group is currently used in the multisequencer group.

Returns:
true if this specific sequencer group is currently used in the multisequencer group, false otherwise.

setActive

public void setActive(boolean active)
Sets if this specific sequencer group must be used in the multisequencer group.

Parameters:
active - true if it must be used, false otherwise.