Package org.jjazz.phrase.api
Class SizedPhrase
java.lang.Object
org.jjazz.phrase.api.Phrase
org.jjazz.phrase.api.SizedPhrase
- All Implemented Interfaces:
Serializable
,Iterable<NoteEvent>
,Collection<NoteEvent>
,NavigableSet<NoteEvent>
,Set<NoteEvent>
,SortedSet<NoteEvent>
A Phrase which has a size (beat range) and a time signature.
Added NoteEvents must be fully contained in the beat range, otherwise an IllegalArgumentException is thrown.
- See Also:
-
Field Summary
Fields inherited from class org.jjazz.phrase.api.Phrase
PARENT_NOTE, PROP_NOTES_ADDED, PROP_NOTES_ADDED_ADJUSTING, PROP_NOTES_MOVED, PROP_NOTES_MOVED_ADJUSTING, PROP_NOTES_REMOVED, PROP_NOTES_REMOVED_ADJUSTING, PROP_NOTES_REPLACED, PROP_NOTES_REPLACED_ADJUSTING
-
Constructor Summary
ConstructorDescriptionSizedPhrase
(int channel, FloatRange beatRange, TimeSignature ts, boolean isDrums) Create a sized phrase with no notes. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canAddNote
(NoteEvent ne) Overridden to check NoteEvent is within the beat range (including the upper bound).clone()
A deep clone: returned phrase contains clones of the original NoteEvents.Get the beat range corresponding to this phrase.int
static SizedPhrase
Create a SizedPhrase from the specified string.static String
Save the specified SizedPhrase as a string.void
shiftAllEvents
(float shiftInBeats) Shift the associated BeatRange and all events.toString()
Methods inherited from class org.jjazz.phrase.api.Phrase
add, add, add, add, addAll, addAll, addPropertyChangeListener, addUndoableEditListener, ceiling, clear, comparator, contains, containsAll, descendingIterator, descendingSet, dump, equalsNearPosition, first, floor, getCeilNote, getChannel, getFloorNote, getLastEventPosition, getNotes, getNotes, getProcessedPhrase, getProcessedPhrasePitch, getProcessedPhraseVelocity, headSet, headSet, higher, isAdjustingEvent, isDrums, isEmpty, iterator, last, lower, move, move, moveAll, pollFirst, pollLast, processNotes, processPitch, processVelocity, remove, remove, removeAll, removeAll, removePropertyChangeListener, removeUndoableEditListener, replace, replace, replaceAll, retainAll, saveAsString, size, subSet, subSet, subSet, tailSet, tailSet, toArray, toArray
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.SortedSet
spliterator
-
Constructor Details
-
SizedPhrase
Create a sized phrase with no notes.- Parameters:
channel
-beatRange
-ts
-isDrums
-
-
SizedPhrase
-
-
Method Details
-
canAddNote
Overridden to check NoteEvent is within the beat range (including the upper bound).- Parameters:
ne
-- Returns:
-
clone
Description copied from class:Phrase
A deep clone: returned phrase contains clones of the original NoteEvents. -
getBeatRange
Get the beat range corresponding to this phrase.Overrides Phrase.getBeatRange() because the beat range is fixed for a SizedPhrase.
- Overrides:
getBeatRange
in classPhrase
- Returns:
-
getTimeSignature
- Returns:
- The timeSignature used in this phrase.
-
getSizeInBars
public int getSizeInBars() -
shiftAllEvents
public void shiftAllEvents(float shiftInBeats) Shift the associated BeatRange and all events.- Overrides:
shiftAllEvents
in classPhrase
- Parameters:
shiftInBeats
-
-
saveAsString
Save the specified SizedPhrase as a string.Example "[8|12.0|16.0|4/4|NoteEventStr0|NoteEventStr1]" means a melodic Phrase for channel 8, beatRange=12-16, in 4/4, with 2 NoteEvents.
Example "[drums_9|12.0|16.0|4/4|NoteEventStr0|NoteEventStr1]" means a drums Phrase for channel 9.- Parameters:
sp
-- Returns:
- See Also:
-
loadAsString
Create a SizedPhrase from the specified string.- Parameters:
s
-- Returns:
- Throws:
ParseException
- If s is not a valid string.- See Also:
-
toString
-