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>,SequencedCollection<NoteEvent>,SequencedSet<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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jjazz.phrase.api.Phrase
Phrase.XStreamConfig -
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
ConstructorsConstructorDescriptionSizedPhrase(int channel, FloatRange beatRange, TimeSignature ts, boolean isDrums) Create a sized phrase with no notes. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAddNote(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.intstatic SizedPhraseCreate a SizedPhrase from the specified string.static StringSave the specified SizedPhrase as a string.voidshiftAllEvents(float shiftInBeats, boolean handleNegativePositions) 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, equals, equalsAsIntervals, equalsAsNoteNearPosition, 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, toStringOneNotePerLine, toStringSimpleMethods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.NavigableSet
removeFirst, removeLast, reversed
-
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:PhraseA deep clone: returned phrase contains clones of the original NoteEvents. -
getNotesBeatRange
Get the beat range corresponding to this phrase.Overrides Phrase.getNotesBeatRange() because the beat range is fixed for a SizedPhrase.
- Overrides:
getNotesBeatRangein classPhrase- Returns:
-
getTimeSignature
- Returns:
- The timeSignature used in this phrase.
-
getSizeInBars
public int getSizeInBars() -
shiftAllEvents
public void shiftAllEvents(float shiftInBeats, boolean handleNegativePositions) Shift the associated BeatRange and all events.- Overrides:
shiftAllEventsin classPhrase- Parameters:
shiftInBeats-handleNegativePositions- If true reset negative note positions to 0
-
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
-