Package org.wmn4j.notation
Class SingleStaffPart
java.lang.Object
org.wmn4j.notation.SingleStaffPart
Represents a part with a single staff in a score.
This class is immutable.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.wmn4j.notation.Part
Part.Attribute
-
Field Summary
Fields inherited from interface org.wmn4j.notation.Part
DEFAULT_STAFF_NUMBER
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(Part.Attribute attribute) Returns the given attribute.int
Returns the number of complete measures.getMeasure
(int number) Returns the measure with the given number.getMeasure
(int staffNumber, int measureNumber) Returns the measure with the given number from the staff with the given number.int
Returns the number of measures in this part.getName()
Returns the name of this part or empty if the part has no name.Returns a part iterator that can be used to iterate through the measures in this part.getPartIterator
(int firstMeasure, int lastMeasure) Returns a part iterator that can be used to iterate through the measures in this part.getStaff()
Returns the staff in this part.getStaff
(int staffNumber) Returns the staff with the given number.int
Returns the number of staves in this part.Returns the numbers of the staves in this part in ascending order.boolean
Returns true if this part has multiple staves.static SingleStaffPart
Returns a part with a single staff with the given name and staff.static SingleStaffPart
of
(Map<Part.Attribute, String> partAttributes, Staff staff) Returns a part with a single staff with the given attributes and staff.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.wmn4j.notation.Part
hasPickupMeasure, iterator
-
Method Details
-
of
Returns a part with a single staff with the given name and staff.- Parameters:
name
- the name of the partstaff
- the staff of this part- Returns:
- a part with a single staff with the given name and measures
-
of
Returns a part with a single staff with the given attributes and staff.- Parameters:
partAttributes
- a map of attributes to be set for this partstaff
- the staff of this part- Returns:
- a part with a single staff with the given attributes and measures
-
getName
Description copied from interface:Part
Returns the name of this part or empty if the part has no name. -
isMultiStaff
public boolean isMultiStaff()Description copied from interface:Part
Returns true if this part has multiple staves.- Specified by:
isMultiStaff
in interfacePart
- Returns:
- true if this part has multiple staves
-
getStaffCount
public int getStaffCount()Description copied from interface:Part
Returns the number of staves in this part.- Specified by:
getStaffCount
in interfacePart
- Returns:
- number of staves in this part
-
getStaffNumbers
Description copied from interface:Part
Returns the numbers of the staves in this part in ascending order.- Specified by:
getStaffNumbers
in interfacePart
- Returns:
- the numbers of the staves in this part in ascending order
-
getMeasure
Returns the measure with the given number.- Parameters:
number
- number of measure to return- Returns:
- measure with the given number
-
getMeasure
Description copied from interface:Part
Returns the measure with the given number from the staff with the given number.- Specified by:
getMeasure
in interfacePart
- Parameters:
staffNumber
- the number of the staff from which the get the measuremeasureNumber
- the number of the measure- Returns:
- the measure with measureNumber from the staff with staffNumber
-
getStaff
Returns the staff in this part.- Returns:
- the only staff in this part
-
getPartIterator
Description copied from interface:Part
Returns a part iterator that can be used to iterate through the measures in this part.- Specified by:
getPartIterator
in interfacePart
- Returns:
- an iterator that can be used to iterate through the measures in this part
-
getPartIterator
Description copied from interface:Part
Returns a part iterator that can be used to iterate through the measures in this part.- Specified by:
getPartIterator
in interfacePart
- Parameters:
firstMeasure
- the measure number of the first measure to be included in iterationlastMeasure
- the measure number of the last measure to be included in iteration- Returns:
- an iterator that can be used to iterate through the measures in this part
-
getAttribute
Description copied from interface:Part
Returns the given attribute. If the attribute is not present, returns empty.- Specified by:
getAttribute
in interfacePart
- Parameters:
attribute
- the attribute to return from this part- Returns:
- the value of the attribute, or empty if the attribute is not set
-
getStaff
Description copied from interface:Part
Returns the staff with the given number. -
getMeasureCount
public int getMeasureCount()Description copied from interface:Part
Returns the number of measures in this part. The count is based on the measure numbers, so even if a part has multiple staves its measure count is the largest measure number.- Specified by:
getMeasureCount
in interfacePart
- Returns:
- number of measures in the part. If there is a pickup measure, it is included in the count.
-
getFullMeasureCount
public int getFullMeasureCount()Description copied from interface:Part
Returns the number of complete measures. Does not include the pickup measure if there is one.- Specified by:
getFullMeasureCount
in interfacePart
- Returns:
- the number of measures excluding the pickup measure
-
toString
-