|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfugue.PatternTransformer
This class is used to transform a pattern. Extend this class to create your own PatternTransformer, which listens to parser events and can modify the events that are fired off by the parser. Some sample PatternTransformer subclasses are packaged with JFugue; refer to those to see examples of transformers in action.
DurationPatternTransformer
,
IntervalPatternTransformer
,
ReversePatternTransformer
Field Summary | |
protected Pattern |
returnPattern
Contains the pattern to return at the end of the transformation. |
Constructor Summary | |
PatternTransformer()
|
Method Summary | |
void |
controllerEvent(Controller controller)
Extend this method to make your transformer modify the controller messages. |
abstract java.lang.String |
getDescription()
Indicates what this PatternTransformer does. |
java.lang.Object |
getVariable(java.lang.String name)
Returns a variable setting. |
abstract java.lang.String |
getVariables()
Returns a list of variables needed by your Transformer. |
void |
instrumentEvent(Instrument instrument)
Extend this method to make your transformer modify the instrument. |
void |
noteEvent(Note note)
Extend this method to make your transformer modify the note. |
void |
parallelNoteEvent(Note note)
Extend this method to make your transformer modify the note. |
void |
putVariable(java.lang.String name,
java.lang.Object value)
Places a value for a variable. |
void |
sequentialNoteEvent(Note note)
Extend this method to make your transformer modify the note. |
void |
tempoEvent(Tempo tempo)
Extend this method to make your transformer modify the tempo. |
Pattern |
transform(Pattern p)
Transforms the pattern, according to the event method that you have presumably extended. |
void |
voiceEvent(Voice voice)
Extend this method to make your transformer modify the voice. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Pattern returnPattern
Constructor Detail |
public PatternTransformer()
Method Detail |
public abstract java.lang.String getVariables()
It is very important to keep these strings standardized! This will allow future programs to understand what is required of each Transformer. Therefore, make your Transformer return strings like this. Notice the use of quotes and slashes.
'variable name'/type/description/default
If you need to return multiple Strings, end each String with a \n, the newline character.
Also, be sure to add your strings to the JavaDoc for the getVariables() method as well, so users can learn what your code needs from its documentation.
public abstract java.lang.String getDescription()
public void putVariable(java.lang.String name, java.lang.Object value)
public java.lang.Object getVariable(java.lang.String name)
public Pattern transform(Pattern p)
public void voiceEvent(Voice voice)
voiceEvent
in interface ParserListener
org.jfugue.ParserListener
voice
- the event that has been parsedpublic void tempoEvent(Tempo tempo)
tempoEvent
in interface ParserListener
org.jfugue.ParserListener
tempo
- the event that has been parsedpublic void instrumentEvent(Instrument instrument)
instrumentEvent
in interface ParserListener
org.jfugue.ParserListener
instrument
- the event that has been parsedpublic void controllerEvent(Controller controller)
controllerEvent
in interface ParserListener
org.jfugue.ParserListener
controller
- the event that has been parsedpublic void noteEvent(Note note)
noteEvent
in interface ParserListener
org.jfugue.ParserListener
note
- the event that has been parsedpublic void sequentialNoteEvent(Note note)
sequentialNoteEvent
in interface ParserListener
org.jfugue.ParserListener
note
- the event that has been parsedpublic void parallelNoteEvent(Note note)
parallelNoteEvent
in interface ParserListener
org.jfugue.ParserListener
note
- the event that has been parsed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |