use of com.xenoage.utils.annotations.MaybeNull in project Zong by Xenoage.
the class BeamNotator method compute.
@MaybeNull
public BeamNotation compute(Beam beam, Notations notations) {
// compute fragments
List<Fragments> fragments = beamFragmenter.compute(beam);
// get minimum stem length and gap
BeamRules beamRules = BeamRules.getRules(beam);
float gapIs = beamRules.getGapIs();
// collect chords
List<ChordNotation> chords = notations.getBeamChords(beam);
// create notation
BeamNotation beamNotation = new BeamNotation(beam, beam.getMP(), fragments, gapIs, chords);
return beamNotation;
}
use of com.xenoage.utils.annotations.MaybeNull in project Zong by Xenoage.
the class Notator method compute.
/**
* Computes the {@link Notation} of the given element.
*/
@MaybeNull
private Notation compute(MPElement element, Context context, Notations notations) {
ElementNotator notator = notators.get(element.getMusicElementType());
if (// element needs no notation
notator == null)
return null;
Notation notation = notator.compute(element, context, notations);
return notation;
}
use of com.xenoage.utils.annotations.MaybeNull in project Zong by Xenoage.
the class MxlPrint method read.
@MaybeNull
public static MxlPrint read(XmlReader reader) {
MxlLayout layout = new MxlLayout();
MxlPrintAttributes printAttributes = MxlPrintAttributes.read(reader);
while (reader.openNextChildElement()) {
layout.readElement(reader);
reader.closeElement();
}
if (false == layout.isUsed())
layout = null;
if (layout != null || printAttributes != noPrintAttributes)
return new MxlPrint(layout, printAttributes);
else
return null;
}
use of com.xenoage.utils.annotations.MaybeNull in project Zong by Xenoage.
the class MxlDynamics method read.
/**
* Reads the given element and returns it, or returns null if
* the element is empty or not supported.
*/
@MaybeNull
public static MxlDynamics read(XmlReader reader) {
// attributes
MxlPrintStyle printStyle = MxlPrintStyle.read(reader);
MxlPlacement placement = MxlPlacement.read(reader);
// get first element
if (false == reader.openNextChildElement())
// dynamics element may be empty according to schema
return null;
String childText = reader.getElementName();
reader.closeElement();
DynamicValue element = getEnumValue(childText, DynamicValue.values());
if (element != null)
return new MxlDynamics(element, printStyle, placement);
else
return null;
}
use of com.xenoage.utils.annotations.MaybeNull in project Zong by Xenoage.
the class MxlDirection method read.
/**
* Returns null, when no supported content was found.
*/
@MaybeNull
public static MxlDirection read(XmlReader reader) {
// attributes
MxlPlacement placement = MxlPlacement.read(reader);
// elements
List<MxlDirectionType> directionTypes = alist();
Integer staff = null;
MxlSound sound = null;
while (reader.openNextChildElement()) {
String n = reader.getElementName();
switch(n) {
case MxlDirectionType.elemName:
MxlDirectionType directionType = MxlDirectionType.read(reader);
if (directionType != null)
directionTypes.add(directionType);
break;
case "staff":
staff = reader.getTextInt();
break;
case MxlSound.elemName:
sound = MxlSound.read(reader);
break;
}
reader.closeElement();
}
if (directionTypes.size() > 0) {
return new MxlDirection(directionTypes, staff, sound, placement);
} else {
return null;
}
}
Aggregations