Package org.jjazz.song.api
Class BeatIterator
java.lang.Object
org.jjazz.song.api.BeatIterator
A beat Iterator within a Song.
 
- 
Constructor SummaryConstructorsConstructorDescriptionBeatIterator(Song song) Create a beat iterator for the specified song.BeatIterator(Song song, Position pos) Construct an iterator for the specified song, starting at specified position.BeatIterator(Song song, IntRange barRange) Construct an iterator for the specified bar range within a song.BeatIterator(Song song, IntRange barRange, Position pos) Construct an iterator for the specified bar range within a song, starting at pos.
- 
Method SummaryModifier and TypeMethodDescriptiongetSong()The time signature corresponding to the current position.booleanhasNext()True if next integer beat position is not in the song.booleanTrue if there is a next bar in the song.booleanhasNextHalfBar(boolean swing) True if there is a next half bar in the song.next()Advance the song position to the next integer beat.nextBar()Advance the song position to the next bar (with beat 0).nextHalfBar(boolean swing) Advance the song position to the next half bar (beat=0 or half-bar).peek()Get the next position without advancing the iterator.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining, remove
- 
Constructor Details- 
BeatIteratorCreate a beat iterator for the specified song.NOTE: modifying the song while using this iterator will produce unknown results. - Parameters:
- song-
 
- 
BeatIteratorConstruct an iterator for the specified song, starting at specified position.NOTE: modifying the song while using this iterator will produce unknown results. - Parameters:
- song-
- pos- Must be a position within the song.
 
- 
BeatIteratorConstruct an iterator for the specified bar range within a song.NOTE: modifying the song while using this iterator will produce unknown results. - Parameters:
- song-
- barRange- A bar range within the song.
 
- 
BeatIteratorConstruct an iterator for the specified bar range within a song, starting at pos.NOTE: modifying the song while using this iterator will produce unknown results. - Parameters:
- song-
- pos- must be within the bar range.
- barRange- A bar range within the song.
 
 
- 
- 
Method Details- 
getSong
- 
peekGet the next position without advancing the iterator.NOTE: Position might be out of the song. - Returns:
 
- 
hasNextpublic boolean hasNext()True if next integer beat position is not in the song.
- 
nextAdvance the song position to the next integer beat.- Specified by:
- nextin interface- Iterator<Position>
- Returns:
- A position with an integer beat (e.g.bar=2 beat=3.0)
- Throws:
- NoSuchElementException
 
- 
hasNextBarpublic boolean hasNextBar()True if there is a next bar in the song.- Returns:
 
- 
nextBarAdvance the song position to the next bar (with beat 0).- Returns:
- A position with beat=0
- Throws:
- NoSuchElementException
 
- 
hasNextHalfBarpublic boolean hasNextHalfBar(boolean swing) True if there is a next half bar in the song.- Parameters:
- swing-
- Returns:
 
- 
nextHalfBarAdvance the song position to the next half bar (beat=0 or half-bar).- Parameters:
- swing-
- Returns:
- Throws:
- NoSuchElementException
 
- 
getTimeSignatureThe time signature corresponding to the current position.- Returns:
- Can be null if outside the song
 
 
-