Package org.wmn4j.notation
Class ChordBuilder
java.lang.Object
org.wmn4j.notation.ChordBuilder
- All Implemented Interfaces:
Iterable<NoteBuilder>
,DurationalBuilder
Class for building
Chord
objects.
Instances of this class are not thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionChordBuilder
(List<NoteBuilder> noteBuilders) Constructor.ChordBuilder
(Chord chord) Constructor that creates a new builder with the contents of the given chord.ChordBuilder
(NoteBuilder noteBuilder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionadd
(NoteBuilder noteBuilder) Adds the given NoteBuilder into this builder.build()
Returns a durational notation element with the values set in the builder.Returns the duration set in this builder.boolean
Returns true if this is a chord builder, false otherwise.iterator()
removeIf
(Predicate<NoteBuilder> filter) Remove a NoteBuilder placed in this ChordBuilder.setDuration
(Duration duration) Sets a new duration to this builder and all the NoteBuilders in it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.wmn4j.notation.DurationalBuilder
isNoteBuilder, isRestBuilder, toChordBuilder, toNoteBuilder, toRestBuilder
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ChordBuilder
Constructor. This builder takes ownership of the given NoteBuilder.- Parameters:
noteBuilder
- the note builder that specifies the first note in this builder
-
ChordBuilder
Constructor. This builder takes ownership of the given NoteBuilders.- Parameters:
noteBuilders
- the note builders that are placed into this builder
-
ChordBuilder
Constructor that creates a new builder with the contents of the given chord. Ties and connected notations in the notes of the given chord are not copied.- Parameters:
chord
- the chord from which the contents of notes are copied to this builder
-
-
Method Details
-
add
Adds the given NoteBuilder into this builder. This builder takes ownership of the given NoteBuilder.- Parameters:
noteBuilder
- the note builder that is added to this builder- Returns:
- reference to this
-
removeIf
Remove a NoteBuilder placed in this ChordBuilder.- Parameters:
filter
- Predicate to determine which NoteBuilders are removed- Returns:
- reference to this
-
isChordBuilder
public boolean isChordBuilder()Description copied from interface:DurationalBuilder
Returns true if this is a chord builder, false otherwise.- Specified by:
isChordBuilder
in interfaceDurationalBuilder
- Returns:
- true if this is a chord builder, false otherwise
-
setDuration
Sets a new duration to this builder and all the NoteBuilders in it.- Specified by:
setDuration
in interfaceDurationalBuilder
- Parameters:
duration
- Duration to set- Returns:
- reference to this
-
getDuration
Description copied from interface:DurationalBuilder
Returns the duration set in this builder.- Specified by:
getDuration
in interfaceDurationalBuilder
- Returns:
- the duration set in this builder
-
iterator
- Specified by:
iterator
in interfaceIterable<NoteBuilder>
-
build
Description copied from interface:DurationalBuilder
Returns a durational notation element with the values set in the builder.- Specified by:
build
in interfaceDurationalBuilder
- Returns:
- a durational notation element with the values set in the builder
-